After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679354 - Evince fails to create temporary file when opening embedded PDF annotation attachment [PATCH INCLUDED]
Evince fails to create temporary file when opening embedded PDF annotation at...
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-03 21:27 UTC by Justin Willmert
Modified: 2012-07-04 09:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Minimal working example PDF and source (47.07 KB, application/x-gzip)
2012-07-03 21:27 UTC, Justin Willmert
  Details
Patch to fix temp file name problem (979 bytes, patch)
2012-07-03 21:28 UTC, Justin Willmert
committed Details | Review

Description Justin Willmert 2012-07-03 21:27:07 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.
Comment 1 Justin Willmert 2012-07-03 21:28:29 UTC
Created attachment 217969 [details] [review]
Patch to fix temp file name problem
Comment 2 Carlos Garcia Campos 2012-07-04 09:36:23 UTC
Review of attachment 217969 [details] [review]:

Thanks!, I've just pushed it to git master.