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
Linux: show newlines in commands as ? instead of space #1472
Conversation
linux/LinuxProcessTable.c
Outdated
@@ -1172,6 +1172,12 @@ static bool LinuxProcessTable_readCmdlineFile(Process* process, openat_arg_t pro | |||
|
|||
/* newline used as delimiter - when forming the mergedCommand, newline is | |||
* converted to space by Process_makeCommandStr */ | |||
if (argChar == '\n') { | |||
/* Set to some other non-pritnable character */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo.
Why choose |
The problem with U+240A at this particular code location is, that the string is still in UTF-8 at this location and thus doing this replacement would require additional memory to be allocated. |
I just wish this problem to have a long term solution. There should be ideally be a uniform way to sanitize and escape the characters from the |
We could allocate the |
Since \n is used internally by htop to split command lines, replace \n with \r in command lines to not display them as space. Merging the command string will not work, but newlines in commands should be rather the exception.
This fix is just so that newlines in commands are not displayed as spaces, but as unknown characters (in |
Since
\n
is used internally by htop to split command lines, replace\n
with\r
in command lines to not display them as space.Merging the command string will not work, but newlines in commands should be rather the exception.