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 191445

Summary: "File modified dialogue" when saving on SMB shares
Product: platform Reporter: nimmret
Component: Data SystemsAssignee: Jaroslav Havlin <jhavlin>
Status: REOPENED ---    
Severity: normal CC: pjiricka
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: overwrite dialog
reload dialog

Description nimmret 2010-10-28 18:43:07 UTC
Hello

When I map an SMB share to a local drive, and create a project (from existing files) in that location, whenever I save a file (not the first time, all other), it pops up with a "File was modified externally. Overwrite it?"

Could it be windows newlines (\r\n) beeing translated to linux newlines (\n), or perhaps file meta data changes. 

My workstation is Wintendo, but the share is on a debian linux box, with samba 3.2.5-4lenny13. Let me know if you need more info or need me to fiddle with some samba changes and I'd happily oblige.

I have tested with the same files, on a SSH mapped drive instead, and that dosn't have the problem
Comment 1 jasonfonseca 2010-11-25 02:01:00 UTC
I have the same problem, however my versions are as follows:

Netbeans 6.9.1
Win 7
Samba version 3.5.4
Ubuntu 10 desktop edition

I suspected something to do with the file modification times, like perhaps the server time was wrong. I synced them up as good as I could and still no luck.

Any ideas on this?

I've resorted to using http://www.expandrive.com/windows 
On a side note expandrive makes my file browsing much quicker in netbeans
Comment 2 starnixsa 2010-12-23 13:46:47 UTC
Hi all,

I had the same problem since Netbeans 6.9.1 and I am currently running the development version (201012150001). 

I decided to change my mount options by adding nobrl (No Byte Range Lock; man mount.cifs) to /etc/fstab about three hours ago. Since I've added that option, I haven't received any messages about external changes and I can also undo more than once. If I agreed to reload the file after saving, I was unable to use my undo history and I had to resort to Team > Local History to restore portions of my code.

Here is the full mount entry for those who are unsure, but please adjust for your working environment:
//server_ip/share_path     	/media/share_name      	cifs    credentials=/path/to/credentials,nounix,nobrl,iocharset=utf8,gid={your_gid},uid={your_uid},file_mode=0644,dir_mode=0755       0       0

I hope that helps :)
Comment 3 winsik 2011-02-02 08:58:50 UTC
I have exactly same problem on Ubuntu 10.10 when using mounted SMB disks running on actual Centos distribution. I was trying to modify fstab in many ways, but without any success. Is there any solution or workarround to turn the modification dialog off befor the issue will be fixed?
Comment 4 Ondrej Brejla 2012-04-13 07:09:39 UTC
More than a year from last comment. Reporters, please, can you test it in the latest dev build [1]? If the problem still occurs, don't hesitate to reopen this issue. Thanks a lot!

[1] http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 5 flunch 2013-04-22 08:18:41 UTC
I still have this bug.
The weird thing is that i'm having this bug on some projects but not on others even though they are all on the same smb share ...
Comment 6 flunch 2013-04-25 13:20:28 UTC
After more tests the problem does not seem depend on my projects, but on the length of the filename.

Any file with less than 12 caracters (including extension) will have this annoying popup :
For example : abc.php, abcde.php, ... abcdefg.php
(Interesting to note that if i REALLY do modify thoose files with another editor, they will update silently in netbeans if changes were saved, and alert if not)

But abcdefgh.php or abcdefg.phps will never have this alert (unless file was modified and opened version has unsaved changes)

Even stranger, sometimes files with more than 12 characters had this alert, and by just renaming them once the bug disappeared forever on thoose files ...
Comment 7 Ondrej Brejla 2014-01-29 10:26:14 UTC
Can you confirm that it happens in other files too? I mean e.g. .html files, .js files and such. Imho it will not be a problem only of .php files.

And, please, test it in 7.4 or better in 8.0 dev [1], thanks.

[1] http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 8 davole 2014-02-10 16:14:37 UTC
Hi all,

Yes, I can confirm that this occurs in other files than .php too (.java, .css, .js). However, right now I was not able to reproduce it with .html files.

# NetBeans details
Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)       

# Project setup
NetBeans (netbeans64.exe) runs on Windows 7 Ultimate 64 bit, SP1
Development server runs on debian 7.3
SMB share as network drive
Git versioning of project folder
nbproject is in project folder

# Troubles
When working on a network drive NetBeans comes up with one of the following option dialogues:
1. When trying to save a file: "File X:\path\to\file.ext was modified externally. Overwrite it?". This pops up especially if the interval between a previous save and the latest one is quite short. (attachment 1 [details])
2. When switching back to a file which was previously modified but not saved: "File X:\path\to\file.ext was modified externally. Reload it?". This does not happen always. (attachment 2 [details])

Obviously this would be correct, if somebody else were modifying the files at the same time. But this is not the case. While (1) results only in an additional click/keystroke, (2) alters the code, setting it back to an old state. When (2) occurs, it is not possible to use the undo/redo buttons any more and all the modifications are lost (no entry in file-history).

It makes no difference if the share is on a virtual or a physical machine.

Note: working on local files does not trigger these pop-ups.

# Workarounds
One workaround is to disable the real-time protection of Microsoft's Security Essentials. However, this is not an acceptable solution for me. Setting up an exception for netbeans.exe and/or netbeans64.exe and/or the share(s) does not have the same effect. Same goes for NetBeans's User directory and/or Cache directory.

Cheers,
David
Comment 9 davole 2014-02-10 16:17:05 UTC
Created attachment 144995 [details]
overwrite dialog
Comment 10 davole 2014-02-10 16:17:26 UTC
Created attachment 144996 [details]
reload dialog
Comment 11 davole 2014-02-10 16:18:21 UTC
Sorry for the doublepost, here are the attachments
Comment 12 Ondrej Brejla 2014-02-10 16:47:33 UTC
Since it's not PHP specific, then reassigning. Not sure about right component.
Comment 13 davole 2014-02-15 07:03:23 UTC
Good morning

Would it be possible to keep us posted on what's going on? I understand the problem has been reassigned twice since Ondrej and moved around twice in means of component. Anything new on this matter?

All the best
David
Comment 14 Jaroslav Havlin 2014-02-17 10:18:35 UTC
(In reply to davole from comment #13)
> [...] Anything new on this matter?
Hello David,
I'm sorry, I cannot reproduce the bug (with NetBeans 7.4 on Windows 7, Samba server 3.6.3 in virtual XUbuntu 12.04).
But I guess the problem is caused by inconsistent last modification time of saved files.

Please check your smb.conf (might be located in /etc/samba), is any of the following options enabled?

time service, dos filetimes, fake directory create times, dos filetime resolution, delete readonly

Thank you.
Comment 15 davole 2014-02-24 20:00:39 UTC
Hi Jaroslav,

I have none of you options enabled. This is the smb.conf I use on my production server:

[global]
workgroup = WORKGROUP
server string = %h server (Samba %v)
log file = /var/log/samba/log.%m
max log size = 1000
security = user
encrypt passwords = true
invalid users = root
socket options = TCP_NODELAY
unix extensions = no

[www]
comment = www directory
writable = yes
path = /var/www
public = no
valid users = @smbusers
force create mode = 0770
force directory mode = 0770
follow symlinks = yes
wide links = yes

I hope this helps.

Cheers
David
Comment 16 Jaroslav Havlin 2014-02-27 06:23:58 UTC
I'm sorry, I have no more ideas.
I'll try to reproduce the bug in a real network, not only with samba server in a virtual machine.
Thank you for help.
Comment 17 davole 2014-02-28 11:16:03 UTC
Have you considered it to be a problem caused by the combination of NB and Microsoft Security Essentials? As I wrote in my first post on this bug, when turning off the real-time protection the problems disappear.

Now I can only assume, but would it be possible that MSE changes an attribute after a file is checked and NB is not able to recognize that the contents of the file remained the same but things the whole file was modified?

Obviously this is just a wild guess - but maybe it is something that simple...

Cheers,
David
Comment 18 Jaroslav Havlin 2014-04-04 07:26:56 UTC
(In reply to davole from comment #17)
> Have you considered it to be a problem caused by the combination of NB and
> Microsoft Security Essentials?
It might be that case. Unfortunately, I haven't been able to reproduce this scenario yet.

> As I wrote in my first post on this bug, when
> turning off the real-time protection the problems disappear.
Can you disable MSE check for the folder with your NetBeans projects, as a workaround?

Have you tried some other text editors? Do they detect the files as modified as well?


> Now I can only assume, but would it be possible that MSE changes an
> attribute after a file is checked and NB is not able to recognize that the
> contents of the file remained the same but things the whole file was
> modified?
Maybe. This fix would be trivial (compare file contents), but it could affect performance, so we should be careful.

By the way, this issue is quite similar to bug 240382 (NTFS for Mac).
Comment 19 davole 2014-04-30 20:21:52 UTC
> Can you disable MSE check for the folder with your NetBeans projects, as a workaround?
I've tried to exclude the entire parent folder, the containing folder and even the file itself from MSE, but it doesn't change anything.

> Have you tried some other text editors? Do they detect the files as modified as well?
I've tried to reproduce similar behavior with Sublime and N++, however those two did not behave unexpectedly, meaning that I wasn't able to reproduce the problem.

I had the sensation that now, with NB8 it would be solved, but recently it started again without any significant changes on the server.

> By the way, this issue is quite similar to bug 240382 (NTFS for Mac).
Yes, seems like this is exactly the same issue.
Comment 20 davole 2014-04-30 21:12:56 UTC
Ok guys, this thing was driving me nuts so I dug and tried again. I figured it had something to do with the time, and MSE was only covering this up. So I tried using the same ntp server on all my machines, broadcasting the time from one machine to all the other ones in my LAN but nothing changed.

Eventually I came to read this (dos filetime resolution - https://www.samba.org/samba/docs/using_samba/ch11.html) which sounded good, because I thought there shouldn't be a time discrepancy between server and machine of >= 1 second. Apparently this works (for now), preventing these annoying pop-ups.

I am currently using NetBeans IDE 8.0 (Build 201403101706) but I think this should help with NB < 8 too.
Comment 21 jakimfett 2014-05-23 21:59:23 UTC
Oi, jakimfett here. Long time Netbeans user, been running into this problem on and off for a year or three, and just today finally got annoyed enough with it to try and fix it.

I'm running Netbeans 8.0 on linux (specifically Elementary OS Luna, an Ubuntu 12.04 variant), and the files are hosted on CentOS v5.10 via SMB. If davole@netbeans.org is still watching this, I'm pretty sure that rules out any chance of it being MSE in any way, shape, or form.

The problem only shows up occasionally for me. I don't have any files that it *always* happens on, but I also don't seem to have any files that it *never* happens on. Normally it happens if I make several edits (saving between each) in fairly quick succession, eg every 5-10 seconds. I notice it more when I'm testing small changes, like css or HTML formatting.

Here's my /etc/fstab line:
//server/sharename /media/mountpoint cifs uid=1000,credentials=/home/username/.smbcredentials,iocharset=utf8,sec=ntlm   0       0

I've added the "nounix,nobrl,file_mode=0644,dir_mode=0755" options as recommended by starnixsa, so far I haven't had the popup again, but it's only been 10ish minutes since I remounted my remote directory.
Comment 22 jakimfett 2014-05-23 22:17:09 UTC
(In reply to jakimfett from comment #21)
> Oi, jakimfett here. Long time Netbeans user, been running into this problem
> on and off for a year or three, and just today finally got annoyed enough
> with it to try and fix it.
> 
> I'm running Netbeans 8.0 on linux (specifically Elementary OS Luna, an
> Ubuntu 12.04 variant), and the files are hosted on CentOS v5.10 via SMB. If
> davole@netbeans.org is still watching this, I'm pretty sure that rules out
> any chance of it being MSE in any way, shape, or form.
> 
> The problem only shows up occasionally for me. I don't have any files that
> it *always* happens on, but I also don't seem to have any files that it
> *never* happens on. Normally it happens if I make several edits (saving
> between each) in fairly quick succession, eg every 5-10 seconds. I notice it
> more when I'm testing small changes, like css or HTML formatting.
> 
> Here's my /etc/fstab line:
> //server/sharename /media/mountpoint cifs
> uid=1000,credentials=/home/username/.smbcredentials,iocharset=utf8,sec=ntlm 
> 0       0
> 
> I've added the "nounix,nobrl,file_mode=0644,dir_mode=0755" options as
> recommended by starnixsa, so far I haven't had the popup again, but it's
> only been 10ish minutes since I remounted my remote directory.

UPDATE: Just happened again, so those fstab options did *not* work.