isWritable() for NFS directory
-
Hi,
I'm using code below. /mnt/DS/ is mounted to remote resource with NFS ver. 3. I can create new files from command line in this directory. Everyone has rights to modify it. But isWriteble() returns False. Is it expected behavior? I have an app, which is unusable due to this.
I'm using Arch Linux with Qt 5.15 and connecting to Synology NAS.from PyQt5.QtCore import QFileInfo info = QFileInfo("/mnt/DS/Wideo") print('isWritable: ' + str(info.isWritable()))
-
Hi,
I'm using code below. /mnt/DS/ is mounted to remote resource with NFS ver. 3. I can create new files from command line in this directory. Everyone has rights to modify it. But isWriteble() returns False. Is it expected behavior? I have an app, which is unusable due to this.
I'm using Arch Linux with Qt 5.15 and connecting to Synology NAS.from PyQt5.QtCore import QFileInfo info = QFileInfo("/mnt/DS/Wideo") print('isWritable: ' + str(info.isWritable()))
@micdnj
Check out what Python calls likeos.access()
andos.stat()
have to say?Check what
QFile::Permissions QFileInfo::permissions() const
has to say?Check what
QFileInfo("/mnt/DS/Wideo/somefileyouhavethere")
has to say?Verify you really can create
/mnt/DS/Wideo/newfile
from Qt, just to be sure./mnt/DS/Wideo
Your directory really is
Wideo
and notVideo
, else you wouldn't have posted this, right?!What does
ls -ld /mnt/DS/Wideo
look like? -
First findings.
Current state
Directory:$ ls -ld ../Wideo/ drwxrwxrwx 39 1026 100 4096 22 sty 14:53 ../Wideo/
With files:
.rwxrwxrwx 4 michal 22 sty 15:14 t.txt .rwxrwxrwx 0 michal 22 sty 01:06 test.txt .rwxrwxrwx 4,7G 1030 21 sty 23:28 The.Chorus.mkv
What is worth noting, that owner of
The.Chorus.mkv
(id=1030) andWideo/
doesn't exists in local linux instalation, that's why user name isn't printed.Python
Results are given in comments.print(os.access("/mnt/DS/Wideo", os.W_OK)) #False print(os.access("/mnt/DS/Wideo", os.R_OK)) #True with open("/mnt/DS/Wideo/t.txt", 'w') as f: #File created f.write('test') print(os.access("/mnt/DS/Wideo/t.txt", os.W_OK)) #True print(os.access("/mnt/DS/Wideo/test.txt", os.W_OK)) #True print(os.access("The.Chorus.mkv", os.W_OK)) #False with open("The.Chorus.mkv", 'w') as f: #File opened to writing print('opened')
So,
/mnt/DS/Wideo
, andThe.Chorus.mkv
aren't(based on os.access()) writable, but I can create file in directory, and open file for changes.System
on system level, commandtest -w The.Chorus.mkv; echo "$?"
and also
res = os.system('test -w /mnt/DS/Wideo/The.Chorus.mkv')
show, that I have write permission.
Buttest -w ../Wideo/; echo "$?"
shows no rights to write.
Your directory really is Wideo and not Video, else you wouldn't have posted this, right?!
Yes :) It's in polish.
Let me know if it's still necessary to make checks you've mentioned but I haven't done. -
your problem is the uid mapping and/or mount options. that's why you can create files and edit files you create but otherwise cannot manage the directory. read the RFCs on NFS to determine the behaviour.