pushover-cli icon indicating copy to clipboard operation
pushover-cli copied to clipboard

Failed to load `/etc/xdg/pushover-cli/config.json`

Open mamercad opened this issue 2 years ago • 6 comments

❯ snap list pushover-cli
Name          Version  Rev  Tracking       Publisher      Notes
pushover-cli  1.0.4    14   latest/stable  adrian.rudnik  -

❯ diff /etc/xdg/pushover-cli/config.json /home/mark/snap/pushover-cli/14/.config/pushover-cli/config.json

❯ pushover-cli push hello
2023-03-24T20:26:17-04:00 INF Message pushed request=5f39255e-e917-4e4a-805d-78b6afb4b786 status=1
2023-03-24T20:26:17-04:00 INF Rate limit information requests-per-month=10000 requests-remaining=9994 reset-at=2023-04-01T05:00:00Z

❯ rm /home/mark/snap/pushover-cli/14/.config/pushover-cli/config.json

❯ pushover-cli push hello
2023-03-24T20:26:30-04:00 FTL Failed to read config error="open /etc/xdg/pushover-cli/config.json: permission denied"

❯ stat /etc/xdg/pushover-cli/config.json
  File: /etc/xdg/pushover-cli/config.json
  Size: 93              Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 19529758    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2023-03-24 20:20:42.303123890 -0400
Modify: 2023-03-24 20:20:20.939205359 -0400
Change: 2023-03-24 20:20:21.243204199 -0400
 Birth: -

mamercad avatar Mar 25 '23 00:03 mamercad

Can you post an anonymized variant of the order of paths the app looks through with the command pushover-cli config paths?

Not sure why the config ended up in /etc/xdg when the user does not have access writes, it should have failed when it tried to write it already.

The list should look something like this:

INF Folder found path=/home/adrian/snap/pushover-cli/14/.config/pushover-cli
INF Folder found path=/etc/xdg/xdg-pop/pushover-cli
INF Folder found path=/etc/xdg/pushover-cli

adrianrudnik avatar Mar 25 '23 03:03 adrianrudnik

Can you post an anonymized variant of the order of paths the app looks through with the command pushover-cli config paths?

Not sure why the config ended up in /etc/xdg when the user does not have access writes, it should have failed when it tried to write it already.

The list should look something like this:

INF Folder found path=/home/adrian/snap/pushover-cli/14/.config/pushover-cli
INF Folder found path=/etc/xdg/xdg-pop/pushover-cli
INF Folder found path=/etc/xdg/pushover-cli

Sure, this isn't anonymized, I'm not worried that my username is sensitive 😄

❯ pushover-cli config paths
2023-03-25T09:41:06-04:00 INF Collecting paths that will be used for config.json lookup
2023-03-25T09:41:06-04:00 INF Folder found path=/home/mark/snap/pushover-cli/14/.config/pushover-cli
2023-03-25T09:41:06-04:00 INF Folder found path=/etc/xdg/pushover-cli

mamercad avatar Mar 25 '23 13:03 mamercad

Not sure why the config ended up in /etc/xdg when the user does not have access writes, it should have failed when it tried to write it already.

I used configuration management to push the config into /etc/xdg/pushover-cli thinking that all system users could share the config that way.

mamercad avatar Mar 25 '23 13:03 mamercad

Ok, yeah that seems OK. The problem with snap is that it is hard to access stuff outside its own security context, it acts like a jail. You could try to use the pure binary or fiddle with snap mounts --devmode. Maybe I can add additional distribution channels if I can find the time.

adrianrudnik avatar Mar 25 '23 13:03 adrianrudnik

Ok, yeah that seems OK. The problem with snap is that it is hard to access stuff outside its own security context, it acts like a jail. You could try to use the pure binary or fiddle with snap mounts --devmode. Maybe I can add additional distribution channels if I can find the time.

Not a problem at all; I've dumped config.json into the respective user homes for the time being. Though, I'd argue that the snap shouldn't search this path if it doesn't work.

mamercad avatar Mar 25 '23 14:03 mamercad

I agree, I will take this issue to at least add a check if the cli has read access to the resolved paths, if not, remove it from the list of possible paths (or at least mark it as problematic).

adrianrudnik avatar Mar 25 '23 14:03 adrianrudnik