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:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Wont Do
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating 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 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 gsnixon
  • -email is unavailable- added by gsnixon (Submitted the item)
  • -email is unavailable- added by gsnixon
  •  

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

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-03 chet StatusNone => Wont Do
    2016-05-19 gsnixon Carbon-Copy- => Added -email is unavailable-
    2016-05-19 gsnixon Carbon-Copy- => Added -email is unavailable-

    Back to the top


    Powered by Savane 3.3