Closed
Bug 68255
Opened 24 years ago
Closed 24 years ago
download leaves behind a temp file
Categories
(SeaMonkey :: UI Design, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.8.1
People
(Reporter: colin, Assigned: colin)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
If I download a file then while its downloading I can see that there are two
versions of the temp file:
NKH2N056.GZ;2
NKH2N056.GZ;1
After the download has completed the temp file is renamed to whatever name I
chose for it, but version 1 of the file is left orphaned. We should really
tidy up that file somehow.
I believe the "problem" is here:
http://lxr.mozilla.org/seamonkey/source/uriloader/exthandler/nsExternalHelperApp
Service.cpp#758
The line of code is:
rv = fileChannel->Init(mTempFile, -1, 0);
The -1 is the ioFlags and later on -1 gets turned into
PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE
Since we have just created (and closed) the unique file, the PR_TRUNCATE is
superfluous on this call. Trouble is that O_TRUNC on open() on OpenVMS means
"create a new version of the file".
I think I can fix the problem for OpenVMS and not break anyone else by changing
the line to:
rv = fileChannel->Init(mTempFile, PR_WRONLY | PR_CREATE_FILE, 0);
I'll do some testing and see what gives.
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•24 years ago
|
||
Yep, that does fix the problem. Now I need to see how to get this checked in.
sspitzer and ducarroz know the file, and mscott seems to be the owner.
Component: Browser-General → XP Apps
QA Contact: doronr → sairuh
Assignee | ||
Comment 4•24 years ago
|
||
Looking for some reviews. Seth and mscott, could you folks r and sr
respectively?
Thanks, Colin.
Comment 5•24 years ago
|
||
looks good, but have you tested this patch any other platforms?
Assignee | ||
Comment 6•24 years ago
|
||
Unfortunately I don't have any other build platforms available. So the answer's
no.
Comment 7•24 years ago
|
||
I'll try linux for you, mscott can you do win32?
Comment 8•24 years ago
|
||
rebuilding and testing now. after linux, I can try mac also.
while I do that, you might want to scour the tree looking for other cases where
we pass in -1.
Comment 9•24 years ago
|
||
linux seems to work fine. I'm able to download files and save them no problem.
rebuild mac now. r=sspitzer, but mscott's review is the one that matters.
Assignee | ||
Comment 10•24 years ago
|
||
I found another couple of -1 instances in the tree, but I think these are OK.
This one was really only a problem because we create the file, close it, and
then open it (with O_TRUNC) before we write to it. Its that sequence which
causes an extra version of the file to be created on OpenVMS.
Comment 11•24 years ago
|
||
mac seems fine too. on both platforms, I can download and save images.
Assignee | ||
Comment 12•24 years ago
|
||
mscott: looking for an a= if you please.
Comment 13•24 years ago
|
||
sr=mscott
Assignee | ||
Comment 14•24 years ago
|
||
Just realised that I never did attach the patch. I'll do that now. But it is
just that one liner. Honest!
Assignee | ||
Comment 15•24 years ago
|
||
Assignee | ||
Comment 16•24 years ago
|
||
I need to re-do this patch and re-test since DougT's big necko changes altered
the very line my patch is changing. I'm on vacation starting tomorrow and so
won't be able to get to this until the beginning of March.
Assignee | ||
Comment 17•24 years ago
|
||
Thanks to Doug's rewrite the download file is only opened once now, and so this
problem has gone away. Thanks Doug!
Marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 18•24 years ago
|
||
Damn. I just downloaded a file and got two versions of the temp file. This
is with a 2001030613 build. Maybe I only got one version when I tried it before
because the file had finished downloading before I dismissed the "save as" box?
Anyway, I'm re-opening and will debug again.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 19•24 years ago
|
||
Assignee | ||
Comment 20•24 years ago
|
||
The new patch (above) is basically the same as the previous one. The temp file
is created and immediately closed by a call to nsLocalFile::CreateUnique which
goes out of its way to create (and not just open) the file. Therefore when we
later open the file to actually write to it, we do not need PR_TRUNCATE since we
KNOW the file is empty.
Looking for r=sspitzer and sr=mscott again.
Assignee | ||
Comment 21•24 years ago
|
||
Changing milestone to 0.81. I'd really like to get this fix in. My patch was
approved before, I just need to get the revised patch (because the code
changed from under me) approved and I'll check it in.
Target Milestone: --- → mozilla0.8.1
Comment 22•24 years ago
|
||
sr=mscott
Comment 23•24 years ago
|
||
r=sspitzer
Assignee | ||
Comment 24•24 years ago
|
||
Checked in. revision 1.55. Just made it in to M0.81.
Status: REOPENED → RESOLVED
Closed: 24 years ago → 24 years ago
Resolution: --- → FIXED
Comment 25•23 years ago
|
||
vrfy using 2001.05.29.0x comm bits on linux, winnt and mac...
Status: RESOLVED → VERIFIED
Updated•20 years ago
|
Product: Core → Mozilla Application Suite
You need to log in
before you can comment on or make changes to this bug.
Description
•