Bug 68399

Summary: No check for print file names given by the rename dialog
Product: [Unmaintained] kdeprint Reporter: Friedrich W. H. Kossebau <kossebau>
Component: generalAssignee: Michael Goffioul <kdeprint_bugs>
Status: CLOSED DUPLICATE    
Severity: grave CC: jlayt
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: This works for me.

Description Friedrich W. H. Kossebau 2003-11-17 00:24:45 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Problem: 
There is no check whether the filename returned from RenameDlg is 
already existing when "Rename" was selected.

Reproduce:
1. Create some files in your home dir: 
 $ touch print.ps; touch print_1.ps; touch print_2.ps
2. Open a file in Kate and reach for the printing dialog
3. Select "print to file": default is ~/print.ps
4. Click "Ok"
5. Smart printer dialog detects there already is such a file 
   and calls for the RenameDlg.
6. Click "Suggest" button and get a new name proposed: "print_1.ps"
7. Click "Rename" which is now activated.
8. Lucky you. Get your existing "print_1.ps" overwritten, without any warning.
Comment 1 Friedrich W. H. Kossebau 2003-11-17 00:28:26 UTC
Created attachment 3252 [details]
This works for me.
Comment 2 Friedrich W. H. Kossebau 2003-11-29 23:00:47 UTC
Due, this works for me was meant for the patch.

And as there is a possible loss of data (overwritten files) the bug should be marked grave surely.

Please, anyone to review that really simple patch?
Comment 3 Stephan Binner 2004-02-13 21:45:30 UTC
The patch looks fine. Why didn't you apply it already?
Comment 4 Friedrich W. H. Kossebau 2004-02-14 12:05:26 UTC
Because I felt unsure if I understood the code around correctly. I sent the 
patch to kde-devel (okay, should perhaps have been kde-core-devel) and 
kde-print for review but got no reaction. So I put it here to rest until 
finally someone comes along. 

What should have I done else? :)

Comment 5 Michael Goffioul 2004-02-16 10:36:25 UTC

*** This bug has been marked as a duplicate of 59796 ***
Comment 6 Michael Goffioul 2004-02-16 10:36:31 UTC
The patch is OK, however a more generic solution has been implemented
at KIO::RenameDlg level (see revision 1.71 of kdelibs/kio/kio/renamedlg.cpp).
This should solve the problem. I'll close the bug.

(sorry for not taking your previous posts into consideration, I
remember it but it looks like I lost it and unfortunately forgot
about it)

Michael.

> ------- Additional Comments From friedrich w h kossebau de  
> 2004-02-14 12:05 -------
> Because I felt unsure if I understood the code around 
> correctly. I sent the 
> patch to kde-devel (okay, should perhaps have been 
> kde-core-devel) and 
> kde-print for review but got no reaction. So I put it here to 
> rest until 
> finally someone comes along. 
> 
> What should have I done else? :)
> 

Comment 7 Friedrich W. H. Kossebau 2004-02-16 12:45:43 UTC
> ------- Additional Comments From goffioul imec be  2004-02-16 10:36 -------
> The patch is OK, however a more generic solution has been implemented
> at KIO::RenameDlg level (see revision 1.71 of
> kdelibs/kio/kio/renamedlg.cpp). This should solve the problem. I'll close
> the bug.

The fix at KIO::RenameDlg level fixes only half of the problem. Change my 
example to a manually inserted new name. This one should be checked for 
existance, too, until "Overwrite" was explicitly choosen.

So IMO the patch still should be applied. And pleased backported.

Friedrich

Comment 8 Michael Goffioul 2004-02-16 13:02:54 UTC
Then please commit it, if possible.

Michael.

> The fix at KIO::RenameDlg level fixes only half of the 
> problem. Change my 
> example to a manually inserted new name. This one should be 
> checked for 
> existance, too, until "Overwrite" was explicitly choosen.
> 
> So IMO the patch still should be applied. And pleased backported.
> 
> Friedrich
> 

Comment 9 Friedrich W. H. Kossebau 2004-02-16 15:34:58 UTC
> ------- Additional Comments From goffioul imec be  2004-02-16 13:02 -------
> Then please commit it, if possible.

Sorry, could you or someone else do it, my cvs copy is broken ATM and a 
recompile takes a day on my 233 MHz computer (and is not planned for the next 
few weeks, due to exams) :/ 

Friedrich

PS: And after having once again a look at the code of 
KPrintDialog::checkOutputFile() I think that most of this functionality 
should be in KIO itself anyway (and needs a way to prevent file name race 
conditions). But I haven't the time to care for.

Comment 10 John Layt 2008-12-31 13:23:50 UTC
Closing old Resolved status bug.