Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53

2014-11-03 Thread Graham Jones
These are for:
bash --version
GNU bash, version 4.3.30(1)-release (x86_64-apple-darwin14.0.0)

lldb backtrace:
(lldb) process attach --pid 5955
Process 5955 stopped
Executable module set to /usr/local/bin/bash.
Architecture set to: x86_64h-apple-macosx.
(lldb) bt
* thread #1: tid = 0x169339, 0x0001020421c0 bash`add_history + 160, queue = 
'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x0001020421c0 bash`add_history + 160
frame #1: 0x00010204565c bash`read_history_range + 540
frame #2: 0x000102009719 bash`history_builtin + 1433
frame #3: 0x000101fbda9e bash`execute_builtin + 590
frame #4: 0x000101fbb941 bash`execute_command_internal + 17457
frame #5: 0x000101fb8c44 bash`execute_command_internal + 5940
frame #6: 0x000102006104 bash`parse_and_execute + 916
frame #7: 0x000101fa8da6 bash`execute_variable_command + 374
frame #8: 0x000101fa5ef6 bash`parse_command + 86
frame #9: 0x000101fa5e5f bash`read_command + 223
frame #10: 0x000101fa5c84 bash`reader_loop + 468
frame #11: 0x000101fa506c bash`main + 6620
frame #12: 0x7fff886f15c9 libdyld.dylib`start + 1
frame #13: 0x7fff886f15c9 libdyld.dylib`start + 1
(lldb) thread list
Process 5955 stopped
* thread #1: tid = 0x169339, 0x0001020421c0 bash`add_history + 160, queue = 
'com.apple.main-thread', stop reason = signal SIGSTOP

dtruss -a:
root@zebedee:~# dtruss -p 5955 -a
Invalid connection: com.apple.coresymbolicationd
PID/THRD  RELATIVE  ELAPSDCPU SYSCALL(args)  = 
return
 5955/0x169339:  57713743 114  2 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051859 0
 5955/0x169339:  57723064  71  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051859 0
 5955/0x169339:  59167979  61  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051861 0
 5955/0x169339:  59177993  63  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051861 0
 5955/0x169339:  60645254  62  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051862 0
 5955/0x169339:  60655370   6  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051862 0
 5955/0x169339:  60635499  60  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051862 0
 5955/0x169339:  62072822  87  3 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051864 0
 5955/0x169339:  63511141  62  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051865 0
 5955/0x169339:  63520959  88  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051865 0
 5955/0x169339:  63531242   7  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051865 0
 5955/0x169339:  65032419  61  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051867 0
 5955/0x169339:  65042389   6  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
0x4D27BB) = 1415051867 0
 5955/0x169339:  66134657  65  2 madvise(0x103442000, 0x4D3000, 0x9)
 = 0 0
 5955/0x169339:  66135208 554550 madvise(0x103442000, 0x4D3000, 0x7)
 = 0 0
 5955/0x169339:  66135269  31 27 stat64(/var/mail/root\0, 
0x7FFF5DC5C618, 0x7) = -1 Err#2
 5955/0x169339:  66135303   4  1 sigprocmask(0x1, 0x7FFF5DC5C6BC, 
0x7FFF5DC5C6B8)= 0x0 0
 5955/0x169339:  66135308   5  2 ioctl(0xFF, 0x4004667A, 
0x7FFF5DC5C60C) = 0 0
 5955/0x169339:  66135318  11  9 ioctl(0xFF, 0x80047476, 
0x7FFF5DC5C68C) = 0 0
 5955/0x169339:  66135320   3  0 sigprocmask(0x3, 0x7FFF5DC5C6B8, 0x0)  
 = 0x0 0
 5955/0x169339:  66135322   3  0 sigaction(0x2, 0x7FFF5DC5C688, 
0x7FFF5DC5C6B0)  = 0 0
 5955/0x169339:  66135351   3  1 ioctl(0x0, 0x40087468, 0x7FFF5DC5C638) 
 = 0 0
 5955/0x169339:  66135353   3  2 ioctl(0x0, 0x80087467, 0x7FFF5DC5C638) 
 = 0 0
 5955/0x169339:  66135354   2  0 ioctl(0x0, 0x40487413, 0x7FFF5DC5C640) 
 = 0 0
 5955/0x169339:  66135359   5  3 ioctl(0x0, 0x80487415, 0x7FFF5DC5C640) 
 = 0 0
 5955/0x169339:  66135361   2  0 sigprocmask(0x1, 0x102073E14, 
0x102073E18)  = 0x0 0
 5955/0x169339:  66135362   2  0 sigaction(0x2, 0x7FFF5DC5C638, 
0x7FFF5DC5C698)  = 0 0
 5955/0x169339:  66135362   2  0 sigaction(0xF, 0x7FFF5DC5C638, 
0x7FFF5DC5C698)  = 0 0
 5955/0x169339:  66135363   2  0 sigaction(0x1, 0x7FFF5DC5C638, 
0x7FFF5DC5C698)  = 0 0
 5955/0x169339:  66135364   1  0 sigaction(0x3, 0x7FFF5DC5C638, 
0x7FFF5DC5C698)  = 0 0
 5955/0x169339:  66135364   2  0 sigaction(0x3, 0x7FFF5DC5C638, 
0x7FFF5DC5C678)  = 0 0
 5955/0x169339:  66135365   1  0 sigaction(0xE, 0x7FFF5DC5C638, 

Re: PROMPT_COMMAND='history -a; history -n' causes shell hang in OX 10.10 Yosemite / bash 3.2.53

2014-11-03 Thread Graham Jones
Resend with missing stats for truss after ctrl-C
 On 4 Nov 2014, at 9:08 am, Graham Jones your-name-h...@grahamjones.org 
 wrote:
 
 These are for:
 bash --version
 GNU bash, version 4.3.30(1)-release (x86_64-apple-darwin14.0.0)
 
 lldb backtrace:
 (lldb) process attach --pid 5955
 Process 5955 stopped
 Executable module set to /usr/local/bin/bash.
 Architecture set to: x86_64h-apple-macosx.
 (lldb) bt
 * thread #1: tid = 0x169339, 0x0001020421c0 bash`add_history + 160, queue 
 = 'com.apple.main-thread', stop reason = signal SIGSTOP
   * frame #0: 0x0001020421c0 bash`add_history + 160
 frame #1: 0x00010204565c bash`read_history_range + 540
 frame #2: 0x000102009719 bash`history_builtin + 1433
 frame #3: 0x000101fbda9e bash`execute_builtin + 590
 frame #4: 0x000101fbb941 bash`execute_command_internal + 17457
 frame #5: 0x000101fb8c44 bash`execute_command_internal + 5940
 frame #6: 0x000102006104 bash`parse_and_execute + 916
 frame #7: 0x000101fa8da6 bash`execute_variable_command + 374
 frame #8: 0x000101fa5ef6 bash`parse_command + 86
 frame #9: 0x000101fa5e5f bash`read_command + 223
 frame #10: 0x000101fa5c84 bash`reader_loop + 468
 frame #11: 0x000101fa506c bash`main + 6620
 frame #12: 0x7fff886f15c9 libdyld.dylib`start + 1
 frame #13: 0x7fff886f15c9 libdyld.dylib`start + 1
 (lldb) thread list
 Process 5955 stopped
 * thread #1: tid = 0x169339, 0x0001020421c0 bash`add_history + 160, queue 
 = 'com.apple.main-thread', stop reason = signal SIGSTOP
 
 dtruss -a:
 root@zebedee:~# dtruss -p 5955 -a
 Invalid connection: com.apple.coresymbolicationd
   PID/THRD  RELATIVE  ELAPSDCPU SYSCALL(args)  = 
 return
  5955/0x169339:  57713743 114  2 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051859 0
  5955/0x169339:  57723064  71  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051859 0
  5955/0x169339:  59167979  61  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051861 0
  5955/0x169339:  59177993  63  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051861 0
  5955/0x169339:  60645254  62  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051862 0
  5955/0x169339:  60655370   6  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051862 0
  5955/0x169339:  60635499  60  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051862 0
  5955/0x169339:  62072822  87  3 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051864 0
  5955/0x169339:  63511141  62  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051865 0
  5955/0x169339:  63520959  88  1 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051865 0
  5955/0x169339:  63531242   7  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051865 0
  5955/0x169339:  65032419  61  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051867 0
  5955/0x169339:  65042389   6  0 gettimeofday(0x7FFF5DC5CAA0, 0x0, 
 0x4D27BB)   = 1415051867 0
  5955/0x169339:  66134657  65  2 madvise(0x103442000, 0x4D3000, 0x9)  
  = 0 0
  5955/0x169339:  66135208 554550 madvise(0x103442000, 0x4D3000, 0x7)  
  = 0 0
  5955/0x169339:  66135269  31 27 stat64(/var/mail/root\0, 
 0x7FFF5DC5C618, 0x7)   = -1 Err#2
  5955/0x169339:  66135303   4  1 sigprocmask(0x1, 0x7FFF5DC5C6BC, 
 0x7FFF5DC5C6B8)  = 0x0 0
  5955/0x169339:  66135308   5  2 ioctl(0xFF, 0x4004667A, 
 0x7FFF5DC5C60C)   = 0 0
  5955/0x169339:  66135318  11  9 ioctl(0xFF, 0x80047476, 
 0x7FFF5DC5C68C)   = 0 0
  5955/0x169339:  66135320   3  0 sigprocmask(0x3, 0x7FFF5DC5C6B8, 
 0x0) = 0x0 0
  5955/0x169339:  66135322   3  0 sigaction(0x2, 0x7FFF5DC5C688, 
 0x7FFF5DC5C6B0)= 0 0
  5955/0x169339:  66135351   3  1 ioctl(0x0, 0x40087468, 
 0x7FFF5DC5C638)= 0 0
  5955/0x169339:  66135353   3  2 ioctl(0x0, 0x80087467, 
 0x7FFF5DC5C638)= 0 0
  5955/0x169339:  66135354   2  0 ioctl(0x0, 0x40487413, 
 0x7FFF5DC5C640)= 0 0
  5955/0x169339:  66135359   5  3 ioctl(0x0, 0x80487415, 
 0x7FFF5DC5C640)= 0 0
  5955/0x169339:  66135361   2  0 sigprocmask(0x1, 0x102073E14, 
 0x102073E18)= 0x0 0
  5955/0x169339:  66135362   2  0 sigaction(0x2, 0x7FFF5DC5C638, 
 0x7FFF5DC5C698)= 0 0
  5955/0x169339:  66135362   2  0 sigaction(0xF, 0x7FFF5DC5C638, 
 0x7FFF5DC5C698)= 0 0
  5955/0x169339:  66135363   2  0 sigaction(0x1, 0x7FFF5DC5C638, 
 0x7FFF5DC5C698)= 0 0
  5955/0x169339:  66135364   1  0 sigaction(0x3, 

Multiline prompt problems with long commands

2014-11-03 Thread Kamil Neczaj
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-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_FORTIFY_SOURCE=2
-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
--param=ssp-buffer-size=4
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux kneczaj-laptop 3.17.2-1-ARCH #1 SMP PREEMPT Thu Oct 30
20:49:39 CET 2014 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.3
Patch Level: 30
Release Status: release

Description:
When using multiline prompt and entering a long command, the part
which doesn't fit and should be moved to a
new line is actually move to the beginning of the same line which makes the
command unreadable.

Repeat-By:
1. Set e.g. PS1=\n\[\033[01;32m\]\u@\h\[\033[01;34m\]
\w\[\033[01;33m\]\n\n\033[01;31m\]- \[\e[0m\]
2. Type a command longer than one line.

Fix:
Expected behaviour is that the part which doesn't fit will be moved
to a new line, what happens when
the prompt is one line long.


Re: Odd bash behaviour with time:

2014-11-03 Thread Ángel González
Piotr Grzybowski wrote:
 Hi Chet, hi all.
 
  based on what you say, and some comments in parse.y ;-) isn't the
 below patch enough to get rid of the parser error for time;echo;
 case?
 
 diff --git a/parse.y b/parse.y
 index 815db98..766f258 100644
 --- a/parse.y
 +++ b/parse.y
 @@ -1224,6 +1224,8 @@ pipeline_command: pipeline
   /* XXX - let's cheat and push a newline back */
   if ($2 == '\n')
 token_to_read = '\n';
 + if ($2 == ';')
 +   token_to_read = ';';
 }
 |   BANG list_terminator
 {
 
 cheers,
 pg


There are more syntax errors equivalent to the time; case:
time 
time  bar
time | foo
time || true
...