Make sure that the web server does NOT have write permissions on "testperms.txt" (either chmod a-w or change the owner to root:root)
Enable encryption
Login as "admin"
Expected result
Write lock can be acquired when overwriting "testperms.txt"
Actual result
Write lock cannot be acquired because the file is read-only.
The problem happens in the rename() code, where the target file is attempted to be locked with a write lock. Even though we'd overwrite the file anyway, it fails.
The idea would be to adapt the code to find out whether we are in an "overwrite" situation. If yes, then delete + recreate the target file when acquiring the write lock.
Steps to reproduce:
touch data/files/admin/testperms.txt
chmod a-w
or change the owner to root:root)Expected result
Write lock can be acquired when overwriting "testperms.txt"
Actual result
Write lock cannot be acquired because the file is read-only.
The problem happens in the
rename()
code, where the target file is attempted to be locked with a write lock. Even though we'd overwrite the file anyway, it fails.The idea would be to adapt the code to find out whether we are in an "overwrite" situation. If yes, then delete + recreate the target file when acquiring the write lock.
@icewind1991 @DeepDiver1975