binpash / try

Inspect a command's effects before modifying your live system
MIT License
5.21k stars 68 forks source link

keep toplevel dir modes and symlinks #138

Closed ezrizhu closed 8 months ago

ezrizhu commented 10 months ago

In this pull request, we are ensuring the dirs and files in the / root path of the temproot is as close as the 'real' one as possible.

$SANDBOX_DIR/temproot is now being created with the same permission as the host, and every other directories are created with the same mode as the real one. Symlinks are now also created in the unshare, and removed after unshare finishes. Tests are created to check the mode, ownership, and symlink of the files in the / directory.

Known issues In the test, we're ignoring files with the name swap. And also /proc, our current mount -t proc proc /proc invocation are creating the /proc dir with nobody and nogroup ownership.

This PR currently assumes there are no other files in the root dir besides the swap.img.

Fixes #80 Fixes #139