Bad parsing of `ps` output if command field is not the last one
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 737
- Forks
- 214
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported by Matthias Teege on google groups
Rex uses the ps command to gather the process information by splitting the output lines on whitespaces (/\s+/) to extract the different fields, while keeping the maximum number of extracted fields to the number of expected fields.
Since the command field of the output itself can contain spaces (e.g. /usr/bin/perl /usr/bin/perldoc Rex::Commands::Process), this method only can work if ps is asked to output the command field as the last one on the line (so it is prevented from being split on whitespaces as the maximum allowed number of splits already happened).
Rex either needs to somehow gather the process information in a machine-parsable format, or at least try to ensure that if command field is requested, then it is being used as last.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the code that invokes ps and parses its process-information output, then inspect how requested fields are ordered and split. Done means commands containing spaces are parsed correctly when command is not last, using a machine-parsable format or ensuring that field is last.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100