Bug 1589997
| Summary: | bash pipefail breaks grep -q | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Jacob Keller <jacob.e.keller> | ||||
| Component: | bash | Assignee: | Siteshwar Vashisht <svashisht> | ||||
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | high | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 28 | CC: | admiller, kasal, kdudka, svashisht | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2018-06-11 21:40:15 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Further testing seems to indicate this is also broken in F27. This is not a bug. When grep is invoked with -q option, it closes input end of the pipe as soon as it hits first occurence of "-Wmisleading-indentation". That may cause awk to exit with non-zero status as the reading end of the pipe has been closed. You can workaround it by redirecting grep output to /dev/null and removing -q option. Ahhh, yea that makes sense. |
Created attachment 1450179 [details] simple shell script highlighting the grep failures Description of problem: bash pipefail causes "grep -q" to return different results from "grep" Version-Release number of selected component (if applicable): GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu) How reproducible: always Steps to Reproduce: set -o pipefail; if gcc --help=warnings | awk '{print $1}' | grep -F -q -- "-Wmisleading-indentation" ; then echo yay; fi Actual results: no output Expected results: output of "yay" Additional info: This doesn't seem to work for all grep invocations, for example -Wvla seems to work, but -Wmisleading-indentation does not. Removing the pipefail fixes this, as does removing the -q option of grep. I've added an attachment which shows each of these issues. I tried running the script through strace, but wasn't able to find anything obviously wrong.