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 328266 - "save a copy" deletes files
"save a copy" deletes files
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
0.5.x
Other All
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-23 08:46 UTC by gvlatyshev
Modified: 2007-01-13 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Confirm before overwriting file, in GTK+ >= 2.8.0 (683 bytes, patch)
2006-02-17 00:03 UTC, Gary Coady
committed Details | Review

Description gvlatyshev 2006-01-23 08:46:56 UTC
evince-0.5.0-1
Using poppler 0.5.0 (splash)

---
- "save a copy" overwrites files without confirmation

1. open file1.pdf
2. press ctrl-s, navigate to file2, select file2, press "save"
---

---
- deleting file by saving it

[lg@~]$ mkdir test
[lg@~]$ cp doc/jacs004020.pdf test/
[lg@~]$ cd test
[lg@test]$ ls -l  
total 632
-rw-rw-r--  1 lg lg 642911 Jan 22 22:29 jacs004020.pdf
[lg@test]$ evince jacs004020.pdf 

1. press ctrl-s, select test/jacs004020.pdf, press "save"

[lg@test]$ ls -l
total 0
-rw-rw-r--  1 lg lg 0 Jan 22 22:31 jacs004020.pdf
---

---
-deleting the file by saving to symlink

[lg@test]$ cp ../doc/jacs004020.pdf .
[lg@test]$ ln -s jacs004020.pdf j.pdf
[lg@test]$ ls -l
total 632
lrwxrwxrwx  1 lg lg     14 Jan 22 22:36 j.pdf -> jacs004020.pdf
-rw-rw-r--  1 lg lg 642911 Jan 22 22:36 jacs004020.pdf
[lg@test]$ evince jacs004020.pdf 

1. press ctrl-s, select j.pdf, press "save"

[lg@test]$ ls -l
total 0
lrwxrwxrwx  1 lg lg 14 Jan 22 22:36 j.pdf -> jacs004020.pdf
-rw-rw-r--  1 lg lg  0 Jan 22 22:37 jacs004020.pdf

you probably want to overwrite symlink, not a file
---
Comment 1 Nickolay V. Shmyrev 2006-01-25 22:27:02 UTC
We need new api to make FileChooser automatically check this.
Comment 2 Gary Coady 2006-02-17 00:03:13 UTC
Created attachment 59542 [details] [review]
Confirm before overwriting file, in GTK+ >= 2.8.0

I'm not sure if this is correct coding style - there are no other checks on GTK_MAJOR_VERSION and GTK_MINOR_VERSION in the code.
If this is unacceptable, then I'm sure this could go in once the minimum GTK version supported is 2.8 or newer.
Comment 3 Nickolay V. Shmyrev 2006-02-18 09:49:44 UTC
I've applied a bit modified patch to HEAD, thanks a lot.
Comment 4 gvlatyshev 2006-03-24 09:36:34 UTC
evince-0.5.2 poppler-0.5.1 gtk2-2.8.10

-deleting file by saving it
-deleting the file by saving to symlink
are still valid. If i overwrite opened file (or symlink to this file) the file will be deleted.
Comment 5 Nickolay V. Shmyrev 2006-04-29 11:38:04 UTC
I am not sure what comment #4 is about, aren't we asking for confimation? If so, why do you wonder that file is deleted if you've confirmed this delete?
Comment 6 Pat Rondon 2006-06-10 05:31:42 UTC
What he means is that if you open "~/blah.pdf" and then save a copy of it to the same location (i.e., "~/blah.pdf"), the file is truncated to 0 bytes.

Comment 7 Nickolay V. Shmyrev 2006-06-10 05:42:36 UTC
Ah, that is. Probably we need change the way we are saving a copy then.
Comment 8 Carlos Garcia Campos 2007-01-13 13:21:08 UTC
I've changed Save a copy to do it in atomic way, so that we also avoid race conditions. It should be fixed in svn trunk now.