Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd: Jump to /run/host/$PWD when entering toolbox #1205

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

halfline
Copy link

@halfline halfline commented Dec 19, 2022

As a convenience to users, when entering a container toolbx tries to maintain the working directory from the host. This works great if the user is inside their home directory, for instance, since the home directory is shared between host and container.

It can be confusing in other cases, though. The issue is that the directory in the container may have the same path as the directory in the host, but have completely different contents. The old contents may actually be in /run/host/$PWD instead.

Switching to /run/host/$PWD unconditionally has its own downsides. For one, it's ugly, and also, in common cases, like subdirectories of the home directory, it's unnecessary.

This commit tries to find the balance, by making toolbx check first if the directory is shared between host and container, and if not, only then falling back to trying /run/host/$PWD.

Closes #988

@softwarefactory-project-zuul
Copy link

Build failed.

✔️ unit-test SUCCESS in 8m 55s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 2m 58s
system-test-fedora-rawhide FAILURE in 25m 03s
system-test-fedora-36 FAILURE in 13m 34s
system-test-fedora-35 FAILURE in 14m 12s

As a convenience to users, when entering a container
toolbx tries to maintain the working directory from
the host. This works great if the user is inside
their home directory, for instance, since the
home directory is shared between host and container.

It can be confusing in other cases, though. The issue
is that the directory in the container may have the
same path as the directory in the host, but have
completely different contents. The old contents may
actually be in /run/host/$PWD instead.

Switching to /run/host/$PWD unconditionally has its own
downsides. For one, it's ugly, and also, in common cases,
like subdirectories of the home directory, it's
unnecessary.

This commit tries to find the balance, by making toolbx
check first if the directory is shared between host and
container, and if not, only then falling back to trying
/run/host/$PWD.

Closes containers#988
@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/containers/toolbox for 1205,c39f684affb2335f27f3fb5cf633266c6f75fc0e

@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 8m 35s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 22s
✔️ system-test-fedora-rawhide SUCCESS in 26m 56s
✔️ system-test-fedora-36 SUCCESS in 12m 17s
✔️ system-test-fedora-35 SUCCESS in 14m 00s

@softwarefactory-project-zuul
Copy link

Build succeeded.

✔️ unit-test SUCCESS in 8m 35s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 2m 57s
✔️ system-test-fedora-rawhide SUCCESS in 25m 00s
✔️ system-test-fedora-36 SUCCESS in 12m 29s
✔️ system-test-fedora-35 SUCCESS in 13m 40s

@softwarefactory-project-zuul
Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/containers/toolbox for 1205,c39f684affb2335f27f3fb5cf633266c6f75fc0e

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.

Don't preserve current working directory unless it's a bind mount from the host
1 participant