Bug#671940: interactive dash does not work in some xen environments

2012-05-10 Thread Terho Uotila
On Wed, 9 May 2012 16:06:26 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Ok, more debugging suggestions:
 
   set

This. :D

...
MKSH=/bin/mksh
OPTIND=1
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PGRP=25718
PPID=25702
$(precmd)${USER:=$(ulimit -c 0;id -un 2-||print \?)}@${HOSTNAME%%.*}:$(
typeset d=${PWD:-?} n p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~}
(( (${%d}0 ? ${%d}: ${#d})  (n = (COLUMNS/37 ? 7: COLUMNS/3)) ))  {
d=${d:(-n)}; p=...; } || p=; print -nr -- $p$d) $ '
PS2=' '
...

comes from (default) /etc/mkshrc

PS1='^A^M$(precmd)${USER:=$(ulimit -c 0;id -un 2-||print 
\?)}@${HOSTNAME%%.*}:$(
typeset d=${PWD:-?} n p=~; [[ $p = ?(*/) ]] || d=${d/#$p/~}
(( (${%d}0 ? ${%d}: ${#d})  (n = (COLUMNS/37 ? 7: COLUMNS/3)) ))  {
d=${d:(-n)}; p=...; } || p=; print -nr -- $p$d) '$PS1 

(I wonder if ^A^M at the start is intentional.) I can honestly say that 
I have no idea what this is supposed to do.

I guess my quotaon/off testing yesterday was using accidentally wrong 
terminal, or with bash in between, or something else stupid. Similarly 
I could have sworn that I tested dash before even installing mksh, but 
obviously that must be wrong too.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#671940: interactive dash does not work in some xen environments

2012-05-09 Thread Terho Uotila
On Wed, 9 May 2012 05:15:16 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Terho Uotila wrote:
  Jonathan Nieder jrnie...@gmail.com wrote:
 
  I guess output from strace -f -e open dash might help.  Anyway,
  I'm closing this since all signs point to the bug being about some
  form of misconfiguration, though I'll be happy to continue helping
  to track it down in the hope that there might be a bug lurking
  somewhere.
 
  137|tuotila@vicente:~ $ head dash.strace.err 
  open(/etc/ld.so.cache, O_RDONLY)  = 3
  open(/lib/libc.so.6, O_RDONLY)= 3
  open(/dev/tty, O_RDWR)= 3
  dash: Syntax error: ( unexpected (expecting ))
  dash: Syntax error: ( unexpected (expecting ))
 
 This still makes no sense.  Memory corruption somewhere? :/
 Maybe strace -f -e read dash will get closer to the heart of it.
 
tuotila@vicente:~ $ strace -f -e read dash 2 dash.strace.read 
137|tuotila@vicente:~ $ head dash.strace.read 
read(3, 
\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\0\1\0\0\0\240\355\1\0\0\0\0\0..., 832) = 
832 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))





-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#671940: interactive dash does not work in some xen environments

2012-05-09 Thread Terho Uotila
On Wed, 9 May 2012 05:22:53 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Jonathan Nieder wrote:
  This still makes no sense.  Memory corruption somewhere? :/
 
 dash has no internal notion of a typeset command, so when we see
 
 | token word typeset
 
 that has to be coming from somewhere.  The only way that makes
 sense to me is if /dev/tty is pointing to some random script. :)
 
 ls -l /dev/tty might help disprove this guess.

137|tuotila@vicente:~ $ ls -l /dev/tty 
crw-rw-rw- 1 root root 5, 0 Apr 28 22:10 /dev/tty


Also, version from Wheezy (0.5.7-3) still gives same error.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#671940: interactive dash does not work in some xen environments

2012-05-09 Thread Terho Uotila
I looked some more and it looks possible that I do have misconfigured
quota, like you suspected. However, why does only dash blow up?

Hopefully problem disappears once I get around to fixing quota, until then 
I can manage well with quota off (unless you want to poke at this more. :)

On Wed, 9 May 2012 06:24:22 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Alas.  Does the full output from strace -f dash clarify anything?
 
tuotila@vicente:~ $ head -70 dash.strace

   
execve(/bin/dash, [dash], [/* 19 vars */]) = 0
brk(0)  = 0x637000
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fa07d138000
access(/etc/ld.so.preload, R_OK)  = -1 ENOENT (No such file or directory)
open(/etc/ld.so.cache, O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=15071, ...}) = 0
mmap(NULL, 15071, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa07d134000
close(3)= 0
access(/etc/ld.so.nohwcap, F_OK)  = -1 ENOENT (No such file or directory)
open(/lib/libc.so.6, O_RDONLY)= 3
read(3, 
\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\0\1\0\0\0\240\355\1\0\0\0\0\0..., 832) = 
832
fstat(3, {st_mode=S_IFREG|0755, st_size=1437064, ...}) = 0
mmap(NULL, 3545160, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7fa07cbbb000
mprotect(0x7fa07cd14000, 2093056, PROT_NONE) = 0
mmap(0x7fa07cf13000, 20480, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x158000) = 0x7fa07cf13000
mmap(0x7fa07cf18000, 18504, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fa07cf18000
close(3)= 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fa07d133000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fa07d132000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fa07d131000
arch_prctl(ARCH_SET_FS, 0x7fa07d132700) = 0
mprotect(0x7fa07cf13000, 16384, PROT_READ) = 0
mprotect(0x7fa07d13a000, 4096, PROT_READ) = 0
munmap(0x7fa07d134000, 15071)   = 0
getpid()= 20389
rt_sigaction(SIGCHLD, {0x40f270, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
geteuid()   = 1001
brk(0)  = 0x637000
brk(0x658000)   = 0x658000
getppid()   = 20388
getcwd(/home/tuotila, 4096)   = 14
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x40f270, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
open(/dev/tty, O_RDWR)= 3
fcntl(3, F_DUPFD, 10)   = 10
close(3)= 0
fcntl(10, F_SETFD, FD_CLOEXEC)  = 0
ioctl(10, TIOCGPGRP, [20388])   = 0
getpgrp()   = 20388
rt_sigaction(SIGTSTP, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
rt_sigaction(SIGTTOU, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
rt_sigaction(SIGTTIN, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fa07cbed230}, 
NULL, 8) = 0
setpgid(0, 20389)   = 0
ioctl(10, TIOCSPGRP, [20389])   = 0
wait4(-1, 0x7fff6bc6708c, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child 
processes)
stat(/var/mail/tuotila, {st_mode=S_IFREG|0600, st_size=1654678, ...}) = 0
write(2, dash: 2: , 9dash: 2: )= 9
write(2, Syntax error: \(\ unexpected (ex..., 44Syntax error: ( 
unexpected (expecting ))) = 44
write(2, \n, 1
)   = 1
wait4(-1, 0x7fff6bc6708c, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child 
processes)
stat(/var/mail/tuotila, {st_mode=S_IFREG|0600, st_size=1654678, ...}) = 0
write(2, dash: 2: , 9dash: 2: )= 9
write(2, Syntax error: \(\ unexpected (ex..., 44Syntax error: ( 
unexpected (expecting ))) = 44
write(2, \n, 1
)   = 1
wait4(-1, 0x7fff6bc6708c, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child 
processes)
stat(/var/mail/tuotila, {st_mode=S_IFREG|0600, st_size=1654678, ...}) = 0
write(2, dash: 2: , 9dash: 2: )= 9
write(2, 

Bug#671940: interactive dash does not work in some xen environments

2012-05-09 Thread Terho Uotila
On Wed, 9 May 2012 12:53:54 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 I forgot to ask for output from
 
   type dash
   ldd $(which dash)

tuotila@vicente:~ $ type dash
dash is /bin/dash
tuotila@vicente:~ $ ldd $(which dash)
linux-vdso.so.1 =  (0x7fff2afff000)
libc.so.6 = /lib/libc.so.6 (0x7fa4b11f9000)
/lib64/ld-linux-x86-64.so.2 (0x7fa4b1561000)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#671940: interactive dash does not work in some xen environments

2012-05-08 Thread Terho Uotila
Package: dash
Version: 0.5.5.1-7.4

Trying to start dash as interactive shell starts looping error messages
until killed, in some xen vps machines. (Unfortunately I don't know why
some have this error and others do not.)

$ dash
dash: Syntax error: ( unexpected (expecting ))
(repeat)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#671940: interactive dash does not work in some xen environments

2012-05-08 Thread Terho Uotila
On Tue, 8 May 2012 12:40:30 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Terho Uotila wrote:
 
  Trying to start dash as interactive shell starts looping error
  messages until killed, in some xen vps machines. (Unfortunately I
  don't know why some have this error and others do not.)
 

Correction to my original report, this is not only xen, I have affected
openvz vps too.

 Do you mean that you pass no input to dash but it sees a ( anyway?
 Is this reproducible?
 
Trying to start dash as interactive shell will consistently produce this
problem on affected vps. Originally I noticed this when trying to use
dash as login shell, but for testing/demonstration purposes I prefer to
start it from command line since recovery is easier.

 Some useful ways to get logs would be
 
 1. dash -x
 

tuotila@vicente:~ $ dash -x 2 dash.err

root@vicente:~# killall -9 dash
(No root needed, but that's what I had open in another terminal.)

137|tuotila@vicente:~ $ head dash.err 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting )) 
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))
dash: Syntax error: ( unexpected (expecting ))


 2. after
 
This is my first try at this so let me know if this can be improved,
though this is low end vps so space and memory are somewhat limited.

2a.
   src/dash -o debug

(Gives familiar loop, too)

   cat ./trace

 $ head -160 ./trace  (head only since this is _long_, over million
 lines, and at a glance just seems to repeat after start.)
  
Tracing started.
cmdloop(1) called
showjobs(8) called
dowait(0) called
wait returns pid -1, status=0
token word precmd
pipeline: entered
reread token word precmd
reread token word precmd
reread token word precmd
token ) 
reread token ) 
reread token ) 
reread token ) 
reread token ) 
token word ulimit
pipeline: entered
reread token word ulimit
reread token word ulimit
reread token word ulimit
token word -c
token word 0
token ; 
reread token ; 
reread token ; 
reread token ; 
token word id
reread token word id
pipeline: entered
reread token word id
reread token word id
reread token word id
token word -un
token redirection 
token word -
Fix redir - 0
token || 
reread token || 
reread token || 
pipeline: entered
token word print
reread token word print
reread token word print
token word �?
token ) 
reread token ) 
reread token ) 
reread token ) 
reread token ) 
token word typeset
pipeline: entered
reread token word typeset
reread token word typeset
reread token word typeset
token word d=�PWD=?�
token word n
token word p=~
token ; 
reread token ; 
reread token ; 
reread token ; 
token word [[
reread token word [[
pipeline: entered
reread token word [[
reread token word [[
reread token word [[
token word �p=
token word =
token word ?
token ( 
reread token ( 
reread token ( 
reread token ( 
reread token ( 
exverror(1, Syntax error: ( unexpected (expecting ))) pid=24231
cmdloop(1) called
showjobs(8) called
dowait(0) called
wait returns pid -1, status=0
token word precmd
pipeline: entered
reread token word precmd
reread token word precmd
reread token word precmd
token ) 
reread token ) 
reread token ) 
reread token ) 
reread token ) 
token word ulimit
pipeline: entered
reread token word ulimit
reread token word ulimit
reread token word ulimit
token word -c
token word 0
token ; 
reread token ; 
reread token ; 
reread token ; 
token word id
reread token word id
pipeline: entered
reread token word id
reread token word id
reread token word id
token word -un
token redirection 
token word -
Fix redir - 0
token || 
reread token || 
reread token || 
pipeline: entered
token word print
reread token word print
reread token word print
token word �?
token ) 
reread token ) 
reread token ) 
reread token ) 
reread token ) 
token word typeset
pipeline: entered
reread token word typeset
reread token word typeset
reread token word typeset
token word d=�PWD=?�
token word n
token word p=~
token ; 
reread token ; 
reread token ; 
reread token ; 
token word [[
reread token word [[
pipeline: entered
reread token word [[
reread token word [[
reread token word [[
token word �p=
token word =
token word ?
token ( 
reread token ( 
reread token ( 
reread token ( 
reread token ( 
exverror(1, Syntax error: ( unexpected (expecting ))) pid=24231
cmdloop(1) called
showjobs(8) called
dowait(0) called
wait returns pid -1, status=0
token word precmd
pipeline: entered
reread token word precmd
reread token word precmd



 2b.
   src/dash
   (in another terminal)
   ps ax | grep dash
   gdb -p pid of dash
   bt

tuotila@vicente:~ $ gdb -p 24240 
GNU

Bug#671940: interactive dash does not work in some xen environments

2012-05-08 Thread Terho Uotila
(resending with @bugs included this time)

On Tue, 8 May 2012 18:16:25 -0500
Jonathan Nieder jrnie...@gmail.com wrote:

 Terho Uotila wrote:
 
  Correction to my original report, this is not only xen, I have
  affected openvz vps too.
 
 Ah, sorry for the false start.  Could you attach your /etc/profile and
 ~/.profile?
 

/etc/profile

# /etc/profile: system-wide .profile file for the Bourne shell sh(1)
# and Bourne compatible shells bash(1), ksh(1), ash(1), 

if [ `id -u` -eq 0 ]; then
  PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
else
  PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
fi
export PATH

if [ $PS1 ]; then
  if [ $BASH ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
  . /etc/bash.bashrc
fi
  else
if [ `id -u` -eq 0 ]; then
  PS1='# '
else
  PS1='$ '
fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
  . $i
fi
  done
  unset i
fi


~/.profile

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n $BASH_VERSION ]; then
# include .bashrc if it exists
if [ -f $HOME/.bashrc ]; then
. $HOME/.bashrc
fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d $HOME/bin ] ; then
PATH=$HOME/bin:$PATH
fi

(and should you wonder, /etc/profile.d/ is empty)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org