Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11796

"su -m" (on Mac) preserves $HOME and $USER but not ~

Path csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail
From dabe@dabe.com
Newsgroups gnu.bash.bug
Subject "su -m" (on Mac) preserves $HOME and $USER but not ~
Date Thu, 29 Oct 2015 13:02:10 -0400 (EDT)
Lines 52
Approved bug-bash@gnu.org
Message-ID <mailman.1270.1446148354.7904.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1446148354 32367 208.118.235.17 (29 Oct 2015 19:52:34 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-detected-operating-system by eggs.gnu.org: OpenBSD 3.x
X-Received-From 96.255.5.253
X-Mailman-Approved-At Thu, 29 Oct 2015 15:52:33 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:11796

Show key headers only | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin13.4.0
Compiler: clang
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='darwin13.4.0' -DCONF_MACHTYPE='x86_64-apple-darwin13.4.0' -DCONF_VENDOR='apple' -DLOCALEDIR='/usr/local/Cellar/bash/4.3.42/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib -I./lib/intl -I/private/tmp/bash20150827-50056-g82kmq/bash-4.3/lib/intl  -DSSH_SOURCE_BASHRC
uname output: Darwin triton.parabon.com 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin13.4.0

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

Description:

	I'm hoping this issue has been solved before, but I couldn't
	find any answers on the 'Net...

	When I "su -m", my $HOME environment variable is preserved okay
	(i.e., it remains my original home directory) but often[*] '~'
	is set to the target (root) user's home directory.

	* - It's infuriating that /occasionally/ it DOESN'T switch to
	/var/root!

Repeat-By:

	Check out this copy-paste:

		Thu Oct 29 12:32:22 dabe@triton:~> su -m root -c "bash"
		Password:
		Thu Oct 29 12:32:26 root@triton:~# echo $HOME ... ~
		/Users/dabe ... /Users/dabe
		Thu Oct 29 12:32:27 root@triton:~# echo $HOME ... ~
		/Users/dabe ... /Users/dabe
		Thu Oct 29 12:32:28 root@triton:~# echo $HOME ... ~
		/Users/dabe ... /Users/dabe
		Thu Oct 29 12:32:28 root@triton:~# echo $HOME ... ~
		/Users/dabe ... /var/root
		Thu Oct 29 12:32:28 root@triton:~# echo $HOME ... ~
		/Users/dabe ... /var/root

	Notice how my $HOME stays the same (good) but my ~ changes
	to /var/root -- and it changes AFTER I've been logged in for
	a little while!  <scratching head>

	Except for my $TTY and $PPID (and the date in $PS1, as well as
	the $ITERM_SESSION_ID), 'set' shows all my environment / shell
	variables to be identical, before and after.

	It's worth pointing out that 'su -m root -c "bash -l"' works
	fine, near as I can tell...

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

"su -m" (on Mac) preserves $HOME and $USER but not ~ dabe@dabe.com - 2015-10-29 13:02 -0400

csiph-web