Skip to content

cmd/create, cmd/run, cmd/utils: Unbreak overriding the HOME variable - #1667

Merged
debarshiray merged 1 commit into
containers:mainfrom
debarshiray:wip/rishi/issues-1564
Jun 26, 2025
Merged

debarshiray merged 1 commit into
containers:mainfrom
debarshiray:wip/rishi/issues-1564

Conversation

@debarshiray

Copy link
Copy Markdown
Member

The POSIX shell implementation used to read and respect the HOME environment variable. It broke when the Go implementation started using user.Current() [1], because it uses getpwuid_r(3), which only uses the GNU Name Service Switch's (or NSS') password database and ignores HOME.

This created a strange situation where the toolbox(1) binary ignored the HOME environment variable, while the profile.d/toolbox.sh shell start-up snippet and Podman read and respected it.

Restoring the HOME environment variable will enable users to create Toolbx containers with different home directories from the host for increased isolation, and to isolate the host's HOME from the system tests.

Fallout from e8d7f25

[1] https://pkg.go.dev/os/user#Current

#1044
#1564

The POSIX shell implementation used to read and respect the HOME
environment variable.  It broke when the Go implementation started using
user.Current() [1], because it uses getpwuid_r(3), which only uses the
GNU Name Service Switch's (or NSS') password database and ignores HOME.

This created a strange situation where the toolbox(1) binary ignored the
HOME environment variable, while the profile.d/toolbox.sh shell start-up
snippet and Podman read and respected it.

Restoring the HOME environment variable will enable users to create
Toolbx containers with different home directories from the host for
increased isolation, and to isolate the host's HOME from the system
tests.

Fallout from e8d7f25

[1] https://pkg.go.dev/os/user#Current

containers#1044
containers#1564
@debarshiray
debarshiray merged commit 3bf9fdd into containers:main Jun 26, 2025
@debarshiray
debarshiray deleted the wip/rishi/issues-1564 branch June 26, 2025 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant