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

-d option has unexpected (and potentially dangerous) behavior #43

Open
afontenot opened this issue Apr 19, 2023 · 0 comments
Open

-d option has unexpected (and potentially dangerous) behavior #43

afontenot opened this issue Apr 19, 2023 · 0 comments

Comments

@afontenot
Copy link

  1. Make a temporary directory and cd into it.

  2. sudo alpine-chroot-install -d alpine

Observe that the chroot is not placed in alpine, but it alpine/alpine.

  1. Destroy the chroot with ./alpine/alpine/destroy --remove.

[Here is where I made an error in reasoning - assuming that alpine-chroot-install always creates a new directory called alpine below whatever is specified in -d.]

  1. sudo alpine-chroot-install -d .

Observe that the chroot is placed in the current directory!

  1. In frustration, hit the up key twice (in most terminals) to go back to ./alpine/alpine/destroy --remove.

alpine-chroot-install blows away the (hopefully empty!) temporary directory you created in step 1.

In fact I lost data because of this. It was a stupid error on my part, I guess, to not realize that the destroy command would also destroy the non-empty directory I created the chroot in (step 4). But there's clearly some weird behavior happening here that should probably be fixed.

  1. The program should always (?) use the specified directory to create the chroot, and not sometimes (?) create a secondary subdirectory named alpine. (Yes, I checked that ./alpine did not already exist in step 2.)

  2. The program should loudly warn or better yet fail when asked to create a chroot in a non-empty directory, given that it expects to be able to take over the directory completely.

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

No branches or pull requests

1 participant