[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash doesn't run as a login when when -c specified

From: Todd . Miller
Subject: bash doesn't run as a login when when -c specified
Date: Mon, 27 Jun 2011 11:28:53 -0400 (EDT)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: openbsd4.9
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='openbsd4.9' -DCONF_MACHTYPE='x86_64-unknown-openbsd4.9' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' 
-DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -I/usr/local/include 
-O2 -pipe
uname output: OpenBSD xerxes.home.courtesan.com 4.9 GENERIC#0 amd64
Machine Type: x86_64-unknown-openbsd4.9

Bash Version: 4.2
Patch Level: 10
Release Status: release

        Newer versions of bash appear to ignore the '-' in argv[0]
        when the "-c" option is specified.  That is, for:
            char *argv[] = { "-bash", "-c", "id", NULL };
        bash used to run as a login shell and source .bash_profile.
        I've verified that bash 3.00.15 behaves as expected but
        bash 3.2 and 4.2 require that the "-l" option be specified
        even though argv[0] indicates that it should be a login
        shell.  Is this change in historical behavior intentional?
        All other Borne-type shells I've tried have the historical

        echo 'echo testing' >> ~/.bash_profile
        perl -e '$shell="/usr/local/bin/bash"; exec $shell  "-bash", "-c", "id"'
        perl -e '$shell="/usr/local/bin/bash"; exec $shell  "-bash", "-lc", 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]