SOLVED Help needed using 'personal-files' interface

I’m failing to build the universal-ctags snap so that it can access config file ~/.ctags.d/python.ctags

My current snapcraft.yaml:

I’ve added both:

  • ~/.ctags.d (directory)
  • ~/.ctags.d/python.ctags (file)

to the personal-interface ‘read’ access, because I believe the application (which is not mine) scans the content of the directory before trying to open whatever files it finds there (however, my strace skills are not sufficient to confirm this when running a snap.)

I build the snap file:

rm *.snap
snapcraft clean
snapcraft  # (or 'snapcraft snap', which I believe is equivalent?)

I install that:

sudo snap install universal-ctags-*.snap --dangerous

and manually connect the personal files interface:

sudo snap connect universal-ctags:config-universal-ctags

which seems to work:

$ snap connections universal-ctags
Interface       Plug                                    Slot             Notes
home            universal-ctags:home                    :home            -
personal-files  universal-ctags:config-universal-ctags  :personal-files  manual

But, running the snap does not find that config file. Running it in verbose mode confirms that - it outputs that it did not find any config files under HOME. As a sanity test, if I instead run:


Then it reports:

Considering option file /home/jhartley/.ctags.d/python.ctags: reading...
  Option: --python-kinds=-c

(i.e. it found the ‘python.ctags’ config file and read the correct content from it)

Any clues for what I might be doing wrong?

Perhaps that’s be cause $HOME is effectively set to $SNAP_USER_DATA for confined snaps.

See an example solution provided here: Please allow use of personal-files for gitl [Was: Classic confinement for gitl]


Wow! Thank you! That seems like an important fact that I totally hadn’t realized.

Moving my config file into /home/USER/snap/SNAPNAME/current/.ctags.d/python.ctags allows the snap to read it. Hooray!

Looking at the solution you linked to… I’m packaging up someone else’s compiled binary app. I’d have to wrap their binary with a script just to reset HOME. I’ll try that…

Yes, wrapping my executable in a script that restores HOME does fix my problem. My snap can now read files that ‘personal-files’ grants access to in the user’s home.

My resulting snapcraft.yaml generates the wrapper script in ‘override-prime’:

Hooray, thank you!