Community
    • Login

    Notepad++ just deleted all the text from my files

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    40 Posts 9 Posters 6.2k 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.
    • rinku singhR
      rinku singh @Maddock Emerson
      last edited by

      @Maddock-Emerson said:

      red wine

      Notepad++ v7.7.1 (32-bit)
      Build time : Jun 16 2019 - 21:14:50
      Path : C:\Program Files\Notepad++\notepad++.exe
      Admin mode : OFF
      Local Conf mode : OFF
      OS : Windows 7 (32-bit)
      Plugins : 3P.dll ColorPicker.dll Console_output.dll HexEditor.dll Hex_2_binary.dll JSMinNPP.dll mimeTools.dll NppConverter.dll NppExport.dll NppPluginDemo.dll Remove_dup_lines.dll

      1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones
        last edited by

        @Maddock-Emerson said:

        Okay wait, what exactly do you need and how do I get it

        By ? > Debug Info > Copy debug info into clipboard, I meant, "go to the ? menu in Notepad++, select the Debug Info menu entry, and then click on Copy debug info into clipboard, which will copy the kind of info that @gurikbal-singh pasted. You would then come over to your browser widow, reply to this post, and paste it in.

        By showing us the Settings > Preferences > Backup, you would go to the Settings menu, pick the Preferences entry, then in the far-left list of words, select Backup, which will take you to the backup settings for Notepad++. Use Alt+PrintScreen to grab a screenshot. Paste that screenshot into mspaint.exe, or your favorite simple graphics program, save the file to your computer. Then go to imgur.com or other similar image-sharing site, upload your image, find the URL for the picture (I already explained how in imgur’s interface). Then come to your reply, and embed the code ![](http://i.imgur.com/QTHZysa.png), where you replace the URL I supplied with the URL to your image. You’ll know you’ve done it right by looking in the PREVIEW window while you’re typing your reply, and you’ll be able to scroll around and see the image embedded.

        By “make a copy of all the %AppData%\Notepad++\*.xml config files”, I meant: open Windows Explorer, paste %AppData%\Notepad++\ into the explorer navigation field, then select all the *.xml files, and copy them to some other location, where you know where they are. If @pnedev asks for them, you’ll be able to zip them up, and figure out some location that you can share those files with @pnedev, if it will help him in his debug.

        Maddock EmersonM 1 Reply Last reply Reply Quote 0
        • Maddock EmersonM
          Maddock Emerson @PeterJones
          last edited by

          @PeterJones
          Notepad++ v7.7.1 (32-bit)
          Build time : Jun 16 2019 - 21:14:50
          Path : C:\Program Files (x86)\Notepad++\notepad++.exe
          Admin mode : OFF
          Local Conf mode : OFF
          OS : Windows 10 (64-bit)
          Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll

          Okay, I think I’ve done everything right? I’m getting very close to 24 hours without sleep though so I’ll check back way later

          1 Reply Last reply Reply Quote 2
          • PeterJonesP
            PeterJones
            last edited by

            @Maddock-Emerson said:

            Okay, I think I’ve done everything right?

            Yes, that’s what we were asking for. Thanks!

            Hopefully, @pnedev (or another developer) will be able to look into this.

            1 Reply Last reply Reply Quote 1
            • pnedevP
              pnedev
              last edited by

              Hello @Maddock-Emerson ,

              Thank you for reporting this and for the info. I’m really sorry for your data loss.

              Hello all,

              I did some fixes back then that could cause data loss when backup was enabled.
              However this issue is very difficult to reproduce thus it was not possible to verify it was completely fixed. Unfortunately now it is clear that’s not the case.
              I’ll look into this again to see if I’ll find something else.

              1 Reply Last reply Reply Quote 1
              • EkopalypseE
                Ekopalypse
                last edited by

                @pnedev - I not convinced that this issue is anyhow related to what you’ve fixed in the past.

                I’ve researched the past incidents and I didn’t find a single report that mentioned the
                same behavior as this one.
                Neither the loss of themes nor that all files opened got corrupted.

                The weird thing here, beside the loss of the theme and the files opened in the past is
                the corruption of all files. How could this be? Npp opens the files, except for the
                initial reading, only if it needs to write something, aka the user saves the file,
                otherwise it would create a backup of that file. (given from the configuration from the OP)

                This incident here, from my point of view, is very different and unique.

                Alan KilbornA 1 Reply Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @Ekopalypse
                  last edited by Alan Kilborn

                  @Ekopalypse said:

                  The weird thing here…is the corruption of all files.

                  Memory is weak, but from prior discussion of this issue I seem to recall that people complained of files that were changed during the current run of Notepad++ were the ones that got stuffed with NULs.

                  For example, if your “remembered” session contains 5 files, and during the current session (the one with the thing that causes the NUL corruption) you’ve only worked on 3 of those files, only those 3 would be NULlified.

                  So, it is conceivable that the OP on this thread here had worked on all of his files when the oddity manifested, trashing all of them. Just a supposition.

                  EkopalypseE 1 Reply Last reply Reply Quote 3
                  • EkopalypseE
                    Ekopalypse @Alan Kilborn
                    last edited by Ekopalypse

                    @Alan-Kilborn

                    Memory is weak, but from prior discussion of this issue I seem to recall that people complained of files that were changed during the current run of Notepad++ were the ones that got stuffed with NULs.

                    Or my research wasn’t good enough. If this was the case then, yes, …
                    But I’m still don’t understand how this could happen.
                    I understand if you haven’t saved it, that the “backups” might get corrupted but
                    if a file on disk has been opened in npp it wouldn’t be affected by a defunct backups functionality wouldn’t it?
                    My understand how this works is

                    • initial read of the file if opened from filesystem

                    • make changes in the editor but do not save

                    • having the configs from OP results in backup files after 7 seconds

                    • go on and make further changes - backups do get changed as well

                    • save the file

                    • npp opens the file for writing the changes and then deletes the backup file

                    So how could all files, edited by Npp, from the filesystem get corrupted by this mechanism?
                    Only if I would say save all open files and something prevents from closing it while
                    shutting down the machine. Sounds very strange to me. Just to make sure, I do NOT
                    say that OP is lying - I just don’t understand how this could happen.

                    Alan KilbornA 2 Replies Last reply Reply Quote 4
                    • Alan KilbornA
                      Alan Kilborn @Ekopalypse
                      last edited by

                      @Ekopalypse said:

                      how could all files, edited by Npp, from the filesystem get corrupted by this mechanism?

                      Well that’s the big question, isn’t it? :)

                      EkopalypseE 1 Reply Last reply Reply Quote 2
                      • EkopalypseE
                        Ekopalypse @Alan Kilborn
                        last edited by

                        @Alan-Kilborn

                        I’m quite good in asking obvious questions :-D

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

                          @Ekopalypse said:

                          I do NOT say that OP is lying

                          Right. OP is sincere and is not trolling. I’m fairly sure the NUL thing happened to me once a long time ago (before I even knew about this forum) in a minor way (one file that was unimportant got NULlified after a strange crash). I did not recognize it as anything but a curious weirdness at the time. But now I pay attention when someone mentions NUL and does not mean opening a binary file.

                          1 Reply Last reply Reply Quote 3
                          • rinku singhR
                            rinku singh
                            last edited by

                            NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL

                            as about 10 months ago i got same problem but in different condition(while saving there changes to .nova files as request i got admin mode but all open files changes into NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL NUL

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

                              @Ekopalypse ,

                              Yes, this issue is really weird. @Alan-Kilborn said it right - only the modified files get corrupted. This is the notorious issue with file corruption on power loss.
                              The strange thing is the session file as well. But, again, it is also “modified”. @Maddock-Emerson might have modified it’s theme files as well.
                              The difficulty in reproducing this issue makes it very hard to debug so we can basically just guess what might be causing it.

                              So here is one guess:
                              As far as I recall from the code, if you have edited a file and haven’t saved it and the backup is enabled, and there is power loss for example, after Notepad++ restarts, it detects that the file has backup and restores it from there. I can’t remember if Notepad++ asks the user for confirmation, perhaps it does. But if during the power loss the backup was taking place, the backup might be corrupted BUT the original file might be OK and just AFTER Notepad++ restarts, the corrupted backup overwrites the “unsaved” original file.

                              I need to check that scenario.

                              Alan KilbornA 1 Reply Last reply Reply Quote 4
                              • pnedevP
                                pnedev
                                last edited by

                                @Maddock-Emerson ,

                                Do you by any chance still keep the files that are all NUL?
                                Can you send some of them to me? You can simply share them here in the community or send them via e-mail (pg.nedev@gmail.com).
                                Thank you.

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

                                  @pnedev said:

                                  Yes, this issue is really weird. @Alan-Kilborn said it right - only the modified files get corrupted.

                                  Well, thanks! Sometimes I get it right (still striving for 100%). :)

                                  I should have mentioned that (and again going from memory) that at least one user complained that not only are the modified-during-current-run files trashed, but any backups (either of the .bak variety, or the verbose type) made of these files made during the current run are also NULlified. Since these backup files were “modified” (by N++) during the current run, they suffer the same fate as files in tabs (that have been “modified”).

                                  So this is a doubly dangerous bug as the normal backup mechanism is providing absolutely zero protection. One could work for hours (or days) on a file, feeling their data is very protected…when in reality nothing could be further from truth.

                                  Aside: The word modified has an association when talking about file-tabs in N++ that changes have been made and not saved (i.e., tab floppy disk icon is red). This may be confusing for the current discussion because the corruption very likely affects both types of files (modified-but-unsaved and normal saved files). Maybe for purpose of discussion of this, it is better to talk of files touched by N++ during current N++. (Yes, I know “touch” has another meaning – altering the timestamp of a file without changing its contents – which shouldn’t be confused here).

                                  1 Reply Last reply Reply Quote 3
                                  • pnedevP
                                    pnedev
                                    last edited by pnedev

                                    Update:
                                    The scenario I guessed above is not true. There is another reason for the NUL file corruption on power loss. As can be seen from the thread linked below it might even be totally unrelated to Notepad++ itself.

                                    Here is the link to my previous research on the problem and description of the fix I did plus info on the NUL corruption:
                                    https://notepad-plus-plus.org/community/topic/13302/fix-corrupted-txt-file-null/67 .

                                    To summarize:
                                    There have been two separate issues. I have fixed one of them (connected to backup). The other (NUL corruption) is still there and its cause is not clear yet (it might even be unrelated to Notepad++).
                                    Here is a link about similar crashes in other applications as well and a description how Recuva can be used to recover your data loss (not guaranteed but worth trying):
                                    https://superuser.com/questions/377904/recover-file-corrupted-due-to-power-cut-off

                                    1 Reply Last reply Reply Quote 3
                                    • pnedevP
                                      pnedev
                                      last edited by

                                      I submitted this PR (https://github.com/notepad-plus-plus/notepad-plus-plus/pull/6164)
                                      which fixes the issue with deleting a file, leaving it with zero size on save when there is no free space left on disk (I verified that) and hopefully fixes the NUL file corruption on reboot / power loss (I haven’t verified that because the issue is not easily reproducible).

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

                                        I really don’t think it’s Notepad++ issue.

                                        Here’s the similar discussion but for another editor:
                                        https://github.com/atom/atom/issues/11406

                                        As you might all know, ATOM is web browser based code editor, and their code to write on disk (JavaScript?) has nothing in common with Notepad++.

                                        Correct me if I’m wrong, but for me it’s rather an OS issue.

                                        pnedevP dinkumoilD 2 Replies Last reply Reply Quote 0
                                        • pnedevP
                                          pnedev @donho
                                          last edited by

                                          @donho ,

                                          There are actually two issues:

                                          1. File is erased when you try to save but you don’t have enough space or the actual write fails for some other reason (Read here https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5664 and here https://community.notepad-plus-plus.org/topic/18358/file-content-vanishing/17). This is fixed by https://github.com/notepad-plus-plus/notepad-plus-plus/pull/6164.

                                          2. File is corrupted when there is a sudden power loss (or Windows 10 restarts because of updates: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/6133). This might be an OS issue to some extent but we can certainly do better by immediately flushing the file data to disk on save. This is something the CRT doesn’t do thus it is better to use native Win32 API for file access. This is what I’ve done in https://github.com/notepad-plus-plus/notepad-plus-plus/pull/6164. The same approach should be used for writing settings files and sessions (I haven’t done it yet because I had to modify TinyXML code for that and the change would be too big for the reviewers) and also reading files should use it (just to unify the file access approach).

                                          1 Reply Last reply Reply Quote 3
                                          • dinkumoilD
                                            dinkumoil @donho
                                            last edited by dinkumoil

                                            @donho said in Notepad++ just deleted all the text from my files:

                                            for me it’s rather an OS issue.

                                            May be, but that’s no reason to decline fixes that help to overcome these issues.

                                            As a developer I frequently have to write code to circumvent bugs caused by otherones code, that’s quite normal. And this issue is a catastrophic one, it should be fixed.

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