2 ms·
This is why we can't have nice things. Security footguns everywhere! I'm fascinated by the intersection of argv[0], and the execve behavior of replacing the ca
by keepamovin 2y ago
This is why we can't have nice things. Security footguns everywhere!
I'm fascinated by the intersection of argv[0], and the execve behavior of replacing the calling program with the called one.
Aside from that, I quite like argv[0], for a much more limited set of reasons than considered in this interesting and comprehensive article. I like the ability to "retitle" a process to put a useful, descriptive, or branded name in there to be seen by ps, et al.
NodeJS also exposes this feature, but not quite as you might expect. Whereas in C, setting argv[0] from within the program's execution context will alter what is observed by ps, in NodeJS process.argv is just a descriptive getter. Setting its slots has no effect outside of its context.
But this is where process.title steps in. Setting process.title allows you to (in an OS-dependent way) change the name reported in ps and similar tools.
Read more here: https://nodejs.org/api/process.html#processtitle https://nodejs.org/api/process.html#processtitle
Please don't kill argv[0], its lease hath all too short a date
- kelsey98765431 2y agoYour fascination is rewarded by reading the other man sections such as section three: https://linux.die.net/man/3/execve https://linux.die.net/man/3/execve If you already know about the additional man pages beyond user space, i cannot more strongly recommend diving into them. Additionally the gnu 'info coreutils' is a good place to start, as well as the glibc manual.