On 05/18/2016 06:03 PM, Geoff Nixon wrote: > Again, speaking for myself, I think the standard is actually pretty clear here. > Referring again to the "Shell Command Language" page: > > The format for grouping commands is as follows: > (compound-list) > Execute compound-list in a *subshell environment*... > > That is, I believe the behavior of bash and busybox does not fully adhere to the > the standard; pdksh, ksh93, mksh, yash, and oksh are compliant. > >> Personally, I feel that even if your interpretation is wrong (and I'm >> not saying it is), it is still less undesirable than dash's current >> behaviour. If there's a reasonable chance a patch for it would be >> accepted, I'd be willing to try to make it so. > > Agreed. I'd very much like to see a patch for this; and I certainly hope it > would be accepted! > > At the *very, very least*, I think the fact that `jobs -p` can have stdout > redirected to a file, yet cannot be used in a pipeline, is most definitely > bug. Can you think of any other command where stdout can be redirected to a file > but cannot be piped? http://austingroupbugs.net/view.php?id=53 The trap command is in the same boat as jobs, where redirecting to a file is different than execution in a subshell, and where the shell may special case (but perhaps by lexical analysis only) that if a subshell is about to run where only the single command is being executed, then it can behave as if that single command were in the context of the parent instead of being a true subshell, precisely for the purpose of giving output that would otherwise be lost. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature