-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Process.GetProcesses returns truncated 15 char string on Linux #28346
Comments
Thanks for the pointer to the MacOS bug fix. It seems Linux has a similar limit. Here is a process with a 30 character name, only 15 show:
This is because |
It looks like
|
It looks like we already get the full exe path from this file. We just need to use it a few lines higher up (cropping off the path) instead of the stat entry |
@2E0PGS any interest in making this change, with a unit test? |
Thanks for pulling out those lines and doing a few basic tests. I will have a further look at the code base and check what unit tests are in place at the moment. I will try give it a shot if I get some free time. Otherwise I will let you know if I am too busy to make the change. |
OK, thanks. As for Mac it seems we do not use /proc/../stat but it would be nice to have a test (need not be you of course) |
@2E0PGS do you think you might give this a go? Let me know if you need pointers getting set up? |
Sorry been very busy. Yes I was just reading the dotnet core wiki for setting up the development environment. Hopefully I can give it a go soon. |
I don't quite know know why the solution doesn't pickup the distro specific cs files. |
Got a build done, just need to see how I am going to run this inplace of regular dotnet core on the system to check it against my test program. |
Have you written a unit test? Take a look at existing tests under Systrm.Diagnostics.Process/tests. There are some that launch processes. You could follow the pattern but rename the file to a long name before launching. Or possibly copy "sleep" to a long name version then run it with a large value, read the name, then terminate it and delete it. This assumes all distros have sleep. |
Thanks will try that when back home.
Sent from BlueMail
…On 2 Feb 2019, 19:17, at 19:17, Dan Moseley ***@***.***> wrote:
Have you written a unit test? Take a look at existing tests under
Systrm.Diagnostics.Process/tests. There are some that launch processes.
You could follow the pattern but rename the file to a long name before
launching. Or possibly copy "sleep" to a long name version then run it
with a large value, read the name, then terminate it and delete it.
This assumes all distros have sleep.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/dotnet/corefx/issues/34437#issuecomment-459991461
|
I got this so far: 2E0PGS/corefx@691e55e Just need to test this on Linux. |
OK so implementing those changes: 2E0PGS/corefx@e1e308c Using my test program the output we had before any of my changes looked like this and it had a name for every process.
Using the recent commit I linked above the test program has quite a few processes without names.
|
However the names are now longer than 15 chars. We need to investigate why some are blank. |
It appears |
If the exe has already terminated, it seems that /proc/nnn can exist, but /proc/nnn/exe won't exist: https://linux.die.net/man/5/proc |
In such a case you could stick with The other place where GetExePath happens
..would be blank, but in simple experiments, it seems like when /proc/nnn/exe is missing, so is /proc/nnn/maps, so this line would not be reached. |
In a really quick look, it seems like mono gets the path from the first line of /proc/nnn/maps, so it doesn't have a better way either. |
As for a test to copy, |
Are you suggesting we try |
Was out of office -- @2E0PGS yes, I think so. Try that, plus a test? |
I will give that a try soon thanks. |
Just building a new corefx now to test it against a CLI app. |
Ok this commit works well: 2E0PGS/corefx@56e7385 Test CLI program output:
No missing process names now. |
Great, do you want to create a test and put up a PR? |
Yes I will try create a test for it.
Cheers,
…On 25 Feb 2019, 04:56, at 04:56, Dan Moseley ***@***.***> wrote:
Great, do you want to create a test and put up a PR?
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/dotnet/corefx/issues/34437#issuecomment-466872059
|
Thanks @2E0PGS |
@2E0PGS hello, are you still working on this one? I think only test remains? You could throw up a PR just for work in progress, that others could comment on. |
Yes I been busy with work. Probably wouldn't have another chance to look until weekend.
If you need quicker fix then I'll create a PR for someone else to create the test for?
Cheers,
…On 5 Mar 2019, 21:06, at 21:06, Dan Moseley ***@***.***> wrote:
@2E0PGS hello, are you still working on this one? I think only test
remains? You could throw up a PR just for work in progress, that others
could comment on.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/dotnet/corefx/issues/34437#issuecomment-469856754
|
@2E0PGS totally fine. It's just us keeping the pipes flowing rather than any particular urgency for this one. |
When using
Process.GetProcesses()
in dotnet core it returns theProcess.ProcessName
property fine under Windows as expected.However when ran under Linux (Tested on Ubuntu 17.04) it seems to return process names as 15 char long strings. It truncates the process names to all be 15 char long strings.
My applogies if there is an issue for this somewhere under another repo. I found there was such an issue with the mono framework when doing research prior to submitting this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=32539
The text was updated successfully, but these errors were encountered: