tappi287 / openvr_fsr_app

Management Gui for OpenVR FSR PlugIn
MIT License
411 stars 9 forks source link

ruamel.yaml.reader.ReaderError: unacceptable character #x0000: special characters are not allowed #44

Closed jonathonf closed 2 years ago

jonathonf commented 2 years ago

Since version 0.8.4, updating settings from within the application leads to a corrupted settings file with a line of NUL characters added (see attached vrperfkit.yml).

Let me know how I can provide more information etc. as needed.

tappi287 commented 2 years ago

I've noted to implement a backup before writing, but there is nothing I could re-produce here.

The version you mentioned did not support vrperfkit.

The App will read the existing yml file and only change values it finds with the appropiate keys for. That means the reason for those NUL values could be anything from a failing hard drive, read/write by the mod, manual edits by the user or previous writes from the App itself.

Just let me know if you can reproduce this with a newer version that will create backups of the yml file.

jonathonf commented 2 years ago

The write issue does occur with the other approaches, I included the vrperfkit.yml as an example of the issue I've been seeing since 0.8.4. I have triggered the issue after installing each of FSR, FFR, and vrperfkit plugins, though it may take several repeated changes to occur.

The new backup function does create a vrperfkit.yml backup file but the NUL character write issue still persists, even on creation of the new vrperfkit.yml file which leads to the ReaderError exception.

It's probably worth noting that the files are stored on a winbtrfs filesystem, though that is the same as before 0.8.4 when the issue didn't occur.

tappi287 commented 2 years ago

Did you start using this app with v0.8.3? Because that version had a bug and was not writing settings changes to disk at all.

If you have Python (3.10) available on your system you may want to try a standard json write to your custom file system like this:

import time
import json

test_runs = 50
data = {'some_key': 'some_value'}
some_path = 'C:/temp/some_test.json'

while (test_runs := test_runs - 1) > 0:
    with open(some_path, 'w') as file:
        print(f'Test write #{test_runs}')
        json.dump(data, file)

    time.sleep(0.2)

..and then file an issue at either that file system or the Python standard library.

The lines in this App doing the actual writing are these unexciting lines:

json https://github.com/tappi287/openvr_fsr_app/blob/aa8566feda1dbb277ca727fbbdc1ecdf6da5eb33/app/cfg/cfg_file_handler.py#L35-L36

yaml https://github.com/tappi287/openvr_fsr_app/blob/aa8566feda1dbb277ca727fbbdc1ecdf6da5eb33/app/cfg/cfg_file_handler.py#L123

jonathonf commented 2 years ago

OK.