Write access in `$HOME/.local` directory

Hi ! @Snapcrafters .

I defined this in my *.yaml file to have write access in the $HOME/.local directory, but it does not work, why ?


plugs:

dot-local-fonts:

interface: personal-files
write:
  - $HOME/.local

apps:

vimizer:

    command: usr/bin/vimizer
    plugs:
      - network
      - home
      - dot-local-fonts

Connect the plug to allow the plug. Run,

sudo snap connect vimizer:dot-local-fonts

also, as it seems that your intention is only to write in .local/fonts just change the write access to the same

Hi ! @soumyaDghosh .

Thanks for your intervention .

I already tried this, but it does not work.

It asks me to install vimizer (the snap that I must build).

what’s the snap name, that you’re trying to use this on?

@soumyaDghosh , I must build a snap (its name is vimizer) with the write access in the directory $HOME/.local .

@ogra, please ! Can you help here ?

Not if you don’t actually describe the problem… “it does not work” is not really an error description that anyone is able to decipher :wink:

Hi @ogra . The idea is to have the write access in $HOME/.local (To define in the *.yaml file) .

How to achieve this goal ?

That still does not describe the confinement error you are getting when trying to write or what exactly you have tried yet, what the output of snappy-debug was, etc…

Hi @ogra .

Here is the *.yaml file for the program in question (vimizer).


name: vimizer 

base: core20 

version: "1.0.3"

summary: vimizer, a program that allows to setup the vim and zsh program 

description:   entity

grade: stable

confinement: strict

parts:

    vimizer:
        source: ./src
        plugin: dump
        organize:
            bin/vimizer: usr/bin/vimizer

        stage-packages:
          - zsh
          - coreutils
          - curl
          - bc
          - gzip
          - awk
          - util-linux
          - gawk
          - vim-gtk3
          - bash
          - nodejs
          - npm
          - zsh-syntax-highlighting
          - vim
          - git
          - man
          - zsh-autosuggestions

    vimizer-man:
        source: ./src/usr/share/man/man1
        plugin: dump
        organize:
            vimizer.1.gz: usr/share/man/man1/vimizer.1.gz

    vimizer-documentation-info:
        source: ./src/usr/lib/vimizer/documentation/info
        plugin: dump
        organize:
            vimizer-help: usr/lib/vimizer/documentation/info/vimizer-help
            vimizer-version-pure: usr/lib/vimizer/documentation/info/vimizer-version-pure

    library:
        source: ./src/usr/lib/vimizer/library/depends
        plugin: dump
        organize:
            vim: usr/lib/vimizer/library/depends/vim
            vimizer-fonts: usr/lib/vimizer/library/depends/vimizer-fonts
            zsh: usr/lib/vimizer/library/depends/zsh


plugs:
    dot-local-fonts:
        interface: personal-files
        write:
            - $HOME/.local


apps:
    vimizer:
    command: usr/bin/vimizer
    plugs:
      - network
      - home
      - dot-local-fonts

I would like to have the write access in $HOME/.local.

When I execute the program (vimizer) with this configuration, a write access error is returned at the level of $HOME/.local.

First of all fix the path to match the name you gave the plug (the name says “fonts” but the path does not contain it)…

Have you connected the plug after installing the snap ?

What dies snappy-debug output when you run it alongside ?

PS: and please try to use three backticks ``` in the line above and below any code or yaml you paste, that way it stays readable for all of us…

That’s to say ?

→ ““First of all fix the path to match the name you gave the plug (the name says “fonts” but the path does not contain it)…””

I would prefer an automatic connection, if that’s possible .

→ ““Have you connected the plug after installing the snap ?””

Well, personal-files do never autoconnect by default, you need to use the the snap connect command for such high privileged interfaces… once you have everything working fine you can later on ask for an autoconnect though which might or might not be granted after the reviewers team took a look at your finished snap…

Your interface is called dot-local-fonts but it does not point to $HOME/.local/fonts you should fix the path in your snapcraft.yaml, it is unlikely that the reviewers would ever grant the autoconnect to all of $HOME/.local since that would allow your app to access all possible sensible data from other applications…

2 Likes

Okay @ogra .

Thanks .