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

fix: permission denied reading stacks file #174

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

domodwyer
Copy link
Contributor

@domodwyer domodwyer commented Nov 20, 2021

Ensures the cargo-flamegraph.stacks file generated when using the dtrace profiler can be read to be collapsed by setting the owner to $USER instead of root 👍

Fixes #173.


  • fix: set cargo-flamegraph.stacks file owner (ae0f5d9)

    This commit adds code to execute:
    
    	sudo chown $USER cargo-flamegraph.stacks
    
    When the following conditions are met:
    
    	* The flamegraph was generated with dtrace (aka. not on Linux)
    	* The user passed --root on the command line
    	* The USER env is set
    
    This ensures the cargo-flamegraph.stacks file wrote by dtrace as "root" is
    readable by the non-root user.
    
  • refactor: fix clippy lint (e9164ca)

    Removes redundant 'static on const vars.
    

This commit adds code to execute:

	sudo chmod $USER cargo-flamegraph.stacks

When the following conditions are met:

	* The flamegraph was generated with dtrace (aka. not on Linux)
	* The user passed --root on the command line
	* The USER env is set

This ensures the cargo-flamegraph.stacks file wrote by dtrace as "root"
is readable by the non-root user.
Removes redundant 'static on const vars.
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for fixing it up!

@domodwyer
Copy link
Contributor Author

Thanks @djc! Any chance of getting this merged?

@djc djc merged commit 7a51db4 into flamegraph-rs:main Dec 9, 2021
@djc
Copy link
Contributor

djc commented Dec 9, 2021

Yup, sorry for the delay. Thanks!

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.

bug: permission denied reading stacks file with dtrace + root (macOS)
2 participants