Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator creates file without permissions
Forum Updated to NodeBB v4.3 + New Features

Qt Creator creates file without permissions

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
10 Posts 3 Posters 1.2k 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.
  • N Offline
    N Offline
    nroos
    wrote on last edited by
    #1

    Hello,

    My freshly installed qtcreator produces a lot of error messages on startup and exit, about not having permission to access the configuration files.

    Indeed the files all have permissions "---------", so no access allowed at all.

    System is a Kubuntu 22.04, which was upgraded from older versions. The version of Qt Creator from the distribution is 6.0.2, but i also tried the latest release 11.0.0-1 with the same result.

    In a VM with a freshly installed Kubuntu 22.04 this error does not happen.

    With strace i saw that a temporary file is created (only in RAM), a link to this file is generated and this file is opened for writing, which fails. Creation of the temporary file is done with all permissions set to 0:

    [pid 4018] open("/home/user/.config/QtProject/qtcreator", O_RDWR|O_CLOEXEC|O_TMPFILE, 000) = 43
    [pid 4018] linkat(AT_FDCWD, "/proc/self/fd/43", AT_FDCWD, "/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", AT_SYMLINK_FOLLOW) = 0
    [pid 4018] open("/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)

    See the '000' in the first line.

    In the VM, the first open() is done with permissions '0600'.

    Does anybody have any idea why on my regular system the temporary file is created without permissions, while in the VM the file is user-read/writable?

    C 1 Reply Last reply
    0
    • N nroos

      Hello,

      My freshly installed qtcreator produces a lot of error messages on startup and exit, about not having permission to access the configuration files.

      Indeed the files all have permissions "---------", so no access allowed at all.

      System is a Kubuntu 22.04, which was upgraded from older versions. The version of Qt Creator from the distribution is 6.0.2, but i also tried the latest release 11.0.0-1 with the same result.

      In a VM with a freshly installed Kubuntu 22.04 this error does not happen.

      With strace i saw that a temporary file is created (only in RAM), a link to this file is generated and this file is opened for writing, which fails. Creation of the temporary file is done with all permissions set to 0:

      [pid 4018] open("/home/user/.config/QtProject/qtcreator", O_RDWR|O_CLOEXEC|O_TMPFILE, 000) = 43
      [pid 4018] linkat(AT_FDCWD, "/proc/self/fd/43", AT_FDCWD, "/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", AT_SYMLINK_FOLLOW) = 0
      [pid 4018] open("/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)

      See the '000' in the first line.

      In the VM, the first open() is done with permissions '0600'.

      Does anybody have any idea why on my regular system the temporary file is created without permissions, while in the VM the file is user-read/writable?

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      @nroos An incorrect umask in the user's environment can create files without permission flags

      /tmp$ umask  # default umask is?
      0002
      /tmp$ touch tt1
      /tmp$ umask 777 # bad umask set
      /tmp$ touch tt2
      /tmp$ ls -l tt?
      -rw-rw-r-- 1 chrisw chrisw 0 Jul 27 12:07 tt1
      ---------- 1 chrisw chrisw 0 Jul 27 12:07 tt2
      
      JonBJ N 2 Replies Last reply
      1
      • C ChrisW67

        @nroos An incorrect umask in the user's environment can create files without permission flags

        /tmp$ umask  # default umask is?
        0002
        /tmp$ touch tt1
        /tmp$ umask 777 # bad umask set
        /tmp$ touch tt2
        /tmp$ ls -l tt?
        -rw-rw-r-- 1 chrisw chrisw 0 Jul 27 12:07 tt1
        ---------- 1 chrisw chrisw 0 Jul 27 12:07 tt2
        
        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #3

        @ChrisW67
        You are of course correct --- but how does umask gets "accidentally" set to 0777 (rather than, say, 0)? :)

        1 Reply Last reply
        0
        • C ChrisW67

          @nroos An incorrect umask in the user's environment can create files without permission flags

          /tmp$ umask  # default umask is?
          0002
          /tmp$ touch tt1
          /tmp$ umask 777 # bad umask set
          /tmp$ touch tt2
          /tmp$ ls -l tt?
          -rw-rw-r-- 1 chrisw chrisw 0 Jul 27 12:07 tt1
          ---------- 1 chrisw chrisw 0 Jul 27 12:07 tt2
          
          N Offline
          N Offline
          nroos
          wrote on last edited by
          #4

          @ChrisW67

          Forgot to mention, umask is normal, 0002. When i touch a file, it gets its normal permissions.

          The created configuration files by Creator also belong to me, so it is not creating them as a different user.

          And i guess the open() call should still have the 006 as parameter, the umask should be applied inside the system call somewhere.

          The umask is set in Qt Creator twice, but only to 0000 and 0002, so this doesn't explain it either.

          strace was running with -f, so it should be aware of all system calls, even those from child processes.

          JonBJ 1 Reply Last reply
          0
          • N nroos

            @ChrisW67

            Forgot to mention, umask is normal, 0002. When i touch a file, it gets its normal permissions.

            The created configuration files by Creator also belong to me, so it is not creating them as a different user.

            And i guess the open() call should still have the 006 as parameter, the umask should be applied inside the system call somewhere.

            The umask is set in Qt Creator twice, but only to 0000 and 0002, so this doesn't explain it either.

            strace was running with -f, so it should be aware of all system calls, even those from child processes.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #5

            @nroos
            I just noticed something else:

            [pid 4018] open("/home/user/.config/QtProject/qtcreator", O_RDWR|O_CLOEXEC|O_TMPFILE, 000) = 43
            [pid 4018] linkat(AT_FDCWD, "/proc/self/fd/43", AT_FDCWD, "/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", AT_SYMLINK_FOLLOW) = 0
            [pid 4018] open("/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
            

            The first line opens a (temporary) file. The last line (and the middle one) uses the same path as a directory. Right? So, regardless of permissions, what is going on here?

            A random thought: create /home/user/.config/QtProject/qtcreator as a directory before you start. Any difference in behaviour?

            N 1 Reply Last reply
            0
            • JonBJ JonB

              @nroos
              I just noticed something else:

              [pid 4018] open("/home/user/.config/QtProject/qtcreator", O_RDWR|O_CLOEXEC|O_TMPFILE, 000) = 43
              [pid 4018] linkat(AT_FDCWD, "/proc/self/fd/43", AT_FDCWD, "/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", AT_SYMLINK_FOLLOW) = 0
              [pid 4018] open("/home/user/.config/QtProject/qtcreator/devices.xml.NHafXq", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
              

              The first line opens a (temporary) file. The last line (and the middle one) uses the same path as a directory. Right? So, regardless of permissions, what is going on here?

              A random thought: create /home/user/.config/QtProject/qtcreator as a directory before you start. Any difference in behaviour?

              N Offline
              N Offline
              nroos
              wrote on last edited by
              #6

              @JonB

              '/home/user/.config/QtProject/qtcreator' is created by Qt Creator as a directory.

              The open() in conjunction with O_TMPFILE wants to have a directory as path, where to create the temporary file (the open()er does not know about the filename yet). It creates an unnamed file in it.

              So this is correct behaviour.

              I also tried giving the qtcreator directory and all its parents all permissions, but to no success.

              Meanwhile i tried to follow in the source code where the reuested open() permissions are coming from, but it's nearly impossible to trace it. At least not at first glance.

              JonBJ 1 Reply Last reply
              0
              • N nroos

                @JonB

                '/home/user/.config/QtProject/qtcreator' is created by Qt Creator as a directory.

                The open() in conjunction with O_TMPFILE wants to have a directory as path, where to create the temporary file (the open()er does not know about the filename yet). It creates an unnamed file in it.

                So this is correct behaviour.

                I also tried giving the qtcreator directory and all its parents all permissions, but to no success.

                Meanwhile i tried to follow in the source code where the reuested open() permissions are coming from, but it's nearly impossible to trace it. At least not at first glance.

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by JonB
                #7

                @nroos said in Qt Creator creates file without permissions:

                The open() in conjunction with O_TMPFILE wants to have a directory as path, where to create the temporary file (the open()er does not know about the filename yet). It creates an unnamed file in it.

                Yep, read up on that, didn't know it expects directory and creates file inside it, thought you had to generate the filename yourself and pass that.

                Thoughts, compare on the 2 boxes:

                • What does ls -ld /home/user/.config/QtProject/qtcreator return?
                • Do they use the same filing system type for /home/...?
                N 1 Reply Last reply
                0
                • JonBJ JonB

                  @nroos said in Qt Creator creates file without permissions:

                  The open() in conjunction with O_TMPFILE wants to have a directory as path, where to create the temporary file (the open()er does not know about the filename yet). It creates an unnamed file in it.

                  Yep, read up on that, didn't know it expects directory and creates file inside it, thought you had to generate the filename yourself and pass that.

                  Thoughts, compare on the 2 boxes:

                  • What does ls -ld /home/user/.config/QtProject/qtcreator return?
                  • Do they use the same filing system type for /home/...?
                  N Offline
                  N Offline
                  nroos
                  wrote on last edited by
                  #8

                  @JonB

                  What does ls -ld /home/user/.config/QtProject/qtcreator return?

                  user@akita:~/projects/qml$ cd
                  user@akita:~$ ls -ld /home/user/.config/
                  drwxrwxrwx 59 user user 4096 Jul 27 13:30 /home/user/.config/
                  user@akita:~$ ls -ld /home/user/.config/QtProject/
                  drwxrwxr-x 3 user user 4096 Jul 26 13:40 /home/user/.config/QtProject/
                  user@akita:~$ ls -ld /home/user/.config/QtProject/qtcreator/
                  drwxrwxr-x 7 user user 4096 Jul 26 13:40 /home/user/.config/QtProject/qtcreator/
                  

                  Making it all-writable didn't change anything

                  Do they use the same filing system type for /home/...?

                  Good idea, actually they differ in this way. The working variant is just a directory under /, the not-working is on a separate partition and even on a different SSD.

                  I just checked it when running it as root. root has his home directory directly in /. But it also opens the file with 0000, seems to be working only because he is root.

                  JonBJ 1 Reply Last reply
                  0
                  • N nroos

                    @JonB

                    What does ls -ld /home/user/.config/QtProject/qtcreator return?

                    user@akita:~/projects/qml$ cd
                    user@akita:~$ ls -ld /home/user/.config/
                    drwxrwxrwx 59 user user 4096 Jul 27 13:30 /home/user/.config/
                    user@akita:~$ ls -ld /home/user/.config/QtProject/
                    drwxrwxr-x 3 user user 4096 Jul 26 13:40 /home/user/.config/QtProject/
                    user@akita:~$ ls -ld /home/user/.config/QtProject/qtcreator/
                    drwxrwxr-x 7 user user 4096 Jul 26 13:40 /home/user/.config/QtProject/qtcreator/
                    

                    Making it all-writable didn't change anything

                    Do they use the same filing system type for /home/...?

                    Good idea, actually they differ in this way. The working variant is just a directory under /, the not-working is on a separate partition and even on a different SSD.

                    I just checked it when running it as root. root has his home directory directly in /. But it also opens the file with 0000, seems to be working only because he is root.

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #9

                    @nroos said in Qt Creator creates file without permissions:

                    the not-working is on a separate partition and even on a different SSD

                    I asked what Linux filing system they are each on? The implementation of O_TMPFILE might vary on different fs-types. It's at least worth checking. Though I admit it shouldn't be related to a permissions value being passed, but might be good to know whether they differ.

                    N 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @nroos said in Qt Creator creates file without permissions:

                      the not-working is on a separate partition and even on a different SSD

                      I asked what Linux filing system they are each on? The implementation of O_TMPFILE might vary on different fs-types. It's at least worth checking. Though I admit it shouldn't be related to a permissions value being passed, but might be good to know whether they differ.

                      N Offline
                      N Offline
                      nroos
                      wrote on last edited by
                      #10

                      @JonB

                      Ah ok, both are ext4.

                      But i think the problem starts earlier, because the open() is already called with different parameters. It could still be some platform related reason, if the call is made from a lib or so, which differs. The Qt version is in both cases 5.15.3.

                      1 Reply Last reply
                      1

                      • Login

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