Closed
Bug 164190
Opened 22 years ago
Closed 22 years ago
nsSafeSaveFile mistreats nsLocalFile, deleting files under one.
Categories
(Core :: Preferences: Backend, defect)
Core
Preferences: Backend
Tracking
()
RESOLVED
FIXED
People
(Reporter: sfraser_bugs, Assigned: bnesse)
Details
Attachments
(2 files, 1 obsolete file)
1.05 KB,
patch
|
jesup
:
review+
|
Details | Diff | Splinter Review |
570 bytes,
patch
|
hewitt
:
review+
brendan
:
superreview+
|
Details | Diff | Splinter Review |
nsSafeSaveFile has this pattern (mTarget and mBackup are both nsILocalFiles). Pseudocode: mTarget->Clone(&mBackup); mBackup->Remove(); // bye bye mBackup->GetParent(); // whoops This hoses the Mac OS X nsLocalFileImpl, which is a separate issue (bug 164189). It's easy to fix, and makes more sense this way too: mTarget->Clone(&mBackup); mBackup->Remove(); // bye bye mTarget->GetParent(); // ok
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
Reporter | ||
Updated•22 years ago
|
Attachment #96410 -
Attachment is obsolete: true
Comment 3•22 years ago
|
||
Comment on attachment 96412 [details] [diff] [review] Better patch: just pass nsnull as the parent sr=alecf
Attachment #96412 -
Flags: superreview+
Comment 4•22 years ago
|
||
Comment on attachment 96412 [details] [diff] [review] Better patch: just pass nsnull as the parent r=ccarlen
Attachment #96412 -
Flags: review+
Assignee | ||
Comment 5•22 years ago
|
||
Checked in sfrasers patch.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 6•22 years ago
|
||
Had to back this out. It turned the "brad" and "Btek" linux Tinderboxen orange.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 7•22 years ago
|
||
This patch might cause dataloss. I did a CVS pull & compile yesterday and now my prefs.js AND prefs.bak files keep getting deleted - this backed-out patch looks a likely candidate ;-)
Assignee | ||
Comment 8•22 years ago
|
||
This patch caused bug 164345. From that bug: >nsSafeSaveFile::CreateBackup() calls CopyToNative with a 1st parameter of >nsnull. That's "newParent" in io/nsLocalFileUnix.cpp's CopyToNative(), and >there's no check for a null newParent before using it. >Win32 (nsLocalFileWin.cpp) ends up checking for/handling a null newParent. So it seems that Win and Mac handle this case, but Unix does not.
Comment 9•22 years ago
|
||
Please go back to the original (simpler) patch which does not have this bug...
Comment 10•22 years ago
|
||
Comment on attachment 96410 [details] [diff] [review] nsSafeSaveFile patch; use mTargetFile to get the parent, not mBackupFile un-obsoleting; r=rjesup@wgate.com
Attachment #96410 -
Attachment is obsolete: false
Attachment #96410 -
Flags: review+
Comment 11•22 years ago
|
||
Comment on attachment 96412 [details] [diff] [review] Better patch: just pass nsnull as the parent obsoleting nsnull version of the patch. If you want to go back to using this version, the bug in file IO will need to be fixed first.
Attachment #96412 -
Attachment is obsolete: true
Comment 12•22 years ago
|
||
The cause of this problem, bug 165561, is checked in. Passing nsnull as the parent to copyToNative now works on Unix. I think the original patch could go back in now.
Assignee | ||
Comment 13•22 years ago
|
||
As per Conrad's comment, landed patch again.
Status: REOPENED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
Comment 14•22 years ago
|
||
With my cvs build on windows from 5PM today, I'm seeing prefs.js being deleted on shutdown.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 15•22 years ago
|
||
Me too, on the Phoenix tinderbox. This is bad. Does windows LocalFile implementation not handle this case?
Comment 16•22 years ago
|
||
I think the problem is that in the windows implementation of CopyToNative (which calls CopyMove), we incorrectly decide that a null parent means we should always rename instead of copy. Oops.
Comment 17•22 years ago
|
||
patch coming up for what I think is the underlying LocalFileWin problem.
Comment 18•22 years ago
|
||
Comment 19•22 years ago
|
||
Comment on attachment 100078 [details] [diff] [review] LocalFileWin patch r/sr=brendan@mozilla.org /be
Attachment #100078 -
Flags: superreview+
Comment 20•22 years ago
|
||
Comment on attachment 100078 [details] [diff] [review] LocalFileWin patch r=hewitt
Attachment #100078 -
Flags: review+
Comment 21•22 years ago
|
||
patch checked in, reclosing.
Status: REOPENED → RESOLVED
Closed: 22 years ago → 22 years ago
Resolution: --- → FIXED
Comment 22•22 years ago
|
||
Argh. This broke OS/2. We are a port of nsLocalFileWin.
Comment 23•22 years ago
|
||
OS/2 bug 170638: should it be duped to this and this reopened?
Comment 24•22 years ago
|
||
OS/2 fix is already in - same as nsLocalFileWin fix. We should be done here.
You need to log in
before you can comment on or make changes to this bug.
Description
•