Unable to run commands with `/bin/bash -c` in v19.12.0
See original GitHub issueIssue Type
- Bug Report
Summary
GoCD v19.12.0
Steps to Reproduce
Run a job with the following command
<exec command="/bin/bash">
<arg>-c</arg>
<arg>echo $HOME</arg>
<runif status="passed" />
</exec>
Expected Results
You should see the current path stored in the $HOME
env var.
Actual Results
[go] Task: /bin/bash -ctook: 0.103sexited: 2
"echo $HOME"
/bin/bash: -
: invalid option
Usage: /bin/bash [GNU long option] [option] ...
/bin/bash [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--rcfile
--restricted
--verbose
--version
Shell options:
-ilrsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
[go] Task status: failed, took: 0.103s, exited: 2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
'\r': command not found - .bashrc / .bash_profile - Stack Overflow
Try running the dos2unix command on the file in question. It might help when you see error messages like this: -bash: '\r': command...
Read more >Cygwin error - Failed to run '/bin/bash': No such file or directory
I solved it by going to "C:\cygwin64\bin" and duplicating "ash.exe" and renaming the copy to "bash.exe". (I was trying this by pure chance,...
Read more >Running bash scripts | Cloud Build Documentation
In the example below, the bash entrypoint is used to run gcloud commands that query Cloud Build for build status, listing builds with...
Read more >command not found" errors running Bash scripts in WSL?
The easiest way to fix the problem is really to just download the files you need inside the Ubuntu system from your bash...
Read more >Shell search PATH – finding and running commands
1 Shells find and run commands; 2 Identifying the command name ... 1 root root 59984 Nov 19 17:25 /bin/date $ /bin/date Sat...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bsodmike I was able to reproduce the issue. As part of performance improvement to our pipeline config pages we started utilizing the Pipeline Config API to update tasks as part of https://github.com/gocd/gocd/pull/7400 . While updating the config, the task contains a
\r
in the args which is treated as a newline by the command line. So the config which is saved isSince
\r
is a non-printable character, it is not visible on any UI. The logs I asked was to confirm that the command is actually not utilizing the echo part. Hence, the actual command which ran was/bin/bash -c
which is an incorrect. Hence the error.Now, the fix you mentioned was not due to removing the said line. It was because the whole config was overwritten by the arg without
\r
in it. Thanks for reporting the issue. I will take a deeper look into it later in this week.The other workaround is to save the cruise_config.xml without making any changes.
Edit
andSave