You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is on 0.30.3. The issue is that the stat file on Linux is parsed under the assumption that it contains valid UTF-8. This is not necessarily the case for two reasons:
Process names don't need to be valid UTF-8 at all on Linux. They can contain invalid bytes.
Even if the process name was valid UTF-8, the assumption breaks because the process name is limited to 15 characters, which can cut a valid code point in half.
This causes the stat file to not be parseable, causing the entire process not to show up in the list. So even if I wasn't using the name of the process at all, I can't find it as part of the list.
To Reproduce
I named an executable process-name-töööö, which cuts one of the ö in half.
I have a fixed branch locally, but I want to discuss what the best solution is before doing a PR. My branch lossily converts the process name to a string. However this means that the Unicode replacement character � is now part of those process names. The character when encoded as UTF-8 is 3 bytes. This means that process names can now be longer than 15 bytes, or in other words, doing a name based comparison on the first 15 bytes, such as somewhat suggested in the documentation of the crate, is no longer easily possible. Maybe the solution instead is to just provide the name as an OsStr instead, keeping the bytes around as is. Rust recently made OsStr way more easily usable by allowing you to access its bytes directly.
The text was updated successfully, but these errors were encountered:
Describe the bug
This is on 0.30.3. The issue is that the stat file on Linux is parsed under the assumption that it contains valid UTF-8. This is not necessarily the case for two reasons:
This causes the stat file to not be parseable, causing the entire process not to show up in the list. So even if I wasn't using the name of the process at all, I can't find it as part of the list.
To Reproduce
I named an executable
process-name-töööö
, which cuts one of theö
in half.I have a fixed branch locally, but I want to discuss what the best solution is before doing a PR. My branch lossily converts the process name to a string. However this means that the Unicode replacement character
�
is now part of those process names. The character when encoded as UTF-8 is 3 bytes. This means that process names can now be longer than 15 bytes, or in other words, doing a name based comparison on the first 15 bytes, such as somewhat suggested in the documentation of the crate, is no longer easily possible. Maybe the solution instead is to just provide the name as anOsStr
instead, keeping the bytes around as is. Rust recently madeOsStr
way more easily usable by allowing you to access its bytes directly.The text was updated successfully, but these errors were encountered: