Closed alopukhov closed 4 months ago
cc @charliemirabile
Looks good. Thanks for picking up where I left off. I was hesitant to introduce another whole process into the already somewhat complex way that rootlesskit launches the app as part of #429 especially for a first contribution and given my lack of experience with Go.
It is unfortunate that fork and exec are so tightly coupled in Go (though this of course helps with making the language suitable for cross platform development for other projects), since in C, it would be as easy as inserting a call to setenv in the code between fork and exec whereas here we need to introduce a whole other program as a shim and successfully plumb all the relevant info through it, but your implementation looks sane.
Could you squash the commits?
Proposal on https://github.com/rootless-containers/rootlesskit/issues/448 Fixing LISTEN_PID env variable for target process if it equals to PID of [rootlless:parent] process.
Tested with dockerd. Extra $$ script is not required anymore.
Can be demonstated.
Example output for v2.1.0: