man page gives "gzip: stdout: Permission denied" error

36 Views Asked by At

I am using Linux Mint 21 and had to compile some programs from source, so I manually updated MANPATH to include their man pages. However when I try to view them, I get the following line at the bottom of the pager (see screenshot):

gzip: stdout: Permission denied

The man page opens without any problem, but I would nevertheless like to fix this issue.

I have verified that the path from which the man page is opening is the path I set in MANPATH.

$ man --path xdotool
/home/<path-to-files>/xdotool/man/man1/xdotool.1

It is also not specific to the above man page, the same issue is in all the man pages I have added locally through setting MANPATH.

1

There are 1 best solutions below

1
HehBot On

This isn't a solution to the problem but does show the reason for it. I followed @Charles Duffy 's advice and looked through the strace logs using the following command

strace -o man-xdotool.strace -s 2048 -ff /usr/bin/man xdotool

Then I searched among the files for denied (i.e. the process which execve'd gzip and gave this error), which gives me the pid where the write call failed. Inside there I traced back the last dup2 call, which gave me the fd 4 (dup2ed and closed). I verified that this itself wasn't duped before in this process and began checking the parent process log for this fd.

In the parent process, the last open/openat call that created fd 4 before clone was called to spawn the child process was:

openat(AT_FDCWD, "/home/<path-to-file>/xdotool/man/cat1/catpO12k8", O_RDWR|O_CREAT|O_EXCL, 0600)

I verified this wasn't closed before clone. Ahead of this I can't figure out why gzip isn't invoked at all when the terminal is resized, or why it is unable to write to that file.