Patiencer / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

False file change notifcation on save to network/Samba share #343

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a file on a network share provided by a Linux server via Samba.
2. Change file and save.
3. Wait a few seconds.
4. A file change notification appears. But the file has only been changed
in PyScripter prior to saving and not externally. There should not be a
file change notification.

What version of the product are you using? On what operating system?
PyScripter 1.9.9.6. 

Please provide any additional information below.
* I am aware that this may be difficult reproduce. I have tested this with
two different Linux servers with completely different setups. The clocks on
all computers are synchronised to within a second. 
* I can confirm that this error is specific to PyScripter. The PsPad and
UltraEdit editors to not raise a file change notification under these
circumstances.
* I could well accept to have the file change notification disabled
altogether, but that does not seem to be possible.

Original issue reported on code.google.com by I....@ed.ac.uk on 20 Nov 2009 at 1:24

GoogleCodeExporter commented 9 years ago
I have provided a fix in Version Control.  Could you please check again when 
PyScripter version 2.2x is out.

Original comment by pyscripter on 4 Oct 2010 at 12:37

GoogleCodeExporter commented 9 years ago
I have briefly tested the fix in version 2.3.1.0, and it is much better now. 

However, when I first loaded a .py file located on a UNC network directory, I 
got a message box reporting an exception on every modification of the file, 
even without saving, but this has now disappeared and is thus not reproducible. 
I'll get back with more detailed info if this problem re-appears.

Thank you for fixing the notification issue!

Original comment by I....@ed.ac.uk on 19 Oct 2010 at 9:25

GoogleCodeExporter commented 9 years ago
I'm still experiencing this problem on PyScripter 2.3.3.0. I'm hosting the 
files on a Linux server running smbd 3.4.7.

Original comment by brezht...@gmail.com on 13 Nov 2010 at 3:55

GoogleCodeExporter commented 9 years ago
I am not sure how this can be.  Here is what PyScripter does.  It saves the 
file and records the File Last Modification time.  When a File Change 
Notification arrives (say after PyScripter saves the file), PyScripter checks 
again the File time.  If it is newer than the recorded time by some small 
margin it thinks that the file has been changed outside PyScripter.

The Windows documentation says that the file times from network servers may be 
approximate, so I have allowed for that but maybe the margin is not sufficient. 
 For some reason Samba servers may report the time inaccurately, but it beats 
me why on the same file asking for the File Last Modification time you would 
get substantially different answers.

Original comment by pyscripter on 13 Nov 2010 at 4:16

GoogleCodeExporter commented 9 years ago
Please have a look at 
http://oreilly.com/catalog/samba/chapter/book/ch08_01.html.

It appears that Visual Studio has similar problems and there is an option to 
deal with this.
*************************************************
8.1.1.3 dos filetimes

Traditionally, only the root user and the owner of a file can change its 
last-modified date on a Unix system. The share-level dos filetimes option 
allows the Samba server to mimic the characteristics of a DOS/Windows machine: 
any user can change the last modified date on a file in that share if he or she 
has write permission to it. In order to do this, Samba uses its root privileges 
to modify the timestamp on the file.

By default, this option is disabled. Setting this option to yes is often 
necessary to allow PC make programs to work properly. Without it, they cannot 
change the last-modified date themselves. This often results in the program 
thinking all files need recompiling when they really don't. 

8.1.1.4 dos filetime resolution

dos filetime resolution is share-level option. If set to yes, Samba will 
arrange to have the file times rounded to the closest two-second boundary. This 
option exists primarily to satisfy a quirk in Windows that prevents Visual C++ 
from correctly recognizing that a file has not changed. You can enable it as 
follows:

[data]
    dos filetime resolution = yes

We recommend using this option only if you are using Microsoft Visual C++ on a 
Samba share that supports opportunistic locking.
************************************************************************

Original comment by pyscripter on 13 Nov 2010 at 4:23

GoogleCodeExporter commented 9 years ago
Still, Notepad2 or Notepad++ do not seem to suffer from this problem, so I 
conclude that there must be a fail-safe method to do it. However, looking at 
their source code [1,2], I cannot see any obvious differences in the way the 
file change check is performed. Maybe someone else can?

[1] 
http://notepad-plus.svn.sourceforge.net/viewvc/notepad-plus/trunk/PowerEditor/sr
c/ScitillaComponent/Buffer.cpp?view=markup lines 185 & 659
[2] http://www.flos-freeware.ch/zip/np2src.zip Notepad2.c lines 6868 & 6180

Original comment by brezht...@gmail.com on 14 Nov 2010 at 2:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I wish to report the same problem, with PyScripter 2.4.1.0

Original comment by barry.de...@gmail.com on 15 Apr 2011 at 4:03

GoogleCodeExporter commented 9 years ago
I should have followed up on my own comment 2: I have again/still the file 
notification problem, now using PyScripter 2.4.1.0. Things seem to be changing 
over time. Today, everything is fine with when I save on one Unix file server, 
while I get a false notification after every save on a second server.

Original comment by I....@ed.ac.uk on 15 Apr 2011 at 4:26

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 1 Jun 2011 at 6:36

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 1 Jun 2011 at 6:38