Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: bashbug@jonkmans.nl Newsgroups: gnu.bash.bug Subject: $? is -1 Date: Fri, 5 Jul 2019 11:57:50 +0200 (CEST) Lines: 37 Approved: bug-bash@gnu.org Message-ID: References: <20190705095750.46F0D125555@sint.jonkmans.nl> NNTP-Posting-Host: lists.gnu.org X-Trace: usenet.stanford.edu 1562320742 22325 209.51.188.17 (5 Jul 2019 09:59:02 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org,bash@packages.debian.org Envelope-to: bug-bash@gnu.org X-SourceIP: 62.163.69.112 X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.3 cv=MtAsFFSe c=1 sm=1 tr=0 a=ONQKbMlQgRqYTzjcV855Rg==:17 a=0o9FgrsRnhwA:10 a=qUH8b_KK8w4i3-tm2lkA:9 X-Ziggo-Spam-Status: No X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.54.42.169 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20190705095750.46F0D125555@sint.jonkmans.nl> Xref: csiph.com gnu.bash.bug:15079 Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-Det0cS/bash-4.4.18=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -Wno-parentheses -Wno-format-security uname output: Linux mine 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu 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? 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." ) Repeat-By: $ bind -x "l":ls bash: bind: l:ls: first non-whitespace character is not `"' $ echo $? -1 $ ( bind -x "l":ls 2>/dev/null ); echo $? 255 $ # This would have worked (but is irrelevant) $ bind -x '"l":ls' # exit 0 $ bind l:self-insert # undo