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

Corrupted "Visited Paths.json" on Windows #238

Closed
synteny opened this Issue Nov 20, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@synteny

synteny commented Nov 20, 2017

At some point in the past, fman logged an invalid entry in the "Visited Paths.json". From then on, it displays the following error message on every directory change:

DirectoryPaneListener 'GoToListener' raised error.

Traceback (most recent call last):
  File "fman\impl\plugins\plugin.py", line 241, in _notify_listener_in_thread
  File "C:\Users\smirnov.vs\AppData\Local\fman\Versions\0.6.9\Plugins\Core\core\commands.py", line 704, in on_path_changed
    load_json('Visited Paths.json', default={}, save_on_quit=True)
  File "fman\__init__.py", line 145, in load_json
  File "fman\impl\plugins\__init__.py", line 36, in load_json
  File "fman\impl\plugins\config.py", line 22, in load_json
  File "fman\impl\plugins\config.py", line 78, in load_json
  File "json\__init__.py", line 268, in load
  File "json\__init__.py", line 319, in loads
  File "json\decoder.py", line 339, in decode
  File "json\decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Invalid \escape: line 1 column 8298 (char 8297)

Here's the problematic line:

"C:\\Users\\smirnov.vs\\Documents\\\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b\\\u041f\u0440\u043e\u0435\u043a\u0442\u044b\\\u041a\u043b\u0438\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\\\u0423\u043b\u044c\u0442\u0440\u0430\u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0435 \u0438\u0441\u0441\: 1

The trailing '\' causes the issue. Shouldn't the paths logged in this file be filtered for such issues beforehand?
Visited Paths (Windows).json.zip

@synteny synteny changed the title from Corrupted "Visited Paths.json" to Corrupted "Visited Paths.json" on Windows Nov 20, 2017

@mherrmann mherrmann added the bug label Nov 21, 2017

@mherrmann

This comment has been minimized.

Contributor

mherrmann commented Nov 21, 2017

Sorry for the trouble and thank you for the detailed bug report. I'll check it out after finishing the current release of fman.

@synteny

This comment has been minimized.

synteny commented Nov 21, 2017

Removing the '\' doesn't resolve the issue, despite what I wrote above. Please check the whole file attached when investigating. This is fman 0.6.9, naturally

@mherrmann

This comment has been minimized.

Contributor

mherrmann commented Nov 21, 2017

Will do, thanks. As a workaround you can delete Visited Paths.json. It is important that you do this when fman is not running, because the file gets overwritten every time fman closes.

@mherrmann

This comment has been minimized.

Contributor

mherrmann commented Dec 1, 2017

I think I was able to find and fix the cause of the problem in version 0.7.2, which I just released. Unfortunately, it only prevents Visited Paths.json from becoming corrupted again. It is not able to repair the already corrupted files.

To be more precise, I believe the problem was caused by the file being concurrently written to by two instances of fman. The first would write {"some/long path": 1} and at the same time the second would (partially) overwrite this with {"some/path: 2"}, leading to the end result of {"some/path: 2"}": 1}.

@mherrmann mherrmann closed this Dec 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment