• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Cannot store app data in any directory - symbolic links not recognised within apps

Scheduled Pinned Locked Moved Support
6 Posts 2 Posters 767 Views 2 Watching
Loading More Posts
  • 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.
    • U Offline
      ubuntoutou
      last edited by 8 Nov 2018, 23:17

      All Ubuntu Touch apps store user data in ~/.local/share/app-name/. It is impossible to open a file stored for instance in ~/Documents/.

      One way around this would be to create a symbolic link:

       $ ln -s ~/Document/data-file ~/.local/share/app-name/link-to-data-file
      

      Unfortunately, opening such a link with an app yield an empty file. However, if the data file were in the same directory as the link, then opening the link would yield the full non empty file. That is, if the link is created as:

       $ ln -s ~/.local/share/app-name/data-file ~/.local/share/app-name/link-to-data-file
      

      then everything works fine.

      It seems that Ubuntu Touch apps are blind to the directory tree. Does anybody know a way around this problem? How could one choose where to store data files and not be restricted to ~/.local/share/app-name/ ?

      1 Reply Last reply Reply Quote 1
      • D Offline
        dobey
        last edited by 9 Nov 2018, 16:08

        Apps are confined. They cannot read or write outside of their confined directories. To open and store files into alternate directories, the app must use the content-hub API, to share files with other apps, such as the File Manager, which would allow you to copy the data into ~/Documents for example.

        U 1 Reply Last reply 9 Nov 2018, 20:34 Reply Quote 0
        • U Offline
          ubuntoutou @dobey
          last edited by 9 Nov 2018, 20:34

          Thank you for the tip. Does it mean that there is no way to expand the capacity of a device with an SD card without having to transfer all the time files between this SD card and the directories visible to the apps?

          D 1 Reply Last reply 9 Nov 2018, 21:05 Reply Quote 0
          • D Offline
            dobey @ubuntoutou
            last edited by 9 Nov 2018, 21:05

            There's no way to have confined apps store their data on external storage at the moment, outside of providing copies via content-hub. There was some work on a framework to enable this (along with allowing apps to store data in remote services like Google Drive) from Canonical, but it never got to the point of being in the image and usable by applications.

            I don't know if there's an issue open about having more visible locations for apps to store their data (such as under ~/Documents/$APPID/, /sdcard/data/$APPID/, or similar), but that could perhaps be something we could enable more easily. However, even if this were enabled, apps would need to be updated to actually write content there. However, cache would still be under ~/.cache/.

            1 Reply Last reply Reply Quote 0
            • U Offline
              ubuntoutou
              last edited by 10 Nov 2018, 21:42

              Thank you for the detailed explanation. Does the impossibility to read/write throughout the directory tree apply also to apps that are not AppArmor compliant and mentioned as having "access to restricted system data" in the OpenStore?

              D 1 Reply Last reply 10 Nov 2018, 22:42 Reply Quote 0
              • D Offline
                dobey @ubuntoutou
                last edited by 10 Nov 2018, 22:42

                @ubuntoutou No, unconfined apps can read/write to most any location where the user has filesystem level permissions. However, such apps require manual review, and this is not an appropriate way to implement what you are trying to solve. It would also be an incredible annoyance for yourself, if you wanted to try to rebuild every app you install to be unconfined, every time they get updated.

                1 Reply Last reply Reply Quote 0
                1 out of 6
                • First post
                  1/6
                  Last post