Notepad++ just deleted all the text from my files
-
@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 intomspaint.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. -
@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.dllOkay, 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
-
@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.
-
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. -
@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 thatall
files opened got corrupted.The weird thing here, beside the loss of the theme and the files opened in the past is
the corruption ofall
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.
-
@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.
-
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. -
-
@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? :)
-
I’m quite good in asking obvious questions :-D
-
@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.
-
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
-
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.
-
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. -
@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).
-
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 -
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). -
I really don’t think it’s Notepad++ issue.
Here’s the similar discussion but for another editor:
https://github.com/atom/atom/issues/11406As 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.
-
@donho ,
There are actually two issues:
-
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.
-
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).
-
-
@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.
-
@donho said in Notepad++ just deleted all the text from my files:
but for me it’s rather an OS issue.
But…virtually no one will blame the OS. They will blame Notepad++. That’s just the way it is. And a text editor doesn’t need that type (losing data) of reputation.