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 633125 - pdfmod crashes when trying save to read-only file
pdfmod crashes when trying save to read-only file
Status: RESOLVED FIXED
Product: pdfmod
Classification: Other
Component: general
0.8.x
Other Linux
: Normal normal
: ---
Assigned To: pdfmod-maint
pdfmod-maint
Depends on:
Blocks:
 
 
Reported: 2010-10-25 18:39 UTC by Nigel Stewart
Modified: 2010-10-25 19:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Nigel Stewart 2010-10-25 18:39:05 UTC
Seems that pdfmod ought to be more graceful about a .pdf what can't be written to.

$ chmod a-w 0.pdf 

$ pdfmod 0.pdf 
[Debug 13:37:30.525] Starting PdfMod
[Debug 13:37:30.533] Initializing i18n catalog from /usr/share/locale/
[Debug 13:37:30.621] Loaded custom AccelMap from /home/nstewart/.config/pdfmod/gtk_accel_map
[Debug 13:37:30.679] Cache directory set to /home/nstewart/.cache/pdfmod
Author           = snations
CreationDate     = 9/22/2008 6:21:13 PM
Creator          = PScript5.dll Version 5.2.2
Keywords         = 
ModificationDate = 9/22/2008 6:21:13 PM
Producer         = GPL Ghostscript 8.15
Subject          = 
Title            = Microsoft Word - license.doc
Page Layout      = SinglePage
Page Mode        = UseNone
SecurityLevel    = None
Settings.TrimMgns= PdfSharp.Pdf.TrimMargins
Version          = 14
# Outlines       = 0
NoCompression    = False

ViewPreferences:
CenterWindow     = False
Direction        = 
DisplayDocTitle  = False
FitWindow        = False
HideMenubar      = False
HideToolbar      = False
HideWindowUI     = False
[Debug 13:37:34.541] Saved tmp file to /home/nstewart/.cache/pdfmod/tmpfile-0
[Debug 13:37:35.348] Saved tmp file to /home/nstewart/.cache/pdfmod/tmpfile-0
[Debug 13:37:36.346] Saved tmp file to /home/nstewart/.cache/pdfmod/tmpfile-0
[Debug 13:37:36.923] Saved tmp file to /home/nstewart/.cache/pdfmod/tmpfile-0
Marshaling activate signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException: Access to the path "[...]/0.pdf" is denied.
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean isAsync, Boolean anonymous) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess)
  at PdfSharp.Pdf.PdfDocument.Save (System.String path) [0x00000] in <filename unknown>:0 
  at PdfMod.Pdf.Document.Save (System.String uri) [0x00000] in <filename unknown>:0 
  at PdfMod.Gui.Actions.OnSave (System.Object o, System.EventArgs args) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at PdfMod.Gui.Client..ctor(Boolean loadFiles)
   at PdfMod.PdfMod.Main(System.String[] args)
Cairo.Context: called from finalization thread, programmer is missing a call to Dispose
Comment 1 Gabriel Burt 2010-10-25 19:26:13 UTC
Thanks, fixed in master:

commit 1506ba800165896934033e008b8070414e6a9f34
Author: Gabriel Burt <gabriel.burt@gmail.com>
Date:   Mon Oct 25 14:25:10 2010

    Don't crash if unable to save (bgo#633125)