helpThe GNU Bourne-Again SHell - Support: sr #109046, Should `(set -p)` (at least in...

 
 

sr #109046: Should `(set -p)` (at least in POSIX mode) list background jobs of parent environment?

Submitted by:  Geoff Nixon <gsnixon>
Submitted on:  Thu 19 May 2016 12:57:50 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: Wont Do
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: *BSD

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 03 Aug 2016 08:00:17 PM UTC, comment #1:

They don't inherit jobs because those jobs are not children of the subshell begin to run the (...), and that shell instance can't get notified when they change state. There is special-case code to allow $(jobs -p) because that seems to be generally useful and requested. I don't see the same need to special-case (...) subshells.

Chet Ramey <chet>
Project Administrator
Thu 19 May 2016 12:57:50 AM UTC, original submission:

Hi Chet (et al),

I was wondering what your thought is on this recent issue I've revived about `dash`: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482999#32

Particularly, the bit about how in bash (with or without POSIX mode enabled), explicit subshells of the `(...)` variety inherit most of the parent shell's environment, including unexported variables, etc., but not "asynchronous lists".

In other words, in ksh93, pdksh, mksh, oksh, and yash, the output of `(jobs -p)` is the same as `echo $(jobs -p). But not in bash (or busybox ash).

As I read it, I can't seem to find in the POSIX standard why/how `(...)` subshells should not inherit the jobs list, but `$(...)` subshells should. What's your interpretation here?

Cheers,
Geoff

Geoff Nixon <gsnixon>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 03 Aug 2016 08:00:17 PM UTCchetStatusNone=>Wont Do
    Thu 19 May 2016 12:58:47 AM UTCgsnixonCarbon-Copy-=>Added -unavailable-
    Thu 19 May 2016 12:57:50 AM UTCgsnixonCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1