Closed Bug 197429 Opened 21 years ago Closed 21 years ago

clear disk cache broken on MacOS X

Categories

(Core :: Networking: Cache, defect, P1)

PowerPC
macOS
defect

Tracking

()

RESOLVED FIXED
mozilla1.4alpha

People

(Reporter: gordon, Assigned: gordon)

Details

Attachments

(1 file)

Clearing the disk cache is broken on Mac OS X, because after clearing, the
nsIFile object mCacheDirectory returns NS_ERROR_FILE_ALREADY_EXISTS when
attempting to create a new directory, but it returns NS_ERROR_FILE_NOT_FOUND
when attempting to print out the path name.

Weird.

I'll look into the implementation of nsLocalFileMac to see how we get into this
state, but I'll probably work around it in the disk cache by storing the cache
directory parent (instead?) and clone that to perform operations on, because the
parent directory won't change when we clear the cache.
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.4alpha
Attached patch proposed patch 1Splinter Review
The patch gets the parent directory before moving the cache directory, then
uses the parent directory to reset mCacheDirectory.  Seems to fix the problem
on Mac.
Comment on attachment 117282 [details] [diff] [review]
proposed patch 1

>Index: nsCache.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/netwerk/cache/src/nsCache.cpp,v
>retrieving revision 1.7
>diff -u -r1.7 nsCache.cpp
>--- nsCache.cpp	10 Mar 2003 23:19:02 -0000	1.7
>+++ nsCache.cpp	15 Mar 2003 01:01:49 -0000
>@@ -53,6 +53,8 @@
>     nsresult rv = item->GetNativePath(path);
>     if (NS_SUCCEEDED(rv)) {
>         PR_LOG(gCacheLog, level, (format, path.get()));
>+    } else {
>+        PR_LOG(gCacheLog, level, ("GetNativePath faile: %x", rv));

should be "failed", right?

>Index: nsDiskCacheDevice.cpp
>===================================================================
>RCS file: /cvsroot/mozilla/netwerk/cache/src/nsDiskCacheDevice.cpp,v
>retrieving revision 1.83
>diff -u -r1.83 nsDiskCacheDevice.cpp
>--- nsDiskCacheDevice.cpp	10 Mar 2003 23:19:04 -0000	1.83
>+++ nsDiskCacheDevice.cpp	15 Mar 2003 01:01:49 -0000
>@@ -1058,8 +1066,11 @@
>     nsresult rv;
>     
>     rv = mCacheDirectory->Create(nsIFile::DIRECTORY_TYPE, 0777);
>-    if (NS_FAILED(rv)) return rv;
>-    
>+    CACHE_LOG_PATH(PR_LOG_ALWAYS, "\ncreate cache directory: %s\n", mCacheDirectory);
>+    CACHE_LOG_ALWAYS(("mCacheDirectory->Create() = %x\n", rv));
>+    if (NS_FAILED(rv)) {
>+        return rv;
>+    }

Please use a consistent style for this; every other place in the file has the
|if| and |return| on one line.

r=bryner with those changes.
Attachment #117282 - Flags: review+
Comment on attachment 117282 [details] [diff] [review]
proposed patch 1

sr=sfraser with bryner's comments addressed.
Attachment #117282 - Flags: superreview+
Patch (with suggested corrections) checked in.  Marking FIXED.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: