[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 6/6] firmware/shim: fix build process to use POSIX find options

On Wed, Jan 17, 2018 at 04:24:27PM +0000, Ian Jackson wrote:
> Roger Pau Monne writes ("[PATCH 6/6] firmware/shim: fix build process to use 
> POSIX find options"):
> > The -printf find option is not POSIX compatible, so replace it with
> > another rune.
> ...
> >               cd $(D)/$(d); \
> > -             find $(XEN_ROOT)/$(d)/ -type d -printf "./%P\n" |  xargs 
> > mkdir -p);)
> > +             find $(XEN_ROOT)/$(d)/ -type d -exec sh -c \
> > +                 "echo {} | sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir 
> > -p" \;);)
> This is now a pretty nasty shell construct.
> If you're going to use sed, you could just
>    find ... -print | sed ... | xargs mkdir -p
> Substituting {} into the middle of the shell rune is bad practice in
> general because it might contain metacharacters or spaces.  In our
> build system this doesn't matter because that breaks anyway, but it's
> very poor style (and also it buries the actual data flow path into the
> middle of a complicated manglement).
> If you wanted to use -exec and sh, you could do something like this
>    -exec sh -c 'exec mkdir "${1#$(XEN_ROOT}/$(d)/}"' x {}
> maybe.
> And finally, I don't really understand why it is necessary to strip
> $(XEN_ROOT)/$(d)/ out at all.

We want the path without $(XEN_ROOT)/$(d) so we can construct the same
tree under $(d). It is better to just look at the tree structure after
running the linkfarm rune.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.