On Tue, May 23, 2023 at 11:41:32PM +0200, Christian Weisgerber wrote: > This replaces "$(cat file)" with the ksh construct "$(<file)". > Admittedly cosmetic.
Functional behaviour won't change, but stderr handling is subtly different, as you're gladly aware of. > I have left the line > > local _sec=$(cat $HTTP_SEC 2>/dev/null) Yes, this would still failure to access the file: local _sec=$(< $HTTP_SEC 2>/dev/null) > > unchanged, since it would require > > { local var=$(<$HTTP_SEC); } 2>/dev/null > > which is sufficiently opaque that I'm not sure it's an improvement. +1 > --- distrib/miniroot/install.sub > +++ distrib/miniroot/install.sub > @@ -77,7 +77,7 @@ wait_cgiinfo() { > local _l _s _key _val > > if [ -f /tmp/cgipid ]; then > - wait "$(cat /tmp/cgipid)" 2>/dev/null > + wait "$(</tmp/cgipid)" 2>/dev/null > rm -f /tmp/cgipid > fi > > @@ -2650,7 +2650,7 @@ start_cgiinfo() { > ( > sleep 12; > if [ -f /tmp/cgipid ]; then > - kill -INT -"$(cat /tmp/cgipid)" >/dev/null 2>&1 > + kill -INT -"$(</tmp/cgipid)" >/dev/null 2>&1 > # wait will be done by wait_cgiinfo > fi > ) & > @@ -3449,7 +3449,7 @@ do_upgrade() { > # Perform final steps common to both an install and an upgrade. > finish_up > if [ -f /tmp/wdpid ]; then > - kill -KILL "$(cat /tmp/wdpid)" 2>/dev/null > + kill -KILL "$(</tmp/wdpid)" 2>/dev/null > # do not bother waiting > rm -f /tmp/wdpid > fi > @@ -3480,7 +3480,7 @@ reset_watchdog() { > reset_watchdog() { > local _pid > if [ -f /tmp/wdpid ]; then > - _pid=$(cat /tmp/wdpid) > + _pid=$(</tmp/wdpid) > kill -KILL -$_pid 2>/dev/null > wait $_pid 2>/dev/null > rm -f /tmp/wdpid These don't silence stderr in the subshell itself, so behaviour should be the same and we expect it to always work. If it doesn't, there's a bug to fix and I believe we can run into weird permission errors in the installer, i.e. the only failure would be that the file does not exist. I'm pointing this out because the error message we'd get provides less information with your diff: $ echo $(cat /nope) 2>/dev/null cat: /nope: No such file or directory vs. echo $(< /nope) 2>/dev/null ksh: /nope: cannot open $(<) input But given the constraint environment, I'm fine with turning those four $(cat ...) instances into $(< ...) like the exising seven onces with the intial example being the only outlier.