Closed Bug 20773 Opened 25 years ago Closed 25 years ago

If a file already exists in the target location, filecopy script fails. Error -201 returned, Install Failed.

Categories

(Core Graveyard :: Installer: XPInstall Engine, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: depman1, Assigned: ssu0262)

Details

builds 1999120208-M12 and 1999120308-M12. reproduced on Win98.
1. Make sure you have smrtupdt.txt file located on your C:\..\Program\chrome
directory. My dir = C:\Program Files\Netscape\Seamonkey\chrome. Alternatively,
2. Go to XPInstall test page: http://jimbob/trigger2.html.
3. From the dropdown menu, select a_fileop_filecopy.
4. Press Trigger case. OK.
5. Check target directory.
Result 1: smrtupdt.txt time stamp is not updated. old copy (i.e. 12/3/99 5:07).
6. Check logfile.
Result 2: (logfile contents):

http://jimbob/jars/a_fileop_filecopy.xpi     --     12/03/1999 17:09:19
---------------------------------------------------------------------------

     Acceptance: a_fileop_filecopy
     -----------------------------

     ** AddSubcomponent returns = 0
     ** FileCopy returns = 0
     Item [1/2]	Installing: C:\Program Files\Netscape\Seamonkey\smrtupdt.txt

     Install **FAILED** with error -201

     Install **FAILED** with error -201
     Finished Installation  12/03/1999 17:09:21

Expected: Installation should succeed. No errors reported and smrtupdt.txt
should copy to target directory w/ updated timestamp.

******************************************************************************

Here is contents of filecopy script:

////////////////////////////////////////////////////////////////////////////////
////////
// a_fileop_filecopy.js
//
// Acceptance test
// 	• Checks the ability to copy a known file to a known directory
// 	• A file, smrtupdt.txt, is installed under the "Program" directory
// 	• smrtupdt.txt is copied to /chrome
//
// ~ XPInstall QA
//   October 4, 1999
////////////////////////////////////////////////////////////////////////////////
//////////

var jarSrc = "smrtupdt.txt"

Install.StartInstall("Acceptance: a_fileop_filecopy", "acceptance", "1.1.1.1",
0);
f = Install.GetFolder("Program");
g = Install.GetFolder("Chrome");
err1 = Install.AddSubcomponent("fileop_filecopy", jarSrc, f, jarSrc);
Install.LogComment("AddSubcomponent returns = " + err1);

fileSource = f + "/smrtupdt.txt";
fileTarget = g;
err2 = Install.FileCopy(fileSource, fileTarget);
Install.LogComment("FileCopy returns = " + err2);

if (0 == Install.GetLastError())
	Install.FinalizeInstall();
else
	Install.AbortInstall();
Assignee: cathleen → ssu
Target Milestone: M13
Note that this test case by itself is bogus, and I have seen several that make
the same mistake. This test adds a file and then uses it without calling
FinalizeInstall() in between! The initial file is NOT INSTALLED until it is
finalized!!! (our tempname generation happens to put the file under the final
name if it doesn't already exist, but that's an implementation detail that may
change, and is wrong anyway in my opinion.)

I am not saying the bug found here is not real, there probably is a copy bug,
but this test case would only find it on the second time it is run.

Assigning to Sean. If it turns out to be a nsFileSpec problem pass it along to
Doug.
Summary: If a file already exists in the target location, filecopy doesn't work. Error -201 returned, Install Failed. → If a file already exists in the target location, filecopy (and filemove) script fails. Error -201 returned, Install Failed.
Same thing happens for filemove...I originally found this after running the test
a 2nd time, and wanted to edit the bug steps. Placing a file in target location
was just a quick way to reproduce the problem, but I see your point. I'll only
put the legit steps in from now on!

Also, change "Expected" above to: Install script should succeed with no errors.
(if file is already in target location, maybe better that it's not overwritten).
Whoa -- please write a separate bug for FileMove. On many systems you cannot do
a "move" to an already occupied location so this might be expected behavior.
For "copy" this is clearly a bug.
Status: NEW → ASSIGNED
Summary: If a file already exists in the target location, filecopy (and filemove) script fails. Error -201 returned, Install Failed. → If a file already exists in the target location, filecopy script fails. Error -201 returned, Install Failed.
submitted 21085 for filemove case.
Bulk move of XPInstall (component to be deleted) bugs to Installer: XPInstall
Engine
Blocks: 21564
Target Milestone: M13 → M15
Post beta
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
fixed.
Changing QA Contact to David.
QA Contact: jimmylee → depstein
verified
Status: RESOLVED → VERIFIED
No longer blocks: 21564
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.