alpine-chroot-install
alpine-chroot-install copied to clipboard
`-d` option has unexpected (and potentially dangerous) behavior
-
Make a temporary directory and
cd
into it. -
sudo alpine-chroot-install -d alpine
Observe that the chroot is not placed in alpine
, but it alpine/alpine
.
- 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
.]
- sudo alpine-chroot-install -d .
Observe that the chroot is placed in the current directory!
- 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.
-
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.) -
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.