inconsistent behavior for linked target directory

Bug #1092099 reported by Karl-Philipp Richter
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cups-pdf (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

If target folder ~/PDF is removed and replaced by a symlink to a folder on another filesystem (~/PDF -> /mnt/some_other_filesystem/PDF) with existing pdf-files the files in this folder are not overwritten and the creation of the pdf is skipped silently. This behavior is diffent from the behavior which occurs when the replacement didn't take place (files are overwritten in the default folder ~/PDF) (bug might be related to the filename prepress_-c__setpdfwrite_-f__s.pdf only).

Ubuntu: 12.10
cups-pdf: 2.6.1-7

Revision history for this message
Jani Uusitalo (uusijani) wrote :

On 12.04 at least, the target is governed by cupsd's AppArmor profile (see bug #147551) and trying to circumvent it using symlinks fails irrespective of whether the target is on another filesystem or not ("failed to set file mode for PDF file" in /var/log/cups/cups-pdf_log).

Revision history for this message
Karl-Philipp Richter (krichter722) wrote :

I think this is related to cups-pdf trying to change the ownership of ~/PDF or the directory set in /etc/cups/cups-pdf.conf, but fails because it's a link. Just use a function which ignores links whose ownerships can't be set. This problem persists in 2.6.1-8 on Ubtunu 13.04.
Thanks in advance for taking care about this.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

This is caused by AppArmor as stated in comment #1.

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Does this issue still affect cups-pdf 3.0.1 packages?

Revision history for this message
Jani Uusitalo (uusijani) wrote :

Yes, this is still present in 20.04 with printer-driver-cups-pdf 3.0.1-6, limited to original reporter's case of having the symlink point to another filesystem; if I point ~/PDF to, say ~/tmp/PDF (without crossing filesystem borders), the PDF is created without issue, whereas having ~/PDF linked to /media/$USER/$USB_THUMBDRIVE/PDF/ does still cause it to fail:

[...]
Sat Dec 26 16:48:07 2020 [DEBUG] output filename created: /home/jani/PDF/Bug__1092099__342_200_234inconsistent_behavior_for...ry_342_200_-job_8.pdf
Sat Dec 26 16:48:07 2020 [DEBUG] ghostscript commandline built: /usr/bin/gs -q -dCompatibilityLevel=1.2 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/home/jani/PDF/Bug__1092099__342_200_234inconsistent_behavior_for...ry_342_200_-job_8.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /var/spool/cups-pdf/SPOOL/cups2pdf-233705
Sat Dec 26 16:48:07 2020 [DEBUG] output file unlinked: /home/jani/PDF/Bug__1092099__342_200_234inconsistent_behavior_for...ry_342_200_-job_8.pdf
Sat Dec 26 16:48:07 2020 [DEBUG] TMPDIR set for GhostScript: /var/tmp
Sat Dec 26 16:48:07 2020 [DEBUG] waiting for child to exit
Sat Dec 26 16:48:07 2020 [DEBUG] entering child process
Sat Dec 26 16:48:07 2020 [DEBUG] GID set for current user
Sat Dec 26 16:48:07 2020 [DEBUG] supplementary groups set for current user
Sat Dec 26 16:48:07 2020 [DEBUG] UID set for current user: jani
Sat Dec 26 16:48:07 2020 [DEBUG] ghostscript has finished: 256
Sat Dec 26 16:48:07 2020 [ERROR] failed to set file mode for PDF file: /home/jani/PDF/Bug__1092099__342_200_234inconsistent_behavior_for...ry_342_200_-job_8.pdf (non fatal)
Sat Dec 26 16:48:07 2020 [DEBUG] ERRNO: 2 (No such file or directory)
Sat Dec 26 16:48:07 2020 [DEBUG] no postprocessing
Sat Dec 26 16:48:07 2020 [DEBUG] spoolfile unlinked: /var/spool/cups-pdf/SPOOL/cups2pdf-233705
Sat Dec 26 16:48:07 2020 [DEBUG] all memory has been freed
Sat Dec 26 16:48:07 2020 [STATUS] PDF creation successfully finished for jani
jani@latimeria:~$ ls -l PDF
lrwxrwxrwx 1 jani jani 27 joulu 26 16:47 PDF -> /media/jani/KINGSTON_1G/PDF
jani@latimeria:~$ ls PDF/
jani@latimeria:~$ ls /media/jani/KINGSTON_1G/PDF/
jani@latimeria:~$

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Have you edited the corresponding AppArmor files to match the new destination?

Revision history for this message
Jani Uusitalo (uusijani) wrote :

No, I haven't (and wouldn't know how).

Revision history for this message
Martin-Éric Racine (q-funk) wrote :

Standard user output to <${HOME}/PDF/> directory. This settings is fully configurable by editing </etc/cups/cups-pdf.conf> using the system administrator's favorite text editor.

Note that AppArmor prevents outputting PDF documents to non-default directories so </etc/apparmor.d/usr.sbin.cupsd> must also be edited, whenever the defaults get changed in </etc/cups/cups-pdf.conf>.

Changed in cups-pdf (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cups-pdf (Ubuntu) because there has been no activity for 60 days.]

Changed in cups-pdf (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.