• Login
Community
  • Login

Notepad++ has a Reload false alarm / bug? "This file has been modified by another program. Do you want to reload it"? even when it hadn't been recently modified at all?!

Scheduled Pinned Locked Moved General Discussion
32 Posts 14 Posters 7.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L
    Leo Eibler
    last edited by Leo Eibler Nov 10, 2021, 12:45 PM Nov 10, 2021, 12:44 PM

    Hi,
    I want to upvote this thread because I installed new version of npp today and since this new update (version 8.1.9, 64-bit) I got “file has changed” notification.

    The files are stored on a windows network drive and there was no problem with this mechanism this in the previous versions.
    It is reproduceable by changing a file, save the file, switch to another program (e.g. explorer) switch back to npp and the message appears.

    So it seems there was a change in detecting the modification of a file (maybe time resolution to recognize a modified file or something else was changed)?

    thank you!
    Leo

    D D 2 Replies Last reply Nov 11, 2021, 1:39 AM Reply Quote 1
    • D
      donho @Bo Chen
      last edited by Nov 11, 2021, 1:02 AM

      @bo-chen
      What’s your Notepad++ version?

      1 Reply Last reply Reply Quote 0
      • D
        donho @Leo Eibler
        last edited by Nov 11, 2021, 1:39 AM

        @leo-eibler

        It is reproduceable by changing a file, save the file, switch to another program (e.g. explorer) switch back to npp and the message appears.

        Is it reproducible 100% for you?
        What’s the version before you updated your Notepad++ to v8.1.9?
        I have tried with files on oneDrive, but cannot reproduce it. Any idea to build a windows network drive for reproducing this issue?

        1 Reply Last reply Reply Quote 2
        • D
          Dennis Lazo @Leo Eibler
          last edited by Nov 11, 2021, 7:19 PM

          @leo-eibler i am upvoting this. my files are saved on a NAS and am experiencing this as well.

          D 1 Reply Last reply Nov 11, 2021, 9:59 PM Reply Quote 0
          • D
            donho @Dennis Lazo
            last edited by donho Nov 11, 2021, 11:10 PM Nov 11, 2021, 9:59 PM

            @dennis-lazo

            @leo-eibler i am upvoting this. my files are saved on a NAS and am experiencing this as well.

            It’s good for upvoting.
            It’s better to let us know your Notepad++ version, so we can identify better the problem and fix this bug.

            D 1 Reply Last reply Nov 12, 2021, 3:29 AM Reply Quote 1
            • D
              donho @donho
              last edited by Nov 12, 2021, 3:29 AM

              @Bo-Chen @Dennis-Lazo @Leo-Eibler

              I have no network drive/NAS/MEGA so I can’t reproduce this issue.
              However, I find some incoherent code of timestamp detection and did a blend fix:
              http://download.notepad-plus-plus.org/repository/MISC/

              Could you guys test the fixed binary (download above) and confirm me if it work (and the message you see) please?

              L 2 Replies Last reply Nov 12, 2021, 7:39 AM Reply Quote 1
              • L
                Leo Eibler @donho
                last edited by Nov 12, 2021, 7:39 AM

                @donho Thank you very much for this fast fix. I installed your fixed version now and will see if it solves the problem.

                I tried to find out the version I used before but I was not able to find it - if you have any idea how to find out the previous used version I will tell you ;-)

                1 Reply Last reply Reply Quote 0
                • L
                  Leo Eibler @donho
                  last edited by Leo Eibler Nov 12, 2021, 7:56 AM Nov 12, 2021, 7:54 AM

                  @donho happened again with new Version.
                  Dialog message: “File on disk timestamp is earlier than current buffer timestamp: #2”
                  And if I click on OK, a second dialog box with same message appears.
                  If I switch to another program and switch back to npp a 3rd dialog box appears with same message.
                  Dialog boxes can not be closed - after clicking on OK it appears again and again.

                  So I have to kill the process.

                  D 1 Reply Last reply Nov 12, 2021, 12:29 PM Reply Quote 0
                  • D
                    donho @Leo Eibler
                    last edited by Nov 12, 2021, 12:29 PM

                    @leo-eibler
                    Could you try the new fix please?
                    It should be fine now:
                    http://download.notepad-plus-plus.org/repository/MISC/NewFix/

                    L 1 Reply Last reply Nov 12, 2021, 1:14 PM Reply Quote 2
                    • L
                      Leo Eibler @donho
                      last edited by Nov 12, 2021, 1:14 PM

                      @donho Is it possible that you don’t fixed the x64 version? because it has older date (2021-11-12 04:02 2.3M) and other filename (missing the word “new”)

                      D 1 Reply Last reply Nov 12, 2021, 1:46 PM Reply Quote 1
                      • D
                        donho @Leo Eibler
                        last edited by donho Nov 12, 2021, 1:47 PM Nov 12, 2021, 1:46 PM

                        @leo-eibler

                        @donho Is it possible that you don’t fixed the x64 version? because it has older date (2021-11-12 04:02 2.3M) and other filename (missing the word “new”)

                        You are right. Fixed now.

                        L D 3 Replies Last reply Nov 12, 2021, 2:33 PM Reply Quote 1
                        • L
                          Leo Eibler @donho
                          last edited by Nov 12, 2021, 2:33 PM

                          @donho thank you very much. I will test it.

                          1 Reply Last reply Reply Quote 2
                          • L
                            Leo Eibler @donho
                            last edited by Leo Eibler Nov 12, 2021, 4:19 PM Nov 12, 2021, 4:18 PM

                            @donho it looks very good … I tested it now (for the last 2 hours) and no “file has been modified” dialog any more ;-)

                            I also tested to modify the file really outside the editor and this works also - the modified dialog appears as expected.

                            I keep on testing next week but I think you solved the bug ;-)
                            Thank you very very much for your really fast help!

                            BR

                            J 1 Reply Last reply Nov 25, 2021, 9:45 AM Reply Quote 3
                            • D
                              David Johnstone @donho
                              last edited by Nov 14, 2021, 11:24 AM

                              @donho Out of curiosity, I looked at the code in FileInterface.cpp
                              In line 25, we have:

                              attrib = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_POSIX_SEMANTICS;

                              The MSDN documentation for CreateFile says about FILE_ATTRIBUTE_NORMAL:

                              “This attribute is valid only if used alone.”

                              In reality, ORing with other attributes may make no real difference. But after coding for some 50 years, I believe being pedantic = good plan :-)

                              D D 2 Replies Last reply Nov 14, 2021, 11:27 AM Reply Quote 1
                              • D
                                David Johnstone @David Johnstone
                                last edited by Nov 14, 2021, 11:27 AM

                                @david-johnstone should say Line 125

                                1 Reply Last reply Reply Quote 0
                                • D
                                  donho @David Johnstone
                                  last edited by Nov 14, 2021, 2:06 PM

                                  @david-johnstone

                                  The MSDN documentation for CreateFile says about FILE_ATTRIBUTE_NORMAL:
                                  “This attribute is valid only if used alone.”
                                  In reality, ORing with other attributes may make no real difference. But after coding for some 50 years, I believe being pedantic = good plan :-)

                                  You’ve got a point here.

                                  OTOH, the another parameter FILE_FLAG_POSIX_SEMANTICS, MS Doc says:

                                  FILE_FLAG_POSIX_SEMANTICS
                                  0x01000000
                                  
                                  
                                  	Access will occur according to POSIX rules. This includes allowing multiple files with names, differing only in case, for file systems that support that naming.
                                  

                                  We do not need this ability, so I think it can be removed. What do you think @pnedev ?

                                  D 1 Reply Last reply Nov 14, 2021, 2:32 PM Reply Quote 1
                                  • D
                                    donho @donho
                                    last edited by Nov 14, 2021, 2:32 PM

                                    @David-Johnstone

                                    The MSDN documentation for CreateFile says about FILE_ATTRIBUTE_NORMAL:
                                    “This attribute is valid only if used alone.”

                                    The thing is, even FILE_FLAG_POSIX_SEMANTICS is removed:

                                    void Win32_IO_File::fillCreateParams(DWORD &access, DWORD &share, DWORD &disp, DWORD &attrib)
                                    {
                                    	access	= GENERIC_READ;
                                    	share = FILE_SHARE_READ;
                                    	attrib	= FILE_ATTRIBUTE_NORMAL; // Distinguish between upper/lower case in name
                                    
                                    	if (_hMode == Mode::READ)
                                    	{
                                    		disp	=	OPEN_EXISTING; // Open only if file exists and is not locked by other process
                                    
                                    		attrib	|=	FILE_FLAG_SEQUENTIAL_SCAN; // Optimize caching for sequential read
                                    	}
                                    	else
                                    	{
                                    		disp	=	OPEN_ALWAYS; // Open existing file for writing without destroying it or create new
                                    
                                    		access	|=	GENERIC_WRITE;
                                    		attrib	|=	FILE_FLAG_WRITE_THROUGH; // Write cached data directly to disk (no lazy writer)
                                    	}
                                    }
                                    

                                    We add always FILE_FLAG_WRITE_THROUGH (Mode::READ is not used in Notepad++ code).

                                    @pnedev
                                    What’s your thought?

                                    P 1 Reply Last reply Nov 17, 2021, 12:15 AM Reply Quote 0
                                    • P
                                      pnedev @donho
                                      last edited by pnedev Nov 17, 2021, 12:20 AM Nov 17, 2021, 12:15 AM

                                      @donho ,

                                      The CreateFile’s parameter about file attributes is combined with other flags.
                                      The MSDN is saying that FILE_ATTRIBUTE_NORMAL cannot be combined with other ATTRIBUTE values (because those will overwrite FILE_ATTRIBUTE_NORMAL) but flags are separate thing and can surely be combined with attributes. Those are basically two separate types of values combined in one variable.

                                      Quote from MSDN from https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew :

                                      [in] dwFlagsAndAttributes

                                      The file or device attributes and flags, FILE_ATTRIBUTE_NORMAL being the most common default value for files.

                                      This parameter can include any combination of the available file attributes (FILE_ATTRIBUTE_*). All other file attributes override FILE_ATTRIBUTE_NORMAL.

                                      This parameter can also contain combinations of flags (FILE_FLAG_) for control of file or device caching behavior, access modes, and other special-purpose flags. These combine with any FILE_ATTRIBUTE_ values."

                                      So we can safely use FILE_FLAG_SEQUENTIAL_SCAN, FILE_FLAG_WRITE_THROUGH and FILE_FLAG_POSIX_SEMANTICS and any other FILE_FLAG_* value together with FILE_ATTRIBUTE_NORMAL.

                                      D 1 Reply Last reply Nov 17, 2021, 1:11 AM Reply Quote 1
                                      • D
                                        donho @pnedev
                                        last edited by donho Nov 17, 2021, 1:12 AM Nov 17, 2021, 1:11 AM

                                        @pnedev

                                        Yes, that’s what I understood after reading agin MS Doc concerning CreateFile function.
                                        However, the parameter FILE_FLAG_POSIX_SEMANTICS to me is not useful for Notepad++. But there is maybe a reason when you coded it - I would like to know it before removing it (or not).

                                        P 1 Reply Last reply Nov 17, 2021, 8:41 AM Reply Quote 0
                                        • P
                                          pnedev @donho
                                          last edited by Nov 17, 2021, 8:41 AM

                                          @donho ,

                                          You can remove FILE_FLAG_POSIX_SEMANTICS if you like.

                                          The reason I added it is because I am mostly using Linux in my daily work and I like the file name case sensitivity. It is a personal preference and in my opinion doesn’t harm in Windows as well.
                                          I remember once long time ago I got a file from somewhere that was with all capitals name and when I tried to rename it to make the characters normal the system denied that claiming the name was the same. Seems that the confusion I felt back then still lingers :)

                                          Aside from my personal preference, I am not sure if keeping that flag will be useful if Notepad++ is used for Network accessed files. I do not have much experience in that case so I’m not sure what will happen if some Network accessed location is having case-sensitive file system and in a folder there are two files with names that only differ in letter cases. I have no idea if such situation might happen either but how will Notepad++ distinguish between those files? Maybe it is something that will be handled on operating system level IDK for sure.

                                          D 1 Reply Last reply Nov 17, 2021, 1:17 PM Reply Quote 4
                                          13 out of 32
                                          • First post
                                            13/32
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors