Repository navigation
Fix Parent property on processes with complex name - #17545
Conversation
There was a problem hiding this comment.
The proposal looks very expensive. I'd prefer #12925.
There was a problem hiding this comment.
Is the concern around the regex, the reading of multiple lines or something else? If it's the regex this could be changes to just doing line.StartsWith("PPid: ") and extract it from there but I thought regex gives some nicer validation.
My only concern about #12925 is if any extra entries are added to the stat file in the future that could mess with the LastIndexOf(')') check. I have no idea what the chances are of that happening but the file certainly has had additions in the past so I can't rule it out.
There was a problem hiding this comment.
the additional cost of the regex is probably not worth it as the StartsWith("PPid: ") will do the trick. If you're really stuck on using regex, i'd be much happier if this was compiled once and continually reused.
There was a problem hiding this comment.
Jordan Borean (@jborean93) is there any concern using StartsWith() and then splitting out the pid trimming the whitespace instead of a regex?
There was a problem hiding this comment.
The regex just ensure it's PPid: digit but considering this is probably mandated in the spec it's probably not something to be concerned about. I can change it to StartsWith("PPid: ") but didn't think regex would be that bad of a performance problem and is somewhat simpler to extract the match.
There was a problem hiding this comment.
Jordan Borean (@jborean93) Any chance to get the proposed changes done? Thanks!
There was a problem hiding this comment.
Sorry will get to this next week, just on holidays at the moment.
There was a problem hiding this comment.
Has been updated to use StartsWith instead as per the suggestion.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
James Truher (@JamesWTruher) can you please review this PR? |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
Fix the `Parent` property to retrieve the parent process on Linux where the process name has complex characters like a space or parenthesis.
|
Looks like there might be a problem with using |
commented
Sep 20, 2022
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
commented
Sep 20, 2022
Using |
| while true; do sleep 1; done | ||
| '@ | ||
|
|
||
| # Can't use testdrive: as unelevated user doesn't have perms in test in CI |
There was a problem hiding this comment.
Please reword:
| # Can't use testdrive: as unelevated user doesn't have perms in test in CI | |
| # Can't use 'Testdrive:' as unelevated user doesn't have permissions to do 'chmod'. |
I guess it is because .Net 7 RC1 has a breaking change in Directory.Create() where chmod mask was changed. If so, it might still break something in PowerShell or Pester.
/cc Jakub Jareš (@nohwnd)
There was a problem hiding this comment.
I assumed this was just a byproduct of how PowerShell CI is set up. I've not looked into it but I believe the unelevated user may potentially be inheriting the same tmpdir as the elevated account and thus cannot set the execute bit on files in that dir. This is just a guess so your assumption could also be true.
left a comment
There was a problem hiding this comment.
LGTM. Thanks Jordan Borean (@jborean93)!
commented
Sep 29, 2022
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
commented
Sep 29, 2022
|
Dongbo Wang (@daxian-dbw) Ready to merge? |
commented
Sep 29, 2022
|
Thanks everyone for your reviews and suggestions. |
commented
Sep 29, 2022
|
Jordan Borean (@jborean93) Thanks for your contribution! |
PR Summary
Fix the
Parentproperty to retrieve the parent process on Linux wherethe process name has complex characters like a space or parenthesis.
PR Context
Reads from
/proc/[pid]/statusrather than/proc/[pid]/staton Linux to get the parent process id. Thestatusfile is nicer as each entry is on a newline and has a label making it easier to select the data required. This is an alternative approach to deal with process' with a space and parenthesis in the name avoiding the last index of logic or trying to correctly select the proper column in thestatfile.Fixes #12908
Fixes #17541
Alternative to #12925
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).