5 ms·
I remember reading about a project that let you "preview" the effects (e.g. file changes) of terminal commands by using ptrace to intercept the syscalls and jus
by mimimi31 6y ago
I remember reading about a project that let you "preview" the effects (e.g. file changes) of terminal commands by using ptrace to intercept the syscalls and just logging them instead. Maybe you could do something similar here to prevent accidental file deletions.
- nabakin 6y agoMy first thought was to sandbox the executable but this sounds even better. Is it hard to implement the interception of all syscalls? And can file reads be distinguished from file writes?
- simcop2387 6y agoNot terribly hard to do, and yes you can distinguish reads, writes, etc. A tool to log syscalls to see what might be possible is strace, it's incredibly useful for debugging a misbehaving application that either you don't have all the source for or it's gigantic codebase that you don't understand. Seeing which files a program is looking for is often all you need to figure out why it's behaving the way it is (i.e. locating an undocumented/badly documented/incorrectly documented config file)
- alvarlagerlof 6y agoWow that would be cool
- minxomat 6y agoThat's maybe: https://github.com/p-e-w/maybe https://github.com/p-e-w/maybe
- adictator 6y agoWow. That sounds like a really handy tool. Can it be used to debug programs, maybe?
- akavel 6y agoPlease note that up respects $SHELL, so if you find a way to set $SHELL to point to maybe (possibly wrapped in some helper script) in a useful manner, it might actually work! I'd highly appreciate an issue with a report/guide for that then on up, others might find that helpful! For details, see: https://github.com/akavel/up/releases/tag/v0.3 https://github.com/akavel/up/releases/tag/v0.3
- minxomat 6y agoI'm not affiliated with maybe, and it's also no longer maintained. I don't know if there's a newer, better tool out there.