Wind River Support Network

HomeDefectsLIN7-3343
Fixed

LIN7-3343 : CLONE - Running su <user> -l -c 'echo Success' does not execute users login script

Created: Apr 1, 2015    Updated: Sep 8, 2018
Resolved Date: Apr 29, 2015
Found In Version: 7.0
Fix Version: 7.0.0.6
Severity: Standard
Applicable for: Wind River Linux 7
Component/s: Userspace

Description

Running commands with "su -l" does not cause the shell to run the login scripts (.profile or .bash_profile).

Tested with both /bin/sh and /bin/bash as the user shell (in /etc/passwd).

Steps to Reproduce

$configure --enable-board=intel-x86-64 --enable-rootfs=glibc_std --enable-kernel=standard
$ make -C build bash.patch

Apply patch for LIN6-9533 to ensure bash runs login scripts.

$ make -C build bash
$ make fs
$ make start-target

Log in as root

# echo "echo profile" > .profile
# echo "echo bash_profile" > .bash_profile
# echo "echo bashrc" > .bashrc

Test normal login (log out first) and ".profile" is displayed when logging in as expected. Use "chsh" to change the user shell to "/bin/bash" and re-test logging in and you get ".bash_profile" displayed as expected. Run bash as non-login and "bashrc" is displayed as expected.

Now test su:

# su root -l bash -c "echo success"
success
#

Note that neither bash_profile nor profile is displayed as would be expected (depending on user's shell).

Running the test case for LIN6-9533 does work though:

# exec -l bash -c "echo success; sleep 100"
bash_profile
success
#

Other Downloads


Live chat
Online