Closed timur-g closed 1 year ago
Wiki tells that Cud can save modified files even to folders w/o permissions. https://wiki.freepascal.org/CudaText#Can_app_save_files_to_system_directories.3F For example, open some file from write-protected folder on Unix/Linux. CudaText detects file permissions, so it should open file in read-only mode. Then, from "Command Palette", call "toggle read-only mode". Then you can edit the file. Edit it and save it - CudaText will try to save it via "pkexec".
That does not fully work, tested in Mint 21 which is Ubuntu 22.04.. For files that have no permission for user to read, I see Cannot open file- permisison denied. If there is read permission I can open the file and write, but I cannot save: EWriteError, Cannot save file: I do not see how "toggle read-only mode" helps, seems like the opposite of what I wanted, does not seem to help to write file when user should submit superuser credentials. DoubleCmd approach seems OK to me.
do you have program '/bin/cp' and '/usr/bin/pkexec'? if not, run
which pkexec
what does it show?
i made a test. copied my file fold-issue.json to /usr/src/ and removed 'w' permissions from it. i got OK result in Cud. it can edit file and save it:
For files that have no permission for user to read, I see Cannot open file- permisison denied.
yes, in this case Cud don't work.
If there is read permission I can open the file and write, but I cannot save: EWriteError, Cannot save file:
what is full file path? what ls -l
does show for file?
I see /bin/cp' and 'which pkexec' gives: /usr/bin/pkexec File I tested is: -rw-r--r-- 1 root root 0 How to get that dialog, is it some plugin?
How to get that dialog, is it some plugin?
it is build-in dialog of 'pkexec' (which is run by Cud when saving file).
i cannot repeat the problem with -rw-r--r-- 1 root root 0
.
what is full file path? what is ls -l
of parent dir?
I confirm what you wrote and got that dialog in other folder with the same permissions 644 but other parent permission.
Imagine that 1st time I tried I got this error :) Here is this folder, it is somewhat artificial as I just wanted to test, but still possible. drwxrwxr-x 4 user user 4,0K Jul 27 15:39 . drwxr-x--- 57 user user 4,0K Jul 27 15:51 .. -rw-r--r-- 1 root root 11 Jul 27 14:47 root.txt
With that save dialog, could you convert this issue to get the same dialog on fileopen, if there are no sufficient permisisons for that?
drwxr-x--- 57 user user 4,0K Jul 27 15:51 ..
-rw-r--r-- 1 root root 11 Jul 27 14:47 root.txt
with this, I got the error EWriteError: cannot save file
. will study this case.
i made a fix! let's test 1 of 2 binaries: linux x64 gtk2 / qt5.
Yes, working now, thanks. One issue per ticket and this one may be closed. But please comment if I should open the new one for the same dialog on fileopen, if there are no sufficient permisisons.
issue for missing R permission? yes, open a new issue for that. I cannot solve it so easy, so it will stay for some time.
Not sure if this is possible in some way, coud not find. If a user has no permisison, it would be handy if file could be open, edited and saved in superuser mode. I have 2 examples: Notepad++ has plugin NppSaveAsAdmin (obviously in Windows), DoubleCommander (wonderful file manager, from another Alex) has Admin rights in Windows and Linux ("you need to provide admin permission to create/delete this object").