Closed
Bug 192425
Opened 22 years ago
Closed 21 years ago
prefs.js corrupted in case of disk quota exceeded
Categories
(Core :: Preferences: Backend, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: manuel.segura, Assigned: ccarlen)
References
(Depends on 1 open bug)
Details
(Keywords: dataloss, qawanted)
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2.1) Gecko/20021130 Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2.1) Gecko/20021130 I use mozilla in a school, and very often, when students exceed disk quota, when they stop mozilla, mozilla want to write the file prefs.js. As there is no more space left on disk, the file prefs.js is corrupted. Reproducible: Always Steps to Reproduce: 1. Already explained before 2. 3. Actual Results: prefs.js is corrupted, and so the user mozilla profile does not work. Expected Results: Could Mozilla test before writing the "prefs.js" file is there is sufficient free disk space ? Perhaps with a function like "stat" ? If there is no disk space, it is better to not write any thing in prefs.js. I have 10 students a week, over 450, which come to me to search help about this problem. Very anoying... Perhaps the problem exist also when you try to write a mail and the is not disk space ?
Comment 1•22 years ago
|
||
To prefs backend....
Assignee: asa → bnesse
Status: UNCONFIRMED → NEW
Component: Browser-General → Preferences: Backend
Ever confirmed: true
QA Contact: asa → sairuh
Comment 3•22 years ago
|
||
->ccarlen, just to live somewhere where someone may look at it
Assignee: bnesse → ccarlen
Assignee | ||
Comment 4•22 years ago
|
||
When saving anything, the data should be written to a temp file and then, only when that's known to have succeeded, exchanged that with the actual file. That prevents this kind of mishap. Isn't that what the prefs "safe save" feature is supposed to do?
Updated•22 years ago
|
Blocks: profile-corrupt
Updated•21 years ago
|
Comment 5•21 years ago
|
||
How many places in Mozilla fail to use atomic rename of a tmp file that was successfully written? Conrad, to whom was your question in comment #4 addressed? Any answers? /be
Comment 6•21 years ago
|
||
Well, Conrad, others and I commented on that point in bug 170539, comment 67, 68, 69, 75... ("prefs.js gets wiped - all mail/news accounts settings lost", another different prefs.js bug fixed by Conrad recently). If I'm not wrong, as a summary of what I said there, nsPrefService::WritePrefFile, using the class nsSafeSaveFile, makes a backup (or tries to), then overwrites the preferences file and then, if something went wrong, tries to restore the lost file from backup: http://lxr.mozilla.org/seamonkey/source/modules/libpref/src/nsPrefService.cpp#349 Differently, for instance the successful fix for the bookmarks bug 86501 ("bookmarks truncated when disk full", fixed by Ben Goodger) does not delete the original file until there is a new correct temporary file ready to substitute it (by renaming). It's simple, but surely safer (for low memory situations, etc.). http://lxr.mozilla.org/mozilla/source/xpfe/components/bookmarks/src/nsBookmarksService.cpp#5078 http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp#5078 From CVS Blame: "Fix for bug 86501 - bookmarks.html file is truncated to 0-length when shutting down with a full profile disk. Write bookmarks to a temporary file, and rename that to 'bookmarks.html' only if the write operation succeeded."
Updated•21 years ago
|
Flags: blocking1.3? → blocking1.3-
Comment 7•21 years ago
|
||
*** Bug 196862 has been marked as a duplicate of this bug. ***
Updated•21 years ago
|
Flags: blocking1.4b?
Updated•21 years ago
|
Flags: blocking1.4b?
Flags: blocking1.4b-
Flags: blocking1.4?
*** Bug 190136 has been marked as a duplicate of this bug. ***
Updated•21 years ago
|
Blocks: bookmark-loss
Comment 9•21 years ago
|
||
only trying to add myself to the CC but it won't let me do it unless I removed the "requested" from blocking 1.4, because blocking 1.4 is disabled.... I'll file a bug against Bugzilla on that shortly
Flags: blocking1.4?
Updated•21 years ago
|
Flags: blocking1.6?
Updated•21 years ago
|
Flags: blocking1.6? → blocking1.6-
Comment 10•21 years ago
|
||
*** Bug 232206 has been marked as a duplicate of this bug. ***
Comment 11•21 years ago
|
||
IMHO the bug lies in line 166: http://lxr.mozilla.org/seamonkey/source/modules/libpref/src/nsSafeSaveFile.cpp#166 165 // and finally, copy the file (preserves file permissions) 166 rv = mBackupFile->CopyToNative(parentDir, fileName); change to 166 rv = mBackupFile->MoveToNative(parentDir, fileName); is a partial fix (IMHO sufficient), adding [166.5 rv = mBackupFile->CopyToNative(originalbackupdir, filenameofbackup);] [require more IMHO useless logic, since this isn't stricte necessary] where it should be MoveToNative and afterwards CopyToNative in the opposite direction - move is guaranteed to succeed (well... almost guaranteed) while restoring a backup by creating a new copy will likely fail (especially if the extra space which was freed has just been used up by something else in the meantime (bg download), or the user was past allowed disk usage in the first space (ie starting position of usage>limit instead of more normal usage==limit - happens if the entire disk is filled and only root-reserved space is left). I didn't spend much time (3 min) - but this seems like the problem to me. Nb the entire class seems to suck, making safe saves is such a simple problem, and there is so much code for it... weird. SafeSave("/path/to/file.ext") { UnSafeSave("/path/to/file.ext~") -> failure delete the ~ file and return with error * Move("/path/to/file.ext" to "/path/to/file.ext~~") -> failure means permission error most likely - return with error (file not moved) Move("/path/to/file.ext~" to "/path/to/file.ext") -> failure means permission error most likely - return with error after reversing the previous move * Remove("/path/to/file.ext~~") } Of course on most normal filesystems the two lines marked with '*' aren't necessary at all (and are indeed more likely to harm than help...) I'd vote for omiting them (if a file system screws up on a move(a,b) with neither a nor b being in the destination after an error condition then the filesystem sux anyways).
Comment 12•21 years ago
|
||
*** Bug 204485 has been marked as a duplicate of this bug. ***
Updated•21 years ago
|
Flags: blocking1.7a+
Comment 13•21 years ago
|
||
the patch for bug 132517 (which just got checked in) should help with this bug as well.
Depends on: 132517
Comment 14•21 years ago
|
||
let's mark fixed so this one gets on the testing radar, then reopen or create a new bug for remaining problems
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•