Add warning if run command has multiple arguments#187
Add warning if run command has multiple arguments#187gportay wants to merge 2 commits intosavoirfairelinux:masterfrom
Conversation
| # Run alternate command | ||
| has_alternate_command=true | ||
|
|
||
| # Display a warning message if using run with multiple arguments |
There was a problem hiding this comment.
this warning depends on if we really want to make cqfd run disappear totally or keep it for retrocompatibility
There was a problem hiding this comment.
Yes kind of. but there is a world before removing the command run and just deprecating it using a warning telling to switch to another command.
So up to you.
There was a problem hiding this comment.
Yes but the question is: do we really want to make people forget the "run" keyword ? If we don’t want that, then it is not necessary to put a warning.
run is used everywhere so it will be cumbersome for people to change, especially since there is no real issue with it at the moment, it works sufficiently well for what we need.
There was a problem hiding this comment.
The run command does not work properly since cqfd run "touch foo" and cqfd run touch foo expect the same result. Since the command cannot forward the parameters property to the container, I suggest to move to another command that does it correctly.
This would prevent people to file an issue because it cannot deal with parameters:
cqfd run bash -c 'echo $0 $# $*' zero one two three
# no output because it runs bash -c echo $0 $# $* zero two three. the command string is word split.
# sh -c [-abCefhimnuvx] [-o option]... [+abCefhimnuvx] [+o option]... command_string [command_name [argument...]]
# with command_string is echo instead of echo "$0 $# $*"
# arguments are: $0, $#, $*, zero, one, two, three instead of zero, one, two, threeThe example below shows how the run command it broken.
So my opinion is to tell the user the command is broken and it should move to another one, as it does not work for every use case.
And we cannot fix it because the people using it as cqfd run "touch foo" would file an issue because it does not work anymore, and that example was part of the README.md.
So deprecating it is the only solution.
|
My point of view is that we can make |
As said... "And we cannot fix it because the people using it as cqfd run "touch foo" would file an issue because it does not work anymore, and that example was part of the README.md." We can leave this alone, if you wish and leave this it its own state. It is broken for years now. EDIT; The sudoization of |
|
With sudoization, what would |
It will fail because there is no "touch foo" binary. The correct command would be Currently it is |
|
okay okay it is getting more and more clear in my mind, but I’m almost sure we will never get rid of For example when you reuse a very old project which has an old cqfdrc and old pipeline jobs, it is always comfortable if it still runs. But I’m ok to display warning for the And I would combine that with a sudoization not breaking backward compatibility, i.e. we keep |
Yes. Furthermore, it is just a warning that does not mention about possible deprecation. |
The command run is ambiguous. This adds a warning if the command is run with multiple arguments telling to use either exec or shell, depending if the arguments is simple command or a list of commands. See 344969c.
14438d8 to
a98bc7d
Compare
This adds a warning if the command with the concatenate option is run with multiple arguments as the command run is ambigous and it does not preserve the whitespaces.
a98bc7d to
83636d1
Compare
Dear Maintainers,
I think the command
run command_stringis ambiguous, and cqfd should tell the user to switch tocqfd exec PROGRAM [ARGUMENTS...]if thecommand_stringis a single command or tocqfd shell -c "command_string"if thecommand_stringis a list of command.More information in 344969c.
What do you think about this?