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.
    • donhoD
      donho @David Johnstone
      last edited by

      @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 ?

      donhoD 1 Reply Last reply Reply Quote 1
      • donhoD
        donho @donho
        last edited by

        @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?

        pnedevP 1 Reply Last reply Reply Quote 0
        • pnedevP
          pnedev @donho
          last edited by pnedev

          @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.

          donhoD 1 Reply Last reply Reply Quote 1
          • donhoD
            donho @pnedev
            last edited by donho

            @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).

            pnedevP 1 Reply Last reply Reply Quote 0
            • pnedevP
              pnedev @donho
              last edited by

              @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.

              donhoD 1 Reply Last reply Reply Quote 4
              • donhoD
                donho @pnedev
                last edited by

                @pnedev
                Makes sens for this parameter. Let’s keep it then.
                Thank you for your explanation.

                1 Reply Last reply Reply Quote 2
                • Josef EliášJ
                  Josef Eliáš @Leo Eibler
                  last edited by

                  @leo-eibler , @donho
                  Where is this fix available? I have same problem and it sounds like you have fix :D

                  donhoD 1 Reply Last reply Reply Quote 0
                  • donhoD
                    donho @Josef Eliáš
                    last edited by

                    @josef-eliáš
                    Download v8.1.9.2 here:
                    https://notepad-plus-plus.org/downloads/v8.1.9.2/

                    1 Reply Last reply Reply Quote 0
                    • Marc GreinerM
                      Marc Greiner
                      last edited by

                      I am having the “Reload false alarm” issue.

                      • Notepad++ 8.4.4 64 bits
                      • pCloud (a cloud storage competitor to DropBox etc.)
                      • Windows 11

                      Steps to reproduce:

                      1. In Notepad++, save a text file to a folder in the P: drive.
                        The P: drive is the “logical” drive that pCloud synchronizes between my PCs.

                      2. Give the focus to another app window.

                      3. Give the focus back to Notepad++.

                      4. Notepad++ prompts me with “This file has been modified by another program. Do you want to reload it?”

                      My Notepad++ is configured like so:
                      Preferences -> MISC. -> File Status Auto-Detection -> Enabled for all opened files

                      Doug RossD Mountain-EagleM 2 Replies Last reply Reply Quote 0
                      • Doug RossD
                        Doug Ross @Marc Greiner
                        last edited by

                        @Marc-Greiner I am having this same issue as well. I am on version 8.4.5 32-bit, though it has been happening through the past several versions.

                        The steps are exactly the same as Marc described, though my files are being synced to OneDrive, not pCloud.

                        Also, my File Status Auto-Detection setting is set to “Enabled”.

                        1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn
                          last edited by Alan Kilborn

                          IMO, Notepad++ has trouble with this for files that are on these types of drives. In my case, like @Doug-Ross it is for OneDrive, and indeed I discussed it on this forum over 2 years ago; see current top result HERE and also note some other results…

                          There is also an “issue” open for this; see HERE.

                          Perhaps it isn’t a problem for most users of these services, so it has gained little attraction from those that could address it.

                          1 Reply Last reply Reply Quote 0
                          • Mountain-EagleM
                            Mountain-Eagle @Marc Greiner
                            last edited by

                            @Marc-Greiner I have this problem occasionally while using SpiderOak doing scheduled cloud storage backups every 30 minutes.
                            Windows 10 Pro 64 bits
                            Notepad++ v8.4.9 64 bits
                            Preferences ->
                            MISC. -> File Status Auto-Detection -> Enabled.
                            Backup -> Enable session snapshot and periodic backup every 5 minutes.

                            When I am prompted with: “Do you want to reload?” I click no and proceed normally.

                            I am a small business owner, with tech knowledge, not a developer.
                            I will be migrating from Windows 10 to Linux Mint, not upgrading to Windows 11.

                            1 Reply Last reply Reply Quote 0
                            • jim hughesJ
                              jim hughes
                              last edited by jim hughes

                              I’m using NP++ for the first time and seems I’m getting this “file has been modified” warning constantly - except for my first access to the file. Any way I can turn this off?

                              Terry RT 1 Reply Last reply Reply Quote 0
                              • Terry RT
                                Terry R @jim hughes
                                last edited by

                                @jim-hughes said in 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?!:

                                I’m getting this “file has been modified” warning constantly

                                This page of the online manual might help.

                                As you would have read, it tends to be an issue with cloud based storage, is that what you are using?

                                Terry

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors