[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

I think I will go with this one...

> 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.

... because I cannot really make #2 work, and I'm not sure I fully
understand it.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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