[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



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.

Ian.

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