Re: Fwd: Don't set $?=130 when discarding the current command line (not run yet) with CTRL-C?

2019-11-23 Thread Robert Elz
Date:Fri, 22 Nov 2019 16:16:58 +0800
From:Clark Wang 
Message-ID:  


  | Curious why people care about this?

For some people it seems to be related to wanting to see $? in their
prompt, and either have it explicit that a SIGINT interrupted command
entry, or continue with previous $? ..

For me it is partly just because of what $? is.  From posix:

? Expands to the decimal exit status of the most recent pipeline
  (see Section 2.9.2).

nothing about being altered by anything other than (at least attempted)
execution of a pipeline (ie: some command or other).

More practically, the times when I want it are when I have run a command,
then start typing the next one, and realise that I really meant to check
the exit status of the last one before running another.   If I finish typing
my next command I just mentally curse my forgetfulness, and take whatever
action I can (often re-running the previous command, if that makes sense).
But if I catch it before I have finished the next command, I have the
opportunity to abort what I'm doing, and check $? before it is lost.

If that happens while still on the first (or only) line of the new command,
then a line kill char (^U often) is OK, deletes whatever I typed, and I
can replace that with "echo $?" or whatever.

But if it happens after a \n has been entered, that no longer works,
whereas SIGINT (^C usually) does:

Compare bash...

jinx$ false
jinx$ while sleep 3
do
^C
jinx$ echo $?
130

(in bash my PS2 is set to be (become really) invisible so I can cut/paste
whole command sequences)

to the NetBSD sh (where editline doesn't handle my PS2 "properly")

[jinx]{2}$ false
[jinx]{2}$ while sleep 3
> do
> 
[jinx]{2}$ echo $?
1
[jinx]{2}$ true
[jinx]{2}$ while sleep 3
> do
> 
[jinx]{2}$ echo $?
0

(there was a ^C, not echoed explicitly, after the PS2 prompt on the line
after each "do" ... the lack of the echo another difference between editline
and readline I assume, the ^C is echoed if I disable editline and just
use the tty driver, my PS2 also works as planned then).

[jinx]{2}$ set +V
[jinx]{2}$ true
[jinx]{2}$ while sleep 3
do
^C
[jinx]{2}$ echo $?
0

kre




Fwd: Re: Bash-5.0 Official patch 11

2019-11-23 Thread Dennis Clarke



Nothing new .. merely pointing out this is still an issue and for even
 more fun an out of tree build reveals :

/opt/bw/gcc9/bin/gcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"x86_64"' 
-DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"x86_64-pc-linux-gnu"' 
-DCONF_VENDOR='"pc"' -DLOCALEDIR='"/usr/local/share/locale"' 
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash-5.0-011 
-I../bash-5.0-011/include -I../bash-5.0-011/lib   -I/opt/bw/include 
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -D_TS_ERRNO 
-std=iso9899:1999 -O0 -m64 -g -pedantic -pedantic-errors -Wpedantic 
-march=k8 -mtune=k8 -Wl,-rpath=/opt/bw/lib,--enable-new-dtags 
-fno-builtin -malign-double -mpc80 -Wno-parentheses -Wno-format-security 
-c ../bash-5.0-011/y.tab.c

/usr/homes/chet/src/bash/src/parse.y: In function 'decode_prompt_string':
/usr/homes/chet/src/bash/src/parse.y:5996:21: error: implicit 
declaration of function 'count_all_jobs' [-Wimplicit-function-declaration]

gmake: *** [Makefile:101: y.tab.o] Error 1

Which sort of has your name on it there Chet.

Anyways ... just wanted to utter a reminder that the tarball has some
restricted ./lib/glob/smatch.c in there as well as other ... stuff.

--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional


 Forwarded Message 
Subject: Re: Bash-5.0 Official patch 11
Date: Wed, 11 Sep 2019 00:52:29 -0400
From: Dennis Clarke 
To: bug-bash@gnu.org

On 8/29/19 2:22 PM, Chet Ramey wrote:

 BASH PATCH REPORT
 =



Small problem when building bash-5.0-011 out of tree is that the
file lib/glob/smatch.c is set chmod 600 and thus not readable by
the build user.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional