Re:Why would you still want to use strace in 2023? [video]
by amelius on Monday January 08, 2024 @04:33AM
(#38909824)
Ok, but then you will still need to parse the output to get the filenames. That's ok, but since it is something that is used a lot, you'd expect a flag.
[ Parent
| on HN ]
Re:Why would you still want to use strace in 2023? [video]
by tanelpoder on Monday January 08, 2024 @04:50AM
(#38909959)
Check out strace -y and strace -yy (--decode-fds)
Re:Why would you still want to use strace in 2023? [video]
by zwp on Monday January 08, 2024 @05:12AM
(#38910100)
You still need to pull out the paths?
A sprinkling of grep/perl (awk/sed/ruby/...) is mostly good enough eg:
strace -e trace=%file cat /etc/passwd 2>&1 >/dev/null | grep ^open | grep -Po '(?<=").*(?=")'
Re:Why would you still want to use strace in 2023? [video]
by eesmith on Monday January 08, 2024 @06:04AM
(#38910437)
Is your example situation really all that common?
If so, what format do you expect for the output?
If it's one filename-per-line then how do you encode filenames with embedded newlines?
How do you encode non-UTF8 characters, or is the file meant to be parsed only in binary mode?
I don't know of any generally agreed upon spec for this, so no matter what you think is right, most people are going to have to write a special-purpose parser.
In which case you might as well parse the native strace output since one is about as complex as the other.