Skip to content
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

use full cmdline in case of proc renaming #542

Merged
merged 1 commit into from
Jul 5, 2018
Merged

Conversation

gescheit
Copy link
Contributor

@gescheit gescheit commented Jun 23, 2018

If some process call prctl with PR_SET_NAME it change proc name field. If there is a slash after proc path, filepath.Base() make mess with it. For example:
1 execute python3.5 ./test.py
2 set proc title to "python3.5 ./test.py [test]"
3 cat /proc/self/stat
1234 (python3.5 ./tes) ...
4 now this code

cmdlineSlice, err := p.CmdlineSlice()
if strings.HasPrefix(extendedName, p.name) {
    p.name = extendedName

is trying to compare extendedName(test.py [test]) with p.name(python3.5 ./tes). And it fail.

@gescheit
Copy link
Contributor Author

gescheit commented Jul 5, 2018

Any news?

@shirou
Copy link
Owner

shirou commented Jul 5, 2018

I am not sure because I never use PR_SET_NAME, but it seems reasonable. Thank you for your contribution!

@shirou shirou merged commit 63728fc into shirou:master Jul 5, 2018
Lomanic added a commit to Lomanic/gopsutil that referenced this pull request Jul 1, 2023
…same value on python3 scripts processes

e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any excutable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts shirou#542

Fixes shirou#1485
Lomanic added a commit to Lomanic/gopsutil that referenced this pull request Jul 5, 2023
…same value on python3 scripts processes

e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any excutable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts shirou#542

Fixes shirou#1485
Lomanic added a commit to Lomanic/gopsutil that referenced this pull request Jul 6, 2023
…same value on python3 scripts processes

e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any excutable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts shirou#542

Fixes shirou#1485
Lomanic added a commit to Lomanic/gopsutil that referenced this pull request Jul 8, 2023
…same value on python3 scripts processes

e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any executable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts shirou#542

Fixes shirou#1485
chenjiandongx added a commit to TencentBlueKing/gopsutil that referenced this pull request Aug 29, 2023
* fix some comments

Signed-off-by: cui fliter <[email protected]>

* chore(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.2 to 1.8.3.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.2...v1.8.3)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix(mem): Correct capitalization of linux writeback

fixes: shirou#1471

* chore(deps): bump github.com/yusufpapurcu/wmi from 1.2.2 to 1.2.3

Bumps [github.com/yusufpapurcu/wmi](https://github.com/yusufpapurcu/wmi) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/yusufpapurcu/wmi/releases)
- [Commits](yusufpapurcu/wmi@v1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: github.com/yusufpapurcu/wmi
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* [common]: fix potential leak on Sleep.

* chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.3 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.3...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* allow to pass context values to override environment variables

* move the Env key out of internal packages

* change to use a typed map per code review

* lint fixes

* remove deprecation comments

* add more env keys

* apply code review

* fix more linting reports

* add(README): add passing context value document

which is introduced by shirou#1439.

* Ref actions by commit SHA in build_test.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/setup-go/releases/tag/v4.0.1
actions/setup-go@fac708d

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5

https://github.com/actions/cache/releases/tag/v3.3.1
actions/cache@88522ab


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in labeler.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/labeler/releases/tag/v4.1.0
actions/labeler@9fcb2c2


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in lint.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/setup-go/releases/tag/v4.0.1
actions/setup-go@fac708d

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5

https://github.com/golangci/golangci-lint-action/releases/tag/v3.5.0
golangci/golangci-lint-action@5f1fec7


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in release.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in sbom_generator.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5

https://github.com/advanced-security/sbom-generator-action/releases/tag/v0.0.1
advanced-security/sbom-generator-action@375dee8

https://github.com/actions/upload-artifact/releases/tag/v3.1.2
actions/upload-artifact@0b7f8ab


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in shellcheck.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5

https://github.com/ludeeus/action-shellcheck/releases/tag/2.0.0
ludeeus/action-shellcheck@00cae50


Signed-off-by: Gabriela Gutierrez <[email protected]>

* Ref actions by commit SHA in test.yml

It's important to make sure the SHA's are from the original repositories and not forks.

For reference:

https://github.com/actions/setup-go/releases/tag/v4.0.1
actions/setup-go@fac708d

https://github.com/actions/checkout/releases/tag/v3.5.2
actions/checkout@8e5e7e5

https://github.com/actions/cache/releases/tag/v3.3.1
actions/cache@88522ab


Signed-off-by: Gabriela Gutierrez <[email protected]>

* chore(deps): bump actions/checkout from 3.5.2 to 3.5.3

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@8e5e7e5...c85c95e)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump golangci/golangci-lint-action from 3.5.0 to 3.6.0

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.5.0 to 3.6.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@5f1fec7...639cd34)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump golang.org/x/sys from 0.8.0 to 0.9.0

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.8.0 to 0.9.0.
- [Commits](golang/sys@v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* cpu_percent and memory_percent update

* chore(deps): bump actions/labeler from 4.1.0 to 4.2.0

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](actions/labeler@9fcb2c2...0967ca8)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* [process] Remove all noisy and useless Test_AllProcesses_X tests

These tests can't fail more than their invidiual counterparts and produce an incredibly verbose output

* chore(deps): bump golang.org/x/sys from 0.9.0 to 0.10.0

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.9.0 to 0.10.0.
- [Commits](golang/sys@v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* [process][posix] Realign process.Name() with python psutil to return same value on python3 scripts processes

e2c79a1 started to blindly set the process name to the full path (instead of the basename) of the cmdline exectuable
if the process name from the process comm was truncated on linux. Python psutil never did that, and this is just wrong
for python (or any executable interpreted script) where the process name is not the interpreter binary but the script
itself.

A new test to check process name value against psutil value is added here, which would hopefully catch any potential
future changes in psutil.

Reverts shirou#542

Fixes shirou#1485

* chore(deps): bump actions/labeler from 4.2.0 to 4.3.0

Bumps [actions/labeler](https://github.com/actions/labeler) from 4.2.0 to 4.3.0.
- [Release notes](https://github.com/actions/labeler/releases)
- [Commits](actions/labeler@0967ca8...ac9175f)

---
updated-dependencies:
- dependency-name: actions/labeler
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Enable setting of vendor and related information for all Power versions

* chore(deps): bump golang.org/x/sys from 0.10.0 to 0.11.0

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.10.0 to 0.11.0.
- [Commits](golang/sys@v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* mem: linux: fix vmstat field names

The field names are read from /proc/vmstat were capitalized as their
output fields by mistake

* chore(deps): bump github.com/tklauser/go-sysconf from 0.3.11 to 0.3.12

Bumps [github.com/tklauser/go-sysconf](https://github.com/tklauser/go-sysconf) from 0.3.11 to 0.3.12.
- [Release notes](https://github.com/tklauser/go-sysconf/releases)
- [Commits](tklauser/go-sysconf@v0.3.11...v0.3.12)

---
updated-dependencies:
- dependency-name: github.com/tklauser/go-sysconf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump actions/setup-go from 4.0.1 to 4.1.0

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.1 to 4.1.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@fac708d...93397be)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: fixed windows disk package leaks
- fixed goroutine leak in PartitionsWithContext
- closed registry handle in init

* [host][linux]: remove double quote from lsb release info

fix: shirou#1502

* chore(deps): bump golangci/golangci-lint-action from 3.6.0 to 3.7.0

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.6.0 to 3.7.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](golangci/golangci-lint-action@639cd34...3a91952)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix IOCounters() SerialNumber enumeration

* Update disk/disk_linux.go

Co-authored-by: shirou <[email protected]>

* update comment

* comment cleanup

* chore(deps): bump actions/checkout from 3.5.3 to 3.6.0

Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 3.6.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@c85c95e...f43a0e5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

---------

Signed-off-by: cui fliter <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Gabriela Gutierrez <[email protected]>
Co-authored-by: cui fliter <[email protected]>
Co-authored-by: shirou <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Powers <[email protected]>
Co-authored-by: Antoine Toulme <[email protected]>
Co-authored-by: Gabriela Gutierrez <[email protected]>
Co-authored-by: Elfranne <[email protected]>
Co-authored-by: Lomanic <[email protected]>
Co-authored-by: Kishen V <[email protected]>
Co-authored-by: Hugo Beauzée-Luyssen <[email protected]>
Co-authored-by: Ozan HACIBEKİROĞLU <[email protected]>
Co-authored-by: Greg Dallavalle <[email protected]>
Co-authored-by: Greg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants