You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a file is a hard link, removePathForcibly will modify the permissions of files outside the directory being deleted:
joey@darkstar:~/tmp>mkdir test
joey@darkstar:~/tmp>cd test
joey@darkstar:~/tmp/test>l
joey@darkstar:~/tmp/test>mkdir foo
joey@darkstar:~/tmp/test>mkdir bar
joey@darkstar:~/tmp/test>echo hi > bar/f
joey@darkstar:~/tmp/test>chmod 400 bar/f
joey@darkstar:~/tmp/test>ln bar/f foo/f
joey@darkstar:~/tmp/test>ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/joey/.etc/.ghci
ghci> import System.Directory
ghci> removePathForcibly "foo"
ghci>
Leaving GHCi.
joey@darkstar:~/tmp/test>ls -l bar
total 4
-rwx------ 1 joey joey 3 May 2 13:34 f*
I doubt that changing the permissions of a file is ever necessary to let it be deleted.
If it only changed the permissions of directories, which can be necessary, it would avoid this problem.
The text was updated successfully, but these errors were encountered:
The haddock does actually warn about this, but in my experience this is easy to miss.
-- Unlike other removal functions, this function will also attempt to delete
-- files marked as read-only or otherwise made unremovable due to permissions.
-- As a result, if the removal is incomplete, the permissions or attributes on
-- the remaining files may be altered. If there are hard links in the
-- directory, then permissions on all related hard links may be altered.
When a file is a hard link, removePathForcibly will modify the permissions of files outside the directory being deleted:
I doubt that changing the permissions of a file is ever necessary to let it be deleted.
If it only changed the permissions of directories, which can be necessary, it would avoid this problem.
The text was updated successfully, but these errors were encountered: