[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#931363: Fails to create output PDF (permission denied)



I was stumbling over this today too… but a look at the code shows that
the log output is confusing.

On Wed, Jul 03, 2019 at 09:52:29AM +0200, martin f krafft wrote:
>  Wed Jul  3 09:40:55 2019  [DEBUG] output filename created: /home/ssd/madduck/PDF/stdin___madduck_PDF.pdf

Here, the output filename is built from other variables,

>  Wed Jul  3 09:40:55 2019  [DEBUG] ghostscript commandline built: /usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/home/ssd/madduck/PDF/stdin___madduck_PDF.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /var/spool/cups-pdf/SPOOL/cups2pdf-8702

then the gs commandline is built,

>  Wed Jul  3 09:40:55 2019  [DEBUG] output file unlinked: /home/ssd/madduck/PDF/stdin___madduck_PDF.pdf

then the output file is unlinked so that gs does not have problems
writing to it,

>  Wed Jul  3 09:40:55 2019  [DEBUG] TMPDIR set for GhostScript: /var/tmp

and only here the gs process is forked off.

>  Wed Jul  3 09:40:55 2019  [DEBUG] waiting for child to exit
>  Wed Jul  3 09:40:55 2019  [DEBUG] entering child process
>  Wed Jul  3 09:40:55 2019  [DEBUG] GID set for current user
>  Wed Jul  3 09:40:55 2019  [DEBUG] supplementary groups set for current user
>  Wed Jul  3 09:40:55 2019  [DEBUG] UID set for current user: madduck
>  Wed Jul  3 09:40:55 2019  [DEBUG] ghostscript has finished: 256

However, gs exits unsucessfully with an exit code of 256.

>  Wed Jul  3 09:40:55 2019  [DEBUG] no postprocessing
>  Wed Jul  3 09:40:55 2019  [DEBUG] spoolfile unlinked: /var/spool/cups-pdf/SPOOL/cups2pdf-8702
>  Wed Jul  3 09:40:55 2019  [DEBUG] all memory has been freed
> 
> Not only is the output file unlinked right after the call to /usr/bin/gs;
> 
> The target directory is 0700, but even changing it to 1777 doesn't fix
> things.
> 
> Note that if I reduce the LogLevel to 3 in /etc/cups/cups-pdf.conf, then the
> log output suggests that PDF creation is being successful, after failing to
> set the file mode:
> 
>  Wed Jul  3 09:44:00 2019  [ERROR] failed to set file mode for PDF file: /home/ssd/madduck/PDF/2019-07-03-094400-740472161-muttprint.pdf (non fatal)

This is only a follow-up error because gs did not create the output
file. So I would also look for the cause in gs itself, or the
environment in which it was executed.

But that's all I could find out until now…

 - Roland


Reply to: