troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
634 stars 63 forks source link

task/run stanza: specifying more than one command with ; or && unsupported #376

Closed az143 closed 1 year ago

az143 commented 1 year ago

doc/service.md says

Both run and task commands are run in a shell, so pipes and redirects can be freely used:

but trying to use something like

task [S] /bin/simplething && /bin/otherthing

fails with the error message failed wordexp(\&&)

the same fault is triggered if you try to connect two commands with a semicolon. to me it looks like lines 729ff in service.c are the at fault here: first semicolons are not looked for with that strchr(), and second (as indicated by the comment above) no more than one of each metachar is escaped.

i think this should either be extended to fully quote shell metas, or the documetation in doc/service.md should be adjusted to reflect the limitation.

troglobit commented 1 year ago

All run/task/services are unique per the base command, so ;, &&, or || will never be supported. This is a limitation and should be clarified in the documentation.

az143 commented 1 year ago

how does unique per the base command, pipes are supported and the use of name:someuniqeid interact? there's not much structural difference between a pipeline (supposedly supported) and && (not).

troglobit commented 1 year ago

I'm just trying to state, using my poor English, what I'm prepared to support in Finit, and have tested. If you want to run multiple commands I suggest you put them in a script instead.

az143 commented 1 year ago

no problem, i'm not complaining; i just found the distinction between pipe and non-piped multi-process command a little arbitrary. anyway, a simple note in the documentation will do fine and fewer poeple will be surprised in the future. i'm happy to send a PR for that.

troglobit commented 1 year ago

Sure

troglobit commented 1 year ago

Shell limitations to run/task stanzas added to doc/config.md.