canonical / ght

Perform actions in Greenhouse from you terminal
9 stars 14 forks source link

GHT record feature writes to inaccessible directory from snap #253

Open wolsen opened 3 weeks ago

wolsen commented 3 weeks ago

The ght recording feature added in PR#249 attempts to write the screen recording files to the ~/.ght/recordings folder, however the snap does not have permissions to access this folder as snaps do not have access to hidden folders in the user's home directory by default. While this permission can be added, there is no need to actually store the recordings in this folder and instead the $SNAP_USER_COMMON directory can be used instead (e.g. ~/snap/ght/common/recordings).

Steps to recreate

$ sudo snap install ght --channel latest/edge
$ ght assign -i --record

Expected outcome A recording of the chrome session to be successfully saved in a local directory.

Actual outcome

wolsen@violet:~ $ ght assign -i --record
[Error: EACCES: permission denied, open '/home/wolsen/.ght/recordings/ght_recording_2024-11-05T21-20-32-082Z.mp4'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/home/wolsen/.ght/recordings/ght_recording_2024-11-05T21-20-32-082Z.mp4'
}
? Your Ubuntu One email: ‣ wolsen@violet:~ $
wolsen commented 3 weeks ago

I'll note that this works fine from the dev instance using yarn dev assign -i --record, but does not work within the confines of a snap. This does not appear that it was caught in testing because the installation used the --devmode flag, which allows does not enforce the confinement and simply records apparmor errors in the kernel logs.