Personal-files: request for zint-snap

Hi, there is a snap named zint-snap from my distributions. Now it need access to personal-files because it will create a temp file in user’s home directory(e.g. $HOME/.zint.bmp) when copy the pictures to clipboard. Besides, I will request auto-connection for it. Give me some suggestions please!

human review required due to ‘allow-installation’ constraint (bool) declaration-snap-v2_plugs_installation (dot-zint, personal-files)

    plugs:
      dot-zint:
        interface: personal-files
        read:
          - $HOME/.zint.bmp
          - $HOME/.zint.svg
          - $HOME/.zint.png
          - $HOME/.zint.emf
          - $HOME/.zint.gif
          - $HOME/.zint.tif
        write:
          - $HOME/.zint.bmp
          - $HOME/.zint.svg
          - $HOME/.zint.png
          - $HOME/.zint.emf
          - $HOME/.zint.gif
          - $HOME/.zint.tif

More information: snapcraft.yaml

+1 from me for auto-connect personal-files with write access to $HOME/.zint.bmp, $HOME/.zint.svg, $HOME/.zint.png, $HOME/.zint.emf, $HOME/.zint.gif and $HOME/.zint.tif since zint-snap is the clear owner of such directories. Can other @reviewers please vote?

@Joker2770 please note that write implies read so read is not needed :wink:!

Thank you, I will simplify and remove read part.

Instead of creating these temporary files in the user’s real home directory, could they not just be placed in the snap’s private $HOME (ie $HOME/snap/zint/current/)? Then there is no need for the use of personal-files.

This program distributed under open source code here use BSD and GPLv3 license, and not just only developed for snap. So if could give it access for the use of personal-file without code change.

Ah ok, so looking at the code it looks like when copying to the clipboard it copies the path to the image file which would be ~/.zint.bmp - so this then allows other applications to access this file directly. Note, this file cannot be accessed by other snaps (as it is a dot-file) but can be accessed by unconfined applications on the system - BUT this has the same properties as if a file was placed in $HOME/snap/zint/current etc. However, since zint is the clear owner of these paths I am not fundamentally opposed to it using personal-files for write access as requested above. As such, +1 from me too for this request. BUT ideally the code would be changed to use something like QSL(getenv("HOME")) + QSL("/.zint.bmp") which should then allow it to work in both the snap and non-snap environments without modification.

1 Like

Thanks, maybe I can change the directory instead of the user’s real home directory to run the application to solve this indirectly, and use a shell in snap like follow.

#!/bin/sh
cd $HOME
$SNAP/usr/local/bin/zint-qt

Hey @Joker2770,

Did you try the suggestion provided by @alexmurray? Thanks!

hi @emitorino, I had a try by modified the code like the suggestion provided by @alexmurray, but came with some syntax errors of QT related. It’s difficult for me to solve, So I gave up to use my way, and every thing looks ok now. But I still hope someone else who could pull request here to solve problem.