GNOME Bugzilla – Bug 679354
Evince fails to create temporary file when opening embedded PDF annotation attachment [PATCH INCLUDED]
Last modified: 2012-07-04 09:36:38 UTC
Created attachment 217968 [details] Minimal working example PDF and source I've included a minimum working example of the problem. It occurred when I was trying to embed an auxiliary file within a PDF using the attachfile2 package of the LaTeX distribution. The included PDF was generated with the sequence xelatex minimal pdfatfi minimal xelatex minimal Then when the PDF is opened with Evince and the annotation link is clicked, instead of opening the attached file (here, the Evince icon SVG), the error messages (evince:9550): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (evince:9550): EvinceView-WARNING **: Failed to create a temporary file: No such file or directory are shown instead. After recompiling Evince with debugging enabled, I was able to determine that the problem was occurring because of the embedded file's name. Note that the embedded file is contained within a subdirectory; apparently the attachfile2 package uses the whole relative path where the file is sourced from as the annotation's file name, so when Evince goes to create a temporary file, the file cannot be opened since the parent directory does not exist (so in this case, /tmp/attachment/icons.svg.XXXX can't be opended). The attached patch fixes this problem by first extracting the basename from the attachment's name before trying to generate a temporary file. Arguably, this issue should also be resolved in the attachfile2 (or {pdf,xe}latex engines), but Evince should still attempt to function given less than ideal inputs.
Created attachment 217969 [details] [review] Patch to fix temp file name problem
Review of attachment 217969 [details] [review]: Thanks!, I've just pushed it to git master.