Save over a read only file doesn't turn into Save As...

Bug #353847 reported by LucaDC
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
theAdib
inkscape (Debian)
Fix Released
Unknown

Bug Description

If you open a read only file, modify it and hit the "Save" button or select File->Save, in the status bar the message "Document saved." appears for a while (you must know and look there to notice)... But the file hasn't been saved!
You know that the save failed only when you close and reopen the file, finding that all your work has been simply discarded (> /dev/null)!!!

Normally, a "Save As..." dialog should appear, to notify the saving was not possible and ask for a different name. Or at least a message dialog informing that the operation was NOT succesful (now the opposite happens).

Windows XP SP3, SVN 21033.

Thanks.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

Happens on Fedora 10 too!

Inkscape spits out this message:

** (inkscape:7602): WARNING **: There was an error saving the file.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

BTW, the least we should do IMO is show a pop-up! Such an error should never go unnoticed!

Revision history for this message
Alvin Penner (apenner) wrote :

yes, there is also a similar, but not exactly identical bug that affects Python exports to a read-only file, Bug 309856

Revision history for this message
jazzynico (jazzynico) wrote :

Confirmed on Ubuntu 9.04, Inkscape rev.21851.
Works well with 0.46.
Tested with SVG file only.

Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.47
tags: added: regression saving
Revision history for this message
theAdib (theadib) wrote :

fix commited in svn revision 21953. pls test. Adib.

Changed in inkscape:
status: Confirmed → Fix Committed
assignee: nobody → theAdib (theadib)
Revision history for this message
su_v (suv-lp) wrote :

@theAdib - does your fix also help with bug #407115 “Cannot open file after saving on full USB stick”?

Revision history for this message
theAdib (theadib) wrote :

I have tried only on a readonly dxf file. Let me investigate ...

Revision history for this message
theAdib (theadib) wrote :

attached an other patch that tries to check if the file exists and is writable and then presents a specific message "the file is write protected. Please remove write protection".
please give a hint if you think that might be useful.
Adib.

Revision history for this message
su_v (suv-lp) wrote :

Thank you for your efforts - will rebuild from updated SVN (21960) tomorrow and try the patch… Gute Nacht, ~suv

Revision history for this message
su_v (suv-lp) wrote :

patch failed to compile:

io/sys.cpp: In function ‘bool Inkscape::IO::file_is_writable(const char*)’:
io/sys.cpp:294: error: ‘__S_IWRITE’ was not declared in this scope
make[2]: *** [io/sys.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Revision history for this message
su_v (suv-lp) wrote :
Download full text (3.3 KiB)

forgot to add: patch failed to compile on OS X 10.5.7 with Inkscape source SVN rev. 21973 + patch

LeWitt:inkscape suv$ g++ --version
i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LeWitt:inkscape suv$ patch -p0 --backup < is_writeprotected.patch
patching file src/extension/output.h
patching file src/extension/system.cpp
patching file src/file.cpp
patching file src/io/sys.cpp
patching file src/io/sys.h
LeWitt:inkscape suv$

failed in:
depbase=`echo io/sys.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
 ccache g++ -DHAVE_CONFIG_H -I. -I.. -I/Volumes/blue/mp/include/freetype2 -I/Volumes/blue/mp/include -D_REENTRANT -DORBIT2=1 -I/Volumes/blue/mp/include/gnome-vfs-2.0 -I/Volumes/blue/mp/lib/gnome-vfs-2.0/include -I/Volumes/blue/mp/include/gconf/2 -I/Volumes/blue/mp/include/orbit-2.0 -I/Volumes/blue/mp/include/dbus-1.0 -I/Volumes/blue/mp/lib/dbus-1.0/include -I/Volumes/blue/mp/include/glib-2.0 -I/Volumes/blue/mp/lib/glib-2.0/include -I/Volumes/blue/mp/include -I/Volumes/blue/mp/include/libwpg-0.1 -I/Volumes/blue/mp/include/libwpd-0.8 -I/Volumes/blue/mp/include -I/Volumes/blue/mp/include -I/Volumes/blue/mp/include/poppler -I/Volumes/blue/mp/include/poppler/glib -I/Volumes/blue/mp/include/poppler -I/Volumes/blue/mp/include/gtk-2.0 -I/Volumes/blue/mp/lib/gtk-2.0/include -I/Volumes/blue/mp/include/cairo -I/Volumes/blue/mp/include/glib-2.0 -I/Volumes/blue/mp/lib/glib-2.0/include -I/Volumes/blue/mp/include -I/Volumes/blue/mp/include/pango-1.0 -I/Volumes/blue/mp/include/pixman-1 -I/Volumes/blue/mp/include/freetype2 -I/Volumes/blue/mp/include/libpng12 -DPOTRACE=\"potrace\" -D_REENTRANT -I/Volumes/blue/mp/include/gdkmm-2.4 -I/Volumes/blue/mp/lib/gdkmm-2.4/include -I/Volumes/blue/mp/include/glibmm-2.4 -I/Volumes/blue/mp/lib/glibmm-2.4/include -I/Volumes/blue/mp/include/pangomm-1.4 -I/Volumes/blue/mp/include/gtk-2.0 -I/Volumes/blue/mp/lib/gtk-2.0/include -I/Volumes/blue/mp/include/cairomm-1.0 -I/Volumes/blue/mp/include/sigc++-2.0 -I/Volumes/blue/mp/lib/sigc++-2.0/include -I/Volumes/blue/mp/include/glib-2.0 -I/Volumes/blue/mp/lib/glib-2.0/include -I/Volumes/blue/mp/include -I/Volumes/blue/mp/include/pango-1.0 -I/Volumes/blue/mp/include/cairo -I/Volumes/blue/mp/include/pixman-1 -I/Volumes/blue/mp/include/freetype2 -I/Volumes/blue/mp/include/libpng12 -I/Volumes/blue/mp/include/giomm-2.4 -I/Volumes/blue/mp/lib/giomm-2.4/include -I/Volumes/blue/mp/include/gtkmm-2.4 -I/Volumes/blue/mp/lib/gtkmm-2.4/include -I/Volumes/blue/mp/include/atkmm-1.6 -I/Volumes/blue/mp/include/atk-1.0 -I/Volumes/blue/mp/include/libxml2 -I../cxxtest -I./bind/javainc -I./bind/javainc/linux -Wall -Wformat -Wformat-security -W -D_FORTIFY_SOURCE=2 -I/Volumes/blue/mp/include -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch -Wno-unused-parameter -O3 -Wall -MT io/sys.o -MD -MP -MF $depbase.Tpo -c -o io/sys.o io/sys.cpp &&\
 mv -f $depbase.Tpo $depbase.Po
io/sys.cpp: In function ‘bool Inkscape::IO::file_is_writable(const char*)’:
io/sys.cpp...

Read more...

Revision history for this message
theAdib (theadib) wrote :

~suv, is this still failing to compile on your side? Adib.

Revision history for this message
su_v (suv-lp) wrote :

No, I reverted to the then current svn revision after the compile failed and have not tried since. I assumed that the error

  io/sys.cpp: In function ‘bool Inkscape::IO::file_is_writable(const char*)’:
  io/sys.cpp:294: error: ‘__S_IWRITE’ was not declared in this scope
  make[2]: *** [io/sys.o] Error 1

was related to different header files on your (Windows ?) system that include a declaration for ‘__S_IWRITE’, and didn't investigate further - I don't know C or C++, so it is difficult for me to figure out why it failed without any guidance from an expert ;-)
Has anything changed in the source that prevents this compile error now?

Revision history for this message
theAdib (theadib) wrote :

put Inprogress because the patch is not applied into the subversion codebasis. Adib.

Changed in inkscape:
status: Fix Committed → In Progress
Revision history for this message
theAdib (theadib) wrote :

removing the underlines before S_IWRITE compiles fine on win32 and Linux (ubuntu 9.04).
The new patch is against trunk and has not the underlines.
pls test compilation for osx.

Adib.

Revision history for this message
theAdib (theadib) wrote :

removing the underlines before S_IWRITE compiles fine on win32 and Linux (ubuntu 9.04).
The new patch is against trunk and has not the underlines.
pls test compilation for osx.

Adib.

Revision history for this message
su_v (suv-lp) wrote :

Patch applied to SVN r22240, compiled without errors and works as expected on OS X 10.5.8:
1) open read-only file
2) modify and save
-> error dialog warns about write-protected file.

thanks, Adib!

Revision history for this message
ScislaC (scislac) wrote :

Thank you so much Adib! Committed in 22241.

Changed in inkscape:
status: In Progress → Fix Released
Changed in inkscape (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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