Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. isWritable() for NFS directory
Forum Update on Monday, May 27th 2025

isWritable() for NFS directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 338 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    micdnj
    wrote on last edited by
    #1

    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()))
    
    JonBJ 1 Reply Last reply
    0
    • M micdnj

      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()))
      
      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @micdnj
      Check out what Python calls like os.access() and os.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 not Video, else you wouldn't have posted this, right?!

      What does ls -ld /mnt/DS/Wideo look like?

      1 Reply Last reply
      2
      • M Offline
        M Offline
        micdnj
        wrote on last edited by
        #3

        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) and Wideo/ 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, and The.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, command

        test -w The.Chorus.mkv; echo "$?"
        

        and also

        res = os.system('test -w /mnt/DS/Wideo/The.Chorus.mkv')
        

        show, that I have write permission.
        But

        test -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.

        1 Reply Last reply
        0
        • Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved