mainThe GNU Bourne-Again SHell - Support: sr #109667, unexpected exit value from...

 
 

sr #109667: unexpected exit value from "jobs"

Submitter:  Brian K. White <bkw>
Submitted:  Wed 03 Apr 2019 08:23:18 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Apr 2019 02:19:37 PM UTC, comment #1: 

Thanks for the report. I agree that `jobs' in an interactive shell should count as notifying the user of a job's status and cause it to be removed from the jobs table.

Chet Ramey <chet>
Group administrator
Wed 03 Apr 2019 08:23:18 PM UTC, original submission:  

In the following 2 examples, I believe the only relevant difference is:

In the working example, there is at least one external command somewhere in the while loop. ("sleep 1")

In the non-working example, there are no external commands anywhere in the while loop. ("sleep 1" is replaced with "read -t1")

The problem is that in the non-working example the condition of "jobs" returns true forever, even though the bg job has in fact gone away.

==Working==

bkw@negre:~$ sleep 5 &
[1] 8185
bkw@negre:~$ while jobs %% ;do echo . ;sleep 1 ;done
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Done                    sleep 5
bash: jobs: %%: no such job
bkw@negre:~$


==Not Working==

bkw@negre:~$ sleep 5 &
[1] 8182
bkw@negre:~$ while jobs %% ;do echo . ;read -t1 ;done
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Running                 sleep 5 &
.
[1]+  Done                    sleep 5
.
[1]+  Done                    sleep 5
.
[1]+  Done                    sleep 5
.
[1]+  Done                    sleep 5
.
[1]+  Done                    sleep 5
.
^C
bkw@negre:~$


Brian K. White <bkw>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by bkw (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-09 chet StatusNone Done

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code