Bug 188991 - Netbeans will overwrite a newer file on a remove server
Netbeans will overwrite a newer file on a remove server
Status: NEW
Product: php
Classification: Unclassified
Component: FTP Support
8.2
All All
: P3 with 13 votes (vote)
: TBD
Assigned To: issues@php
issues@php
:
: 245899 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-27 14:09 UTC by darkestfright
Modified: 2017-07-02 18:03 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description darkestfright 2010-07-27 14:09:04 UTC
If I am working on a php site created using the 'sources on remote server' option, by default the IDE is set to automatically upload any files that I make changes to on save.

If I am working on a file (the IDE uses the local version which was downloaded last), and another person makes a change to the remote file directly on the server.  When I save my local copy, netbeans will overwrite the changes that my coworker has done to the remote files without any warning or indication.

I have been forced to use a totally inferior (and non-open source) IDE for PHP development, because Netbeans does not first check to make sure it is overwriting the file safely.  The IDE I use now, before uploading the file to the server on save, checks to make sure that the file on the server is not newer than when I first downloaded it.  If it is, then a warning is issued and I can choose not to upload the file.  I can then diff the file, and merge them appropriately.

I believe adding the same functionality to Netbeans would be trivial and possible to push in the *.1 update coming in a few months.
Comment 1 Filip Zamboj 2010-09-15 12:37:55 UTC
batch reassigning
Comment 2 blainpurtle 2012-07-03 04:10:59 UTC
I would like to +1 this issue.  Consider this scenario:

I use NetBeans to modify files on a remote development server because I do not have a PHP environment setup on my client computer.

On the remote development server, I am using SVN for this project.

In NetBeans, I open index.php, make modifications, save it..all is well.

Then, "Frank" makes changes to index.php, checks it in to SVN.

I then do a svn update on the remote server to receive his changes.

Back to NetBeans, I open index.php, make changes, and save.
At THIS point, NetBeans did not check the server to make sure it had the most recent copy of index.php, nor did it check to make sure index.php on the remote server was newer before saving.

I would go ahead and check in my changes.

Bam, all of Franks changes are gone since I overwrote an updated copy of index.php on the remote server, and then checked it in. No svn merge issues, no warnings, nothing.  Everything, according to SVN is in order.

I would consider this issue a bug and not an enhancement.
Comment 3 Tomas Mysik 2012-07-03 05:28:37 UTC
(In reply to comment #2)
> I would consider this issue a bug and not an enhancement.

Sorry, definitely not. You are mixing SCM and ordinary (S)FTP client - sorry, this is definitely incorrect. Try to use any other (S)FTP client - will it prevent any file overwriting? I doubt...

Anyway, in NB 7.2 (RC1 available right now), there is Remote Synchronization [1] available.

Thanks.
[1] https://blogs.oracle.com/netbeansphp/entry/new_ui_for_remote_synchronization
Comment 4 blainpurtle 2012-07-11 16:08:16 UTC
That's great news about 7.2.  I really appreciate that.

"Try to use any other (S)FTP client - will it
prevent any file overwriting? I doubt..."

You're comparing apples to oranges. I'm not talking about the SFTP client built into NetBeans, I'm talking about NetBeans the IDE/File Editor. Okay, let's do the same thing with another SFTP client (Transmit) and a simple text editor (BBEdit).

Let's skip to this step in my previous explanation:

#########
I then do a svn update on the remote server to receive his changes.

Back to N̶e̶t̶B̶e̶a̶n̶s̶ Transmit, I open index.php (In BBedit), make changes, and save.
#########

At that time I "OPEN" the file using my SFTP client, it pulls a new copy.  

So, yes, my scenario works great with any SFTP client, but that's not what I was complaining about.  I was complaining about the fact that, even if I close the File/Project/Application in NetBeans, and re-open a file that was modified on the remote file system, it does not pull in the new file.  THAT is a a bug.
Comment 5 Tomas Mysik 2012-07-12 04:05:57 UTC
(In reply to comment #4)
> That's great news about 7.2.  I really appreciate that.

Thanks.

> You're comparing apples to oranges.

I don't think so.

> #########
> I then do a svn update on the remote server to receive his changes.
> 
> Back to N̶e̶t̶B̶e̶a̶n̶s̶ Transmit, I open index.php (In BBedit), make changes,
> and save.
> #########
> 
> At that time I "OPEN" the file using my SFTP client, it pulls a new copy.

Since you are opening the _remote_ version/copy of the file, right? This cannot be done in NetBeans. In NetBeans, one _always_ works with _local_ versions/copies which can be eventually uploaded to a server. In other words, NetBeans _never_ edits any file "directly" on a server.
Comment 6 blainpurtle 2012-07-30 18:52:14 UTC
(In reply to comment #5)

> Since you are opening the _remote_ version/copy of the file, right? This cannot
> be done in NetBeans. In NetBeans, one _always_ works with _local_
> versions/copies which can be eventually uploaded to a server. In other words,
> NetBeans _never_ edits any file "directly" on a server.

Right, and that is the problem.  That local copy can quickly and easily become stale.  Other IDE's (eclipse) that deal with remote files check for changes on the remote file system to a file before opening for editing to prevent this.

It seems that NetBeans will periodically synchronize the files in a project..if only it would synchronize the file you are attempting to open, THAT would be a great fix.
Comment 7 Tomas Mysik 2012-07-31 07:48:04 UTC
(In reply to comment #6)
> Other IDE's (eclipse) that deal with remote files check for changes on
> the remote file system to a file before opening for editing to prevent this.

The difference is that NetBeans does not deal with _remote_ files but only with _local_ files, always. Currently, we do not have any support to edit remote files directly, sorry.
Comment 8 blainpurtle 2012-07-31 13:43:55 UTC
(In reply to comment #7)

> The difference is that NetBeans does not deal with _remote_ files but only with
> _local_ files, always. Currently, we do not have any support to edit remote
> files directly, sorry.

Okay, I'm tired of arguing. This will be my last comment:

NetBeans DOES in fact "deal with _remote_ files" hence:
Choose Project
->Categories: PHP
->PHP Application from Remote Server

NetBeans will then download REMOTE FILES. When you save a change to the LOCAL cache, it automatically updates the REMOTE FILE (possibly overwritting newer files on the remote file system). NetBeans is creating a new feature to BETTER their support with "_remote_ files".

It's not perfect, but it's better.
Comment 9 petre 2012-09-20 21:01:11 UTC
Aptana, Fillezila and other FTP/SFTP clients are doing this: alert me when I am about to overwrite some changes in some files. Even better, Aptana downloads the file from FTP when I open it.
Comment 10 inv 2012-12-07 14:14:46 UTC
+1
You should fix it.
Comment 11 DrScheme 2013-01-03 08:07:34 UTC
I think the save on upload check box should at least have a little warning on it stating it will overwrite files on the server without checking for modifications. I think what could address the problem we have been having would be a "synchronize on save" feature...
Comment 12 DrScheme 2013-01-03 08:12:04 UTC
More options would be:
-Have an option to create a .tmp file somewheres locally when overwriting a file server. With the .tmp file being the contents of what was on the server at the time of being overridden.
-Is it possible to include server file versions in the local history when overwriting?
Comment 13 ignitedfirestarter 2013-04-22 14:41:21 UTC
Actually, we could use the current behaviour to facilitate this. Here's what happens now:

STOR file.new
File receive OK.
RNFR file.new
RNTO file
Failure
DELE file.old
No such file
RNFR file
RNTO file.old
Rename successful.
RNFR file.new
RNTO file
Rename successful.
DELE file.old
File delete OK.
QUIT
Goodbye

Instead:

RNFR file
RNTO ~file

STOR file

QUIT
Goodbye

Or similar.

I appreciate that checking modified time on each file save would be quite slow, so a middle ground must be achieved. Personally, I would prefer to see files downloaded and placed in the local history, but upload on save is slow enough as it is, let's not add a download before upload on save!

The only way I've found around this problem is to use an sshfs mount and dev via that - it's quicker than upload on save (even with a remote server) but refreshing source indexes takes forever.
Comment 14 slavenin 2013-09-18 07:36:59 UTC
+1
auto-update from the remote server is a very useful feature!!!
Comment 15 dsikora 2013-11-21 14:50:57 UTC
I have similar problem. Update the file on demand, before open it in the IDE is better than periodic synchronization. Of course this feature can lead to another error, when this file is modified by another user in the same time. In this case before saving the  file on FTP, should be check that this file has not modified between last update. Both functions could be set independently in the project settings.

Sometime I have many files which I never open. Synchronization these files isn't  make sense, until there is no need.

I vote +1 for this feature.
Comment 16 Vladimir Riha 2014-07-23 06:28:56 UTC
*** Bug 245899 has been marked as a duplicate of this bug. ***
Comment 17 gutto 2015-06-26 09:32:26 UTC
+1 for remote fetch on file open or sync on particular file save (anything that prevents from blindly overwriting remote changes)
Comment 18 lerayrd 2016-01-26 10:18:26 UTC
+1, must-have feature
Comment 19 Bringer 2016-01-26 10:25:20 UTC
+1, have wasted weeks full of work on total atleast
Comment 20 TheYurry 2016-05-10 15:11:35 UTC
+1 if You went full on on this, check for changes, prompt maybe bring up diff screen , or just make a backup file, it would tahek You 6 hours and save us sometimes days of work. as of now I can't use netbeans on group projects...
Comment 21 markuszeller 2016-07-01 15:08:20 UTC
+1 this is a MUST HAVE! Other IDEs like PHPStorm do that, too. It is so dangerous corruption remote code.

At least there is no option to just sync only the changed files since last sync!
Comment 22 pertiago 2016-08-21 08:34:28 UTC
+1 

It is clear that if tmysik@netbeans.org is denying the obvious, arguing with no point , and nobody has done anything about this issue in 6 years, it means nobody cares anymore.
That bug or feature (i don't mind how you call it) makes netbeans unusable in a real environment, even for a setup of just 2 developers (my case).
So it is a pity if netbeans , which used to be great dies because of these little things. 
So sorry I will have to uninstall it, I loved it.
Comment 23 Riesling 2016-11-07 08:57:32 UTC
+1 hoping for this feature every release
Comment 24 faisalsarfraz 2016-11-23 06:23:19 UTC
+1 for this issue, Crazy that it lacks this basic need
Comment 25 Tomas Mysik 2016-11-23 08:52:25 UTC
It works as designed so it cannot be a defect, sorry. Please, do not change it.

Thanks.
Comment 26 karex 2016-11-25 10:31:19 UTC
Correct me if I'm wrong, but that's why the issue type is "enhancement".

(A different interpretation: if it works as designed, the design is flawed.)
Comment 27 roman.demediuk 2017-06-21 10:21:51 UTC
Just happened again. It is not a bug, but it is definitely an inconvenience.

@Tomas Mysik, @karex@netbeans.org: Why not make Netbeans better?
Comment 28 Bringer 2017-06-21 10:34:28 UTC
+1
Comment 29 MartinJOsborne 2017-07-02 18:03:34 UTC
+1 As many people have said, it is completely insane that NetBeans lacks this very basic feature.  There should be an option that causes clicking on a file to get the file from the server, not from the local machine.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo