imgcat
                                
                                
                                
                                    imgcat copied to clipboard
                            
                            
                            
                        Permission denied when reading files
Using the snap package, imgcat returns permission denied error when a file is given as input in the argument.
However, it works fine when reading standard input (e.g. cat <image>.jpg | imgcat). Here is an example:

I have tested it on Ubuntu 18.04 LTS & 20.04 LTS. Thanks for the follow-up in advance!
edit: typo
Have you already checked the file permissions?
ls -l yourfile.jpg
please paste the content here.
Sure, here it is; the image has 664 perm:
╭─user@userbox ~/Downloads 
╰─$ ls -l 81df324067abd6c4820674604a9587c8.jpg 
-rw-rw-r-- 1 user user 145663 Feb  9  2021 81df324067abd6c4820674604a9587c8.jpg
edit: ls'd the wrong file 😅
I have the same issue. Installed imgcat via snap. cat image.bmp | imgcat works but imgcat image.bmp returns 403.
fix in next release
Having the same issue. :(
Using go version go1.17.7 linux/amd64
Installed with go install github.com/danielgatis/imgcat@latest
Kernel Linux version 5.15.15-76051515-generic ([email protected]) (gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.37) #202201160435~1642693824~21.10~97db1bb SMP Thu Jan 20 17:35:05 U
On Pop!_OS 21.10
I have no clue why it is happening. Any suggestion?
Unfortunately I don't know enough about Go. All I can say is that I tried cat image.bmp | imgcat - as mentioned above - and it also works on my system. It's not that bad since I can just make an alias but it is strange indeed.
@sommerper Take a look at here: https://github.com/danielgatis/imgcat/blob/master/main.go#L48
This is the line that opens the file. The file is open as readonly, so it is a very strange error.
weird. I tried giving combinations of root / $user ownership to imgcat and the image but still got permission denied.
As far as I can see ioutil.ReadFile is deprecated in favor of os.ReadFile but it shouldn't make a difference really.
Same issue here, but I don't think it has anything to do with Go or the program itself. I suspect it's some AppArmor/SElinux restriction due to the jail that the snap runs in. If I try to have it open / or /home, it properly reports the error "is a directory", but when I have it open /home/$USER, it reports permission denied even though /home and /home/$USER allow world readability/access (i.e. 755 mode). The snap container restrictions need to be fixed, not the program itself.
Issue still exists even when run with sudo or with root user
2022/08/18 05:43:20 failed to read the input file: open ed3e487f3a8e9712938cae5fcb8ac7b8.jpg: permission denied
panic: failed to read the input file: open ed3e487f3a8e9712938cae5fcb8ac7b8.jpg: permission denied
goroutine 1 [running]:
log.Panicf({0x542bed, 0x60}, {0xc00004ff30, 0x60, 0x644880})
	/opt/hostedtoolcache/go/1.17.7/x64/src/log/log.go:361 +0x67
main.read({0x7ffc7b6ba50a, 0xc000010050})
	/home/runner/work/imgcat/imgcat/main.go:50 +0xee
main.main()
	/home/runner/work/imgcat/imgcat/main.go:277 +0x85
                                    
                                    
                                    
                                
@penguin359 I just released version v1.0.14 When you get some free time, it would be nice if could test it. ;)
https://github.com/danielgatis/imgcat/commit/8f2acbf03dab176d1475e706618383245f550c6e#diff-42e26dc67aed8aa3edb2472b4403288c1699fb6dc47419b9a475f0f224fe4689R28
@penguin359 I just released version v1.0.14 When you get some free time, it would be nice if could test it. ;)
8f2acbf#diff-42e26dc67aed8aa3edb2472b4403288c1699fb6dc47419b9a475f0f224fe4689R28
I've just installed a fresh version via snap and still get the exact same issue
Same here:
sudo snap refresh imgcat
snap "imgcat" has no updates available