Openmoko Bug #1622: bash -c crashes without $PWD

Openmoko Public Trac bugs at docs.openmoko.org
Wed Aug 13 03:04:28 CEST 2008


#1622: bash -c crashes without $PWD
-----------------------------------------------------------+----------------
 Reporter:  hah                                            |        Owner:  openmoko-kernel
     Type:  defect                                         |       Status:  new            
 Priority:  normal                                         |    Milestone:                 
Component:  System Software                                |      Version:                 
 Severity:  normal                                         |   Resolution:                 
 Keywords:  bash segfault crash PWD ssh scp default shell  |     Blocking:                 
Blockedby:                                                 |  
-----------------------------------------------------------+----------------

Comment(by hah):

 '''Quick-fix script "/bin/bash-fixed", version 2:'''
 {{{
 #!/bin/sh
 export PWD
 if tty | grep -q '/dev/pts/'; then
   exec /bin/bash --login "$@"
 else
   exec /bin/bash "$@"
 fi
 }}}
 Previous version of the script did not start a proper login-shell.
 Probably because argument zero is not passed to /bin/bash. From {{{man
 bash}}}:
 {{{
 A login shell is one whose first character of argument
 zero is a -, or one started with the --login option.
 }}}

 With the old script, PATH was not exported, causing opkg to segfault:
 {{{
 # opkg upgrade
 Segmentation fault
 }}}

-- 
Ticket URL: <https://docs.openmoko.org/trac/ticket/1622#comment:2>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac


More information about the buglog mailing list