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

fix: Windows replace use of non-ascii filename chars #1017

Closed
wants to merge 1 commit into from

Conversation

obany
Copy link
Contributor

@obany obany commented Apr 23, 2021

Description of change

On windows profile names with non ascii characters caused an exception e.g. userä

This is because the windows version of RocksDB does not support the wider character set facebook/rocksdb#3408 and so the profile storage folders which use the profile names were not accessible.

On windows the non ASCII characters will now be replaced with their sequence numbers instead for folder names e.g. userä = user00e4

An alternative fix is to do a custom build of the rust RocksDB using this flag facebook/rocksdb#4469 which enables UTF8 support for windows filenames.

Links to any relevant issues

Fixes #1015 #992

Type of change

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

Tested on windows with profile names with non ascii characters.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@obany obany requested a review from cvarley100 as a code owner April 23, 2021 14:17
@rajivshah3
Copy link
Member

An alternative fix is to do a custom build of the rust RocksDB using this flag facebook/rocksdb#4469 which enables UTF8 support for windows filenames.

If I understand rust-rocksdb/rust-rocksdb#319 correctly, then shouldn't RocksDB already be built with this flag?

@obany
Copy link
Contributor Author

obany commented Apr 26, 2021

It would have been, but this recent PR removed it rust-rocksdb/rust-rocksdb#493 but the main rocksdb still uses that flag https://github.com/facebook/rocksdb/blob/d89483098ff4a77bd0ef12454a64554805984cc5/port/win/port_win.cc

@rajivshah3
Copy link
Member

Ah, I see. That's weird 🤔

}

return {
path: `${userDataPath}${sep}${WALLET_STORAGE_DIRECTORY}${sep}${profileDirName}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do this for the userDataPath too? For example if the path is C:\Users\üsername\AppData\Roaming\Firefly

Copy link
Contributor Author

@obany obany Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, actually that means this PR won't work as we don't have control over the replacing the characters in a user name, it has to be fixed with the RocksDB version :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that's annoying. I've opened rust-rocksdb/rust-rocksdb#512 to see if there was a reason that flag was removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the issue is in wallet.rs or stronghold then 🤔

Copy link
Contributor Author

@obany obany Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I traced through the code and its definitely in RocksDB its failing, specifically this line https://github.com/facebook/rocksdb/blob/cc1c3ee54eace876ad18c39f931e8e5039823930/port/win/env_win.cc#L1179

I am going to build a version locally to see if I can get it to work with the correct options.

Copy link
Contributor Author

@obany obany Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Managed to build a version 0.16.0 with the ROCKSDB_WINDOWS_UTF8_FILENAMES flag set, built wallet.rs to reference, and then used the new version with FF, and it works 🎉

Although there was some C++ code in rocksdb that wouldn't compile with the flag set, so had to update it 😅

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🎉

@obany
Copy link
Contributor Author

obany commented Apr 27, 2021

Closing this as it will be fixed with an updated wallet.rs PR

@obany obany closed this Apr 27, 2021
@rajivshah3 rajivshah3 deleted the fix/windows-non-ascii-profile branch April 27, 2021 19:32
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

Successfully merging this pull request may close these issues.

Special characters in the storage path cause a white screen on Windows
2 participants