Bug 194481 - [Archive] Save Conflict After Renaming a File that is Open
Summary: [Archive] Save Conflict After Renaming a File that is Open
Status: CLOSED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Xuan Chen CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 194463
  Show dependency tree
 
Reported: 2007-06-26 14:56 EDT by Kevin Doyle CLA
Modified: 2009-06-17 13:23 EDT (History)
2 users (show)

See Also:


Attachments
fix for this problem. (6.68 KB, patch)
2008-01-07 17:03 EST, Xuan Chen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Doyle CLA 2007-06-26 14:56:29 EDT
If I rename a file from an archive that is open and make changes to the file then save I get the Save Conflict Dialog.  If I do this on a normal Local file I do not get the Save Conflict Dialog, so I would expect the same behavior for Archive's.

Steps to Reproduce: 
1. Create the archive dummy.zip on Local.
2. Create the file text.txt inside it.
3. Open text.txt.
4. Rename text.txt.
5. Make a change to text.txt in the editor and press Save.
--> Save Conflict Dialog Appears

-----------Enter bugs above this line-----------
TM 2.0RC4 Testing
installation : eclipse-SDK-3.3RC4
RSE install  : RSE 2.0 RC4
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-06-28 09:39:26 EDT
Xuan - you've been most exposed to archives recently, can you debug this?
Comment 2 Xuan Chen CLA 2007-06-28 17:39:43 EDT
Sure.
Comment 3 Xuan Chen CLA 2008-01-02 12:02:48 EST
If you rename a regular file, you could see its last modified time will not change. (you could try it in the command line as well).

But that is not the case for virtual file processing.  If user wants to rename a virtual file, under cover, we recreate a new archive file with the virtual file name changed to the new name, and then replace the old archive file with the new one.  So the last modify time of this new archive file as well as all its virtual files are different from the old ones.

So in the case described in this bug (save after rename for a virtual file), the following checking in SystemUniversalTempFileListener#upload():

******************************************************************************
try
{
	// get the remote modified timestamp
	long remoteModifiedStamp = remoteFile.getLastModified();

	boolean remoteFileDeleted = !remoteFile.exists();
	// compare timestamps
	if (remoteFileDeleted || (storedModifiedStamp == remoteModifiedStamp))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	{
		// timestamps are the same, so the remote file hasn't changed since our last download
		try
		{

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

failed.  So the Save Conflict diaglog will be putup.

It is a limitation for the way we process renaming of a virtual file.
I will mark it as WONTFIX.
Comment 4 Martin Oberhuber CLA 2008-01-03 05:46:28 EST
I cannot follow your argument: Even if the timestamp of the archive is changed, the timestamps of the virtual files inside the archive should not change.

Assume zipping up some software which all expects to have timestamp 01-01-2008. Then adding one more file later on. The timestamp of the archive would change, but the virtual files inside the archive are all unchanged so their timestamps should not change.

If our archive handlers don't work that way, I would think it's a bug.
Comment 5 Xuan Chen CLA 2008-01-03 12:25:14 EST
I just checked the local connection case.  If I rename/paste/delete a virtual file, the "Last Modified Time" of archive file as well as all it virtual files/folders are all changed.

I will open a different bug to keep track of the problem.
Comment 6 Xuan Chen CLA 2008-01-07 16:44:23 EST
bug 214251 has been opened, and used to deal with save conflict problem for local.
I will use this bug to fix problem exists on the dstore side.
Comment 7 Xuan Chen CLA 2008-01-07 17:03:30 EST
Created attachment 86353 [details]
fix for this problem.

Fix includes:

Make sure the GetRemoteObject command could be applied to file/folder object.
It used to only apply to filter object.

Change UniversalFileSystemMiner#handleQueryGetRemoteObject() so that it could deal with virtual file/folder properly.

I also use this bug to remove a couple println() statements from CopyThread and DeleteThread.
Comment 8 Xuan Chen CLA 2008-01-07 17:04:46 EST
I've committed the fix to cvs.
Comment 9 Xuan Chen CLA 2009-06-17 13:23:35 EDT
Close since it is fixed.