From: Luigi Tarenga <luigi.tarenga@gmail.com>
To: Harald van Dijk <harald@gigawatt.nl>
Cc: dash@vger.kernel.org
Subject: Re: possible bug in job control
Date: Tue, 30 Jul 2013 18:42:21 +0200 [thread overview]
Message-ID: <CAKkO-Ej3N1MrKKkqxuVDgeky59joH8mN+X1EjXYaWMeuByd0RQ@mail.gmail.com> (raw)
In-Reply-To: <51F6F10C.4060109@gigawatt.nl>
Hi Harald,
thanks for the patch. I tested it against source tarball (0.5.7) and
it works for me.
It works with the example scripts and with my script of parallel ssh
(tested with case of multiple of 4 jobs).
many thanks for the support
Luigi
On Tue, Jul 30, 2013 at 12:47 AM, Harald van Dijk <harald@gigawatt.nl> wrote:
> 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.
>
> The attached patch should fix it.
>
> Cheers,
> Harald
next prev parent reply other threads:[~2013-07-30 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 21:44 possible bug in job control Luigi Tarenga
2013-07-29 22:47 ` Harald van Dijk
[not found] ` <CAKkO-EiY79gEH+SbvK6kF=1v0h7Q5=ypHGcs+m-yHdMFq-L-7A@mail.gmail.com>
2013-07-30 16:17 ` Harald van Dijk
2013-07-31 7:34 ` Herbert Xu
2013-07-30 16:42 ` Luigi Tarenga [this message]
2014-09-26 9:28 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKkO-Ej3N1MrKKkqxuVDgeky59joH8mN+X1EjXYaWMeuByd0RQ@mail.gmail.com \
--to=luigi.tarenga@gmail.com \
--cc=dash@vger.kernel.org \
--cc=harald@gigawatt.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).