'su' and 'env' helped a lot all that decades. Until everyone started using sodo passwordless :)
> If I instead run service foo start, the tool instead sends a message to PID 1 process to fork the service, inheriting everything from PID 1
Wait, you just want clean service ? I thinked usecase need to recognize how it is started and react to that ! But ok, send a signal 9 and inittabzerod will fork it with inheriting everything from pid 1 :)
> > And "spaces" problem is solved
> No, it's not
Ok, it isn't :) They even rewrote git in C to use file descriptors instead of text paths. But moustly it is becouse it is a very known problem with decades of solutions already implemented in common tools.
> Write a shell script that reads a shell command (that contains quoted arguments with spaces in them!) from a file, appends some extra arguments to that command, and runs that command
So: do shell meta programming in shell ?? :) That's clear abuse becouse shell is not general purpose programming language.
And how you do just that with systemd ? :)
But if you want some editable template file then oneliner in sed or awk or perl or ... with some structure will do. No need for introducing CVEs with new and soon to be rewriten or removed or abandoned parser somewhere in milions of lines.
If I run /etc/init.d/foo start to start a service, the service is forked from my current shell and therefore inherits everything from the shell. If I instead run service foo start, the tool instead sends a message to PID 1 process to fork the service, inheriting everything from PID 1. At that point, anything that can be changed could only have been changed by systemd itself, so if systemd doesn't know about something, then it can only be in the default state.
> And "spaces" problem is solved.
No, it's not. Write a shell script that reads a shell command (that contains quoted arguments with spaces in them!) from a file, appends some extra arguments to that command, and runs that command. The only way I could get that working was to go through Python instead.