Re: Checking executability for asynchronous commands
From:
Eli Schwartz
Subject:
Re: Checking executability for asynchronous commands
Date:
Mon, 28 Dec 2020 17:30:06 -0500
On 12/28/20 4:45 PM, Léa Gris wrote:
When you handle such logic within Bash you already lost on a race
condition when foo is readable and executable when you test it, but when
it reaches the actual execution, it is no longer the case.
Bash is full of race conditions, because bash was never meant as a
General Purpose language. Bash is a good command sequencer.
Now if ppl forget to use wait PID after launching a sub-shell background
command, then shame on them.
The race condition doesn't matter if they anyways need to check the
status by waiting on the PID, in order to handle "it executed, but
resulted in failure".
So it's not very tragic if the race condition resulted in users being
unable to see the *enhanced* error message describing the missing
dependency executable condition... this entire thread seems to just be
about error reporting, right?
(Though I have to wonder at these amazing AWOL commands that get
uninstalled on people all the time right in the middle of their scripts.
Maybe if they use a package manager for both the scripts and the
dependency executables, they could fully prevent race conditions *and*
not even need to check if their dependencies are installed.)
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User