binpash / try

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

try broken on `rm -r` #159

Closed mgree closed 1 month ago

mgree commented 1 month ago
$ ./try rm -r scripts

Changes detected in the following files:

/home/mgreenbe/try/scripts (deleted)

Commit these changes? [y/N] y
rm: cannot remove '/home/mgreenbe/try/scripts': Is a directory
try: couldn't commit /tmp/tmp.pyL54hDPYB/upperdir/home/mgreenbe/try/scripts
mgree commented 1 month ago

More generally, try is broken on other file type changes:

$ ./try "rm README.md; ln -s STYLE.MD README.md"

Changes detected in the following files:

/home/mgreenbe/try/README.md (symlink)

Commit these changes? [y/N] y
ln: failed to create symbolic link '/home/mgreenbe/try/README.md': File exists
try: couldn't commit /tmp/tmp.Rc5Lsa92kE/upperdir/home/mgreenbe/try/README.md
$ ./try "rm -r scripts; echo hi>scripts"

Changes detected in the following files:

/home/mgreenbe/try/scripts (modified)

Commit these changes? [y/N] y
$ ls scripts
lint.sh  README.md  README.md~  run_tests.sh  scripts