summary refs log tree commit diff
path: root/src/funcs/dirs
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2014-09-26 22:27:13 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-09-26 22:27:13 +0800
commit4c44561d9f97331bb23f900f47a69305091f3ab3 (patch)
treef1cd0d1497ec8866b739fb6616c1753256993a36 /src/funcs/dirs
parent[BUILTIN] Set command -p path to /usr/sbin:/usr/bin:/sbin:/bin (diff)
downloaddash-4c44561d9f97331bb23f900f47a69305091f3ab3.tar.gz
dash-4c44561d9f97331bb23f900f47a69305091f3ab3.zip
[JOBS] Fix off-by-one error for multiple of four job numbers
On 29/07/13 23:44, Luigi Tarenga wrote:
> hi list,
> while writing a script to execute parallel ssh command on many host I found
> a strange behavior of dash. I can replicate it with a very simple script but
> didn't find any documentation about dash or POSIX that can explain it.
> 
> tested on centos 6.4 (dash 0.5.5.1) and wih dash compiled from source (0.5.7)
> the following script reports error:
> 
> #!/bin/dash
> 
> sleep 3 &
> sleep 3 &
> sleep 3 &
> sleep 3 &
> 
> #/bin/true
> jobs -l
> 
> wait %1
> wait %2
> wait %3
> wait %4
> 
> [vortex@lizard ~]$ ./dash-0.5.7/src/dash test.sh
> [4] + 4569 Running
> [3] - 4568 Running
> [2]   4567 Running
> [1]   4566 Running
> prova: 14: wait: No such job: %4
> [vortex@lizard ~]$ echo $?
> 2

Yes, this looks like a bug to me. The number of allocated jobs is always
kept as a multiple of four, and the first check in considering whether
the job number is valid is "if it's greater than or equal to the number
of allocated job, it's invalid". That doesn't look right. That would
only be right if jobs were zero-based, but they aren't. If it's exactly
equal to the number of available jobs, it can still be valid. It works
when adding /bin/true, because four more more jobs end up allocated
internally.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions
ohover-highlight'> 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe Mixed bag like most collections of short stories. Some of them are pretty good. The author of the worst written story also has the worst written bio. 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe Absolutely indiscriminately. 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine. 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe