bloomberg / pystack

🔍 🐍 Like pstack but for Python!
https://bloomberg.github.io/pystack
Apache License 2.0
1.01k stars 45 forks source link

Support running on gz files directly #168

Closed gaborbernat closed 3 months ago

gaborbernat commented 7 months ago

Is there an existing proposal for this?

Is your feature request related to a problem?

Core dumps are often automatically archived to save disk space (in my case using the .gz) format. However, pystack does not allow running directly on these files, requiring a raw core dump. This means it introduces an extra manual step of unzipping the core dump before I can use pystack to see the stacktrace.

Describe the solution you'd like

pystack should automate this kind of core dump extraction; it could see the file ends with .gz and call gzip unarchive in a temp file, and run against the temp file. This would be a quality of life improvement.

Alternatives you considered

Keep doing the manual method...

godlygeek commented 7 months ago

This sounds reasonable to me. It seems reasonable to check whether a file is or isn't a gzip file (not based on its file extension but based on its contents), and if so to extract it to a temp file. Without checking the code, I'm guessing that we probably need a NamedTemporaryFile and can't get by with just a tempfile.TemporaryFile

pablogsal commented 3 months ago

Fixed by #171