Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15080 > unrolled thread

Re: $? is -1

Started byChet Ramey <chet.ramey@case.edu>
First post2019-07-05 09:03 -0400
Last post2019-07-05 09:03 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: $? is -1 Chet Ramey <chet.ramey@case.edu> - 2019-07-05 09:03 -0400

#15080 — Re: $? is -1

FromChet Ramey <chet.ramey@case.edu>
Date2019-07-05 09:03 -0400
SubjectRe: $? is -1
Message-ID<mailman.210.1562332015.2688.bug-bash@gnu.org>
On 7/5/19 5:57 AM, bashbug@jonkmans.nl wrote:

> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
> 
> Description:
> 	Two related issues, regarding negative exit status.
> 
> 	First, I always thought that the exit status, $?, was in the 0-255 range.
> 	( wait4 int argument for status masked with 0377 ) 
> 	But I got a -1 in the exit status of (builtin command) bind.
> 	Is this a bug or wanted behaviour?

It certainly seems like a problem.

> 	Second, when ran in a subshell, the same exit status gets mapped to 255.
> 	While logical, as -1 gets mapped to 255, it seems inconsistent.
> 	( from the manual: "The return status is the exit status of list." )

It's the difference between passing a status around the shell and passing
it through the waitpid() interface, which takes just eight bits.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web