-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cqfd remove quotes in commands and additionnal commands #99
Comments
I work a bit on this and find a fix : With this fix, the command Fact is that with the above patch, cqfd take all the characters of the argument line, including all the quotes and pass it to the docker. In order to fix it properly, a solution would be to take the quotes except if it is the first character of the argument line. |
These are some notes, I have not yet the time to order all my ideas and write something that is well prepared. I will do some editing later. TL;DR; To be honest, I really like the goal of your change; I have always considered
Both CLI are valids, and they have to be handled by different commands (the Note: I would also remove the This is where the long story starts... All is a matter of the definition of the arguments... and the executable that are used underneath ( Unfortunately, the The argument(s?) given to
*: The strings are subject to be expanded; see bash(1), in particular sections QUOTING and EXPANSION. Important: Something really important to take into account is the This misleading is due to the instruction below that forwards the remaining arguments to Note: The proper instruction to save the arguments to a string variable is But, the arguments are forwarded to the function that wraps the But (once again), the arguments (actually, the single argument) are given as multiple arguments to entry-point of Finally, the arguments are forwarded to
Or, to
Additionnaly, looking at the
So, it looks the arguments are Long time ago... The See the option Lines 150 to 152 in 823c14e
How the Lines 132 to 133 in 823c14e
And how the Line 177 in 823c14e
And there: Lines 100 to 107 in 823c14e
The instructions But what about the extra argument? Conclusion
It should answer the following questions: What does
What does
|
@eroussy thanks for let me know the existence of that variable substitution. I use to use bash arrays to preserve a list of argument.
I think the run CLI is kind of broken and you should have a second verb to run your command. |
@joufella any special thoughs on this? |
ping? |
TL;DR; The command run takes arguments as if they are given to system() (i.e. the command_string is intepreted by sh -c). The command shell takes arguments as if they are given to execlp($SHELL, ...), and the new command exec takes arguments as they are given to execlp() (i.e. for the two last, the command is not interpreted by sh; except for the arguments that are not simple-quoted and that are subject to get interpreted by the current shell). In short: - cqfd run -> sh -c - cqfd shell -> sh - cqfd exec -> ssh This adds the exec command to run a command from within the container. The command consists of the exec-program and its arguments (if any), as it is given to the C function execlp(). The exec-program could be either a binary or a script. $ cqfd exec COMMAND [ARGUMENTS...] It is a distinct CLI to the commands run and shell that both takes a command_string as it is given to the C function system() (i.e. given to sh -c): - cqfd shell has three different forms: cqfd shell [command_file [argument...]] cqfd shell -c command_string [command_name [argument...]] cqfd shell -s [argument...] (requires CQFD_EXTRA_RUN_ARGS=-i for now) - cqfd run [-c] [command_string] takes a command_string as specified by sh(1) or the command= attribute from the file .cqfdrc. Important: the option -c of run is for concatenate and it is different to the option -c of sh(1). Note: The command exec (as the command shell) does not run the command= set in the file .cqfdrc. According to sh(1): argument The positional parameters ($1, $2, and so on) shall be set to arguments, if any. command_file The pathname of a file containing commands. If the pathname contains one or more <slash> characters, the implementation attempts to read that file; the file need not be executable. If the pathname does not contain a <slash> character: * The implementation shall attempt to read that file from the current working directory; the file need not be executable. * If the file is not in the current working directory, the implementation may perform a search for an executable file using the value of PATH, as described in Section 2.9.1.1, Command Search and Execution. Special parameter 0 (see Section 2.5.2, Special Parameters) shall be set to the value of command_file. If sh is called using a synopsis form that omits command_file, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_name A string assigned to special parameter 0 when executing the commands in command_string. If command_name is not specified, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_string A string that shall be interpreted by the shell as one or more commands, as if the string were the argument to the system() function defined in the System Interfaces volume of POSIX.1‐2017. If the command_string operand is an empty string, sh shall exit with a zero exit status. Fixes: savoirfairelinux#99
@eroussy, do you think the |
TL;DR; The command run takes arguments as if they are given to system() (i.e. the command_string is intepreted by sh -c). The command shell takes arguments as if they are given to execlp($SHELL, ...), and the new command exec takes arguments as they are given to execlp() (i.e. for the two last, the command is not interpreted by sh; except for the arguments that are not simple-quoted and that are subject to get interpreted by the current shell). In short: - cqfd run -> sh -c "$*" - cqfd shell -> sh "$@" - cqfd exec -> ssh "$@" This adds the exec command to run a command from within the container. The command consists of the exec-program and its arguments (if any), as it is given to the C function execlp(). The exec-program could be either a binary or a script. $ cqfd exec COMMAND [ARGUMENTS...] It is a distinct CLI to the commands run and shell that both takes a command_string as it is given to the C function system() (i.e. given to sh -c): - cqfd shell has three different forms: cqfd shell [command_file [argument...]] cqfd shell -c command_string [command_name [argument...]] cqfd shell -s [argument...] (requires CQFD_EXTRA_RUN_ARGS=-i for now) - cqfd run [-c] [command_string] takes a command_string as specified by sh(1) or the command= attribute from the file .cqfdrc. Important: the option -c of run is for concatenate and it is different to the option -c of sh(1). Note: The command exec (as the command shell) does not run the command= set in the file .cqfdrc. According to sh(1): argument The positional parameters ($1, $2, and so on) shall be set to arguments, if any. command_file The pathname of a file containing commands. If the pathname contains one or more <slash> characters, the implementation attempts to read that file; the file need not be executable. If the pathname does not contain a <slash> character: * The implementation shall attempt to read that file from the current working directory; the file need not be executable. * If the file is not in the current working directory, the implementation may perform a search for an executable file using the value of PATH, as described in Section 2.9.1.1, Command Search and Execution. Special parameter 0 (see Section 2.5.2, Special Parameters) shall be set to the value of command_file. If sh is called using a synopsis form that omits command_file, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_name A string assigned to special parameter 0 when executing the commands in command_string. If command_name is not specified, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_string A string that shall be interpreted by the shell as one or more commands, as if the string were the argument to the system() function defined in the System Interfaces volume of POSIX.1‐2017. If the command_string operand is an empty string, sh shall exit with a zero exit status. Fixes: savoirfairelinux#99
TL;DR; The command run takes arguments as if they are given to system() (i.e. the command_string is intepreted by sh -c). The command shell takes arguments as if they are given to execlp($SHELL, ...), and the new command exec takes arguments as they are given to execlp() (i.e. for the two last, the command is not interpreted by sh; except for the arguments that are not simple-quoted and that are subject to get interpreted by the current shell). In short: - cqfd run -> sh -c "$*" - cqfd shell -> sh "$@" - cqfd exec -> ssh "$@" This adds the exec command to run a command from within the container. The command consists of the exec-program and its arguments (if any), as it is given to the C function execlp(). The exec-program could be either a binary or a script. $ cqfd exec COMMAND [ARGUMENTS...] It is a distinct CLI to the commands run and shell that both takes a command_string as it is given to the C function system() (i.e. given to sh -c): - cqfd shell has three different forms: cqfd shell [command_file [argument...]] cqfd shell -c command_string [command_name [argument...]] cqfd shell -s [argument...] (requires CQFD_EXTRA_RUN_ARGS=-i for now) - cqfd run [-c] [command_string] takes a command_string as specified by sh(1) or the command= attribute from the file .cqfdrc. Important: the option -c of run is for concatenate and it is different to the option -c of sh(1). Note: The command exec (as the command shell) does not run the command= set in the file .cqfdrc. According to sh(1): argument The positional parameters ($1, $2, and so on) shall be set to arguments, if any. command_file The pathname of a file containing commands. If the pathname contains one or more <slash> characters, the implementation attempts to read that file; the file need not be executable. If the pathname does not contain a <slash> character: * The implementation shall attempt to read that file from the current working directory; the file need not be executable. * If the file is not in the current working directory, the implementation may perform a search for an executable file using the value of PATH, as described in Section 2.9.1.1, Command Search and Execution. Special parameter 0 (see Section 2.5.2, Special Parameters) shall be set to the value of command_file. If sh is called using a synopsis form that omits command_file, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_name A string assigned to special parameter 0 when executing the commands in command_string. If command_name is not specified, special parameter 0 shall be set to the value of the first argument passed to sh from its parent (for example, argv[0] for a C program), which is normally a pathname used to execute the sh utility. command_string A string that shall be interpreted by the shell as one or more commands, as if the string were the argument to the system() function defined in the System Interfaces volume of POSIX.1‐2017. If the command_string operand is an empty string, sh shall exit with a zero exit status. Fixes: savoirfairelinux#99
When inside a git repository, running
git commit -m "some message"
will create a new commit, but runningcqfd run git commit -m "some message"
send an error :error: pathspec 'message' did not match any file(s) known to git
.This error is the same when running
git commit -m some message
(without the double quotes) inside a terminal without cqfd.cqfd seems to remove the quotes when running a custom command. It does it also with additional commands when running
run -c
..cqfdrc
.cqfd/docker/Dockerfile
Run a
git init
inside the current directory to have git supportThe text was updated successfully, but these errors were encountered: