This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 229024 - Newer local files get overwritten with older server files without warning when downloaded from server if local files are Saved
Summary: Newer local files get overwritten with older server files without warning whe...
Status: REOPENED
Alias: None
Product: php
Classification: Unclassified
Component: FTP Support (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-25 16:09 UTC by spamfilter
Modified: 2013-05-22 14:31 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description spamfilter 2013-04-25 16:09:21 UTC
If I download a file from the Server, make changes to it, and then try to download the file from the Server again PRIOR to saving the local file, NetBeans will prompt me if I want to replace the unsaved file with the content from the Server, at which point I can decide whether to overwrite the changes or not.

However, if I download a file from the Server, make changes to it, SAVE IT, and then try to download the file again from the Server, NetBeans will NOT prompt me and will just replace the saved but NEWER file with the OLDER Server file.

Surely this must be a bug and not intended to work this way, as I have lost a lot of work accidentally downloading a file from the Server after making changes to it and saving it.  A simple warning to confirm the replacement like you get when you do not save the file would suffice to resolve this bug, and seem simple enough.
Comment 1 Tomas Mysik 2013-05-21 09:41:00 UTC
It works as expected - NetBeans behaves like any other FTP client. If you want to synchronize your files, use Remote Synchronization (right click your project and choose Synchronize...).

Thanks for reporting.
Comment 2 spamfilter 2013-05-21 14:59:18 UTC
Thanks for addressing this important issue, Tomas.

However, you are incorrect.  NetBeans does NOT behave like "any other FTP client". 

When you attempt to download a file from the remote server that already exists on a local folder using "any other" FTP Client, it PROMPTS you if you wish to overwrite it:

See FileZilla FTP screenshot:

http://i.imgur.com/QdNyDP1.png

See FireFTP (Firefox) screenshot:

http://i.imgur.com/n0uSpwW.png


This is such a common behavior of FTP Clients, that even Dreamweaver (which pales in comparison to NetBeans in all other aspects) prompts you if you attempt to overwrite a local file with one from the remove server:

http://i.imgur.com/375FNRn.png


In fact, the *only* client that does NOT prompt you when attempting to overwrite a local file with one from the remove server is NetBeans.  It just callously overwrites whatever you were working on, with no regards to how many hours you spent editing it.  So clearly, NetBeans is the ugly duckling with respect to this issue.

Since you have closed this issue as "RESOLVED INVALID" using incorrect reasons, I am re-opening it so that it gets properly addressed as a serious defect that causes a lot of work to get easily and accidentally overwritten, and is thus a major flaw.
Comment 3 Tomas Mysik 2013-05-21 15:32:16 UTC
OK, however it really works as designed from the very beginning therefore changing to enhancement.

Thanks for reporting.
Comment 4 spamfilter 2013-05-21 16:07:45 UTC
Thanks for re-considering this issue, Tomas.  I appreciate it.

However, I must disagree with your labelling of this issue as an "enhancement" rather than a "defect".

The fact that NetBeans *does* prompt you if you wish to overwrite a non-saved file means that NetBeans *does* have this feature built-in, and that therefore the process of overwriting saved files is defective.

You can see the built-in functionality here:

http://i.imgur.com/ZsBzW73.png


So this isn't a "new feature" or "enhancement" that needs to be added since it's already there.  The process of downloading an existing-but-saved file from the server simply needs to match the process of downloading an existing-but-unsaved file.

The fact that they do not match means that the former is defective, by definition.

Do you disagree?
Comment 5 Tomas Mysik 2013-05-22 07:23:31 UTC
Unfortunately, I cannot agree since the workflow works as designed - btw for NB 6.5 so it is a long time ago. If we now _suddenly_ change the workflow (add a confirmation dialog(s) (for each file? or just one?)), we will get a lot of usability issues from our users. Please notice that you are the first one complaining about this.

The dialog you are talking about is there _only_ to avoid loss of _unsaved_ changes.

But feel free to suggest any improvement to the current workflow and we will be more than happy to implement it (if most of our users will benefit from it, of course).

Thanks.
Comment 6 spamfilter 2013-05-22 13:40:50 UTC
Thanks for your additional comments on this issue.

I don't see how adding a simple confirmation prompt when downloading files is so complicated, especially considering the feature is already built-in for unsaved files, and that every other FTP Client does it.  

In fact, this seems to have been proposed before (https://ui.netbeans.org/docs/ui/php/phpremotefiletransfer-ui-spec.html#Download) more than 4 years ago:

"Finally, the user chooses how to handle overwriting files on the local file system. Three choices are given: "Overwrite without asking"; "Ask for each file"; and "Do not overwrite files". The user's selection will be shown as selected the next time the dialog is opened."


Something similar to what I'm suggesting was also proposed in this thread (http://forums.netbeans.org/ptopic32767.html) which you participated in more than 3 years ago:

"Data loss due to overwriting local changes can be avoided by netbeans keeping track of each file's edit status/date (which it already does to some degree?) and behaving intelligently at the small number of potential scenarios (prompt before overwrite, offer use of merge utility, etc.)"

So I'm clearly *not* the only one thinking about this serious issue.

Also, since I still haven't convinced you that this issue is a serious defect and a major design flaw, let me use an actual example of something that has happened to me on more than one occasion to illustrate just how dangerous this defect is.

Imagine you are ready to work on a file, so you download the most recent version from the Server.

You work on the file for several hours, adding thousands of lines of code, and saving locally every 10 minutes to ensure you do not lose any work.

Five hours and thousands of lines of code later, you are done, and are ready to upload the file to the Server.

So you right-click the file under "Projects", and go to click on "Upload...", but without realizing, you *accidentally* click on "Download..." because it is RIGHT NEXT to "Upload...":

http://i.imgur.com/QprJtlQ.png


Then, all of a sudden, and without prompting you or asking you, NetBeans downloads the original version of the file from the Server and overwrites 5 hours worth of worth and thousands of lines of code that are *impossible* to recover at this point.  You realize what just happened, so you pick up your monitor and you throw it in the trash while cursing NetBeans' name and clenching your fist in the air.

So how can something so final, so detrimental, so DANGEROUS, that not only does NOT prompt you to confirm the deadly action, but that is also placed RIGHT NEXT to its innocent sister, not be considered a design flaw or defect?

Please explain in light of the above.
Comment 7 Tomas Mysik 2013-05-22 14:31:03 UTC
(In reply to comment #6)
> Thanks for your additional comments on this issue.

You are welcome, of course. Let me thank you for your patience and perfect comments.

> I don't see how adding a simple confirmation prompt when downloading files is
> so complicated, especially considering the feature is already built-in for
> unsaved files, and that every other FTP Client does it.  

I did not say "it is complicated"; I said that it works as designed. Please notice, that no dialog appears only for *one* file download or upload. If you select more files or a directory, a dialog appears. This is result of issue #142954 (implemented for NB 7.0, 3 years ago).

> In fact, this seems to have been proposed before
> (https://ui.netbeans.org/docs/ui/php/phpremotefiletransfer-ui-spec.html#Download)
> more than 4 years ago:

It is only a draft, it has never been finished (and implemented).

> "Data loss due to overwriting local changes can be avoided by netbeans keeping
> track of each file's edit status/date (which it already does to some degree?)
> and behaving intelligently at the small number of potential scenarios (prompt
> before overwrite, offer use of merge utility, etc.)"

Something like this is implemented for the Remote Synchronization (the "Synchronize... action"). It is not easy and even possible to track timestamps of all remote files and compare them with the local ones.

> So I'm clearly *not* the only one thinking about this serious issue.

OK, not the only one but definitely not many issues have been reported till today therefore we guess that the current behaviour is fine for most of our users.

> Then, all of a sudden, and without prompting you or asking you, NetBeans
> downloads the original version of the file from the Server and overwrites 5
> hours worth of worth and thousands of lines of code that are *impossible* to
> recover at this point.

Not true, you have a Local History (button "History" in the top of the editor) so you can easily "revert" your file.

So, I am perfectly OK with improving the current behaviour (as I was in issue #142954) - so, please, tell me how the current behaviour could be improved so the current workflow is still possible (so the current users who do not complain can continue using it).

For one file download/upload, maybe we could show a dialog saying that the remote file seems [1] to be older than the local one - what do you think? Not sure what we could do if one selects a directory or a whole project...

Thanks for reporting.
[1] Also please notice that timestamp checking is not reliable (FTP often returns wrong timestamps).