Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't ignore binary files #6

Open
aaronsnoswell opened this issue Feb 21, 2018 · 1 comment
Open

Doesn't ignore binary files #6

aaronsnoswell opened this issue Feb 21, 2018 · 1 comment

Comments

@aaronsnoswell
Copy link

Hi @vontio,

This is part issue and part a plea for help :/

I recently ran this script in a sublime instance on my (Windows) development PC. Unfortunately I was under the impression that it would process open files, not every folder open in my project. I happened to have a large number of folders open at the time. As you would expect, this corrupted a very large number of binary files on my development computer (word documents, excel files, images, power points etc). The script also corrupted all my git repos (See #5).

Many of these were under git control - after blowing away the folders I could clone again and everything was fine. Unfortunately there were a handful of binary files that were only local, and not yet committed to version control. Some of these are very important files that I would very much like to recover.

  • Can you offer any advice in this regard? My understanding is that this script searches through the binary stream of each file, looking for instances of "\n" and replacing with "\r\n" (on a windows machine), or "\n\r and replacing with "\n" (on a Linux machine). Is this correct?
  • If my above assumption is correct, am I correct in my understanding that this is a lossy transform? I.e. instances of "\n" would then be co-mingled with instances of "\r\n" in the byte stream, making it non-trivial to reverse the process, recovering the binary file to it's original state?
  • Can you suggest any means for me to recover these files?

Suggestions from an issue point of view:

  • Make the README.md warning about backing up files much, much more prominent - maybe move to the top of the file?
  • Make the install.txt warning about backing up files much, much more prominent - maybe move to the top of the file?
  • Adjust the script to totally ignore binary files
  • Remove this package from Sublime Package Control - it's too dangerous for mere mortals.

Thanks for the assistance,

@aaronsnoswell
Copy link
Author

Update: it seems the process is much more lossy on binary files than I anticipated. Below is a HxD binary diff of a file I had a backup of. On the left is the corrupted file and on the right the backup. As you can see, after the first difference there are vast chunks of missing bytes from the corrupted file :(

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant