Open hughbris opened 1 year ago
| xargs -d '\n' chmod ...
brought up xargs: unrecognized option: d
in the logs. Looks like the version bundled with our base image does not support it:
Usage: xargs [OPTIONS] [PROG ARGS]
Run PROG on every item given by stdin
-0 NUL terminated input
-a FILE Read from FILE instead of stdin
-o Reopen stdin as /dev/tty
-r Don't run command if input is empty
-t Print the command on stderr before execution
-p Ask user whether to run each command
-E STR,-e[STR] STR stops input processing
-I STR Replace STR within PROG ARGS with input line
-n N Pass no more than N args to PROG
-s N Pass command line of no more than N bytes
-P N Run up to N PROGs in parallel
-x Exit if size is exceeded
I tried the -0
option because I wasn't entirely privy to what exactly NUL terminated input
was despite the help screen assuming I was: xargs: argument line too long
.
An alternative is provided on Stack Overflow and needs to be tested more rigorously before committing:
| tr '\n' '\0' | xargs -0 -n1 chmod...
. So far so good from command line when I shell into the container. Unfortunately I don't have the data this week to try this out with a build yet.
I noticed in some logs after a recent install of a site with existing content (
user
populated) that there were some errors fromchmod
and it looks like it couldn't set permissions for files that had spaces in their names.This looks like a problem where
xargs
is treating every space piped to it fromfind
as a new file to bechmod
ed. Indeed, that's what I'm seeing from a quick search and the solution seems to be to add a flag to changexargs
's delimiter. Hopefully it's that simple, need to test.