dokku / dokku-daemon

A daemon wrapper around dokku
MIT License
32 stars 13 forks source link

Wrong shift in remove_flags()? #32

Closed Tashows closed 1 year ago

Tashows commented 1 year ago

https://github.com/dokku/dokku-daemon/blob/cde518d46c8cf3e0186bbbaa5848a5fc3586612a/bin/dokku-daemon#L81

I am not very familiar with shell scripts, but after trying to debug this it seems that if the input is apps:destroy app_name --force then it uses shift and the output is app_name --force. This in turn is recognized as an invalid command. While it is invalid, that is not the expected behavior for that function, or at least not expected behavior for that specific command syntax. Maybe it's supposed to catch --force flags from other commands? Should it also check if the current flag is the first argument? Or should these specific flags always be sent as the first argument (in which case this is totally expected)?

Would be happy to try and provide a PR, but I first want to make sure I understand the cases expected to be handled by that function.

josegonzalez commented 1 year ago

This code is essentially unmaintained, so honestly I don't know what should happen here.

Tashows commented 1 year ago

I ended up just being aware of when I use any of these flags and always moving them to expected position in the command issued to run via the daemon. Seems to work so far.