Execute command failing if no space between ' and ". /bin/sh unexpected EOF
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 88
Description
I am calling a shell script with some arguments. The entire command is enclosed in quotes (") and the arguments are enclosed in ticks ('). The command had been working fine in the past with version 1.5.2 and/or 1.5.3. The command quit working when we upgraded to 1.5.4. To 'fix' the command I had to insert a space between the final tick and quote. ('" becomes ' ")
**Failing Command**
```
command => "/apps/logstash_server/conf/alerting/logstash_xmatters.sh '%{product}' '%{alertKey}' '%{alertMessage}' '%{alertSeverity}' '%{@timestamp}'"
```
**Error Logged**
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
**Argument values as captured in JSON with output rule**
```
"product":"bgs"
"alertKey":"server.configuration.error"
"alertMessage":"We received a request that had promotion-level header of monitoring but the server had a PROMOTION_LEVEL environment variable of prod. This means the F5 or the server is mis-configured."
"alertSeverity":"fyi"
"@timestamp":"2015-10-30T19:31:55.740Z"
```
Contributor guide
Research direction
Start by reproducing the failing command that invokes /apps/logstash_server/conf/alerting/logstash_xmatters.sh with the shown arguments under /bin/sh, comparing Logstash 1.5.3 and 1.5.4. Trace the command execution path to identify the version-specific quoting behavior; done means the original command runs without requiring a space between the final tick and quote.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100