Bug 1298499

Summary: q command does not immediately quit
Product: [Fedora] Fedora Reporter: Robin Green <greenrd>
Component: sedAssignee: Petr Stodulka <pstodulk>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 23CC: hhorak, jpacner, pbonzini, pstodulk
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-07 15:34:02 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:

Description Robin Green 2016-01-14 09:42:40 UTC
Description of problem:
The info page for sed says that the q command immediately quits. However, it doesn't.

Version-Release number of selected component (if applicable):
sed-4.2.2-11.fc23.x86_64

How reproducible:
Always

Steps to Reproduce:
(echo 'PostgreSQL init process complete; ready for start up.'; sleep 3; echo foo)|sed -n -e '/PostgreSQL init process complete/q'

Actual results:
Output is correct (no output) but it takes 3 seconds

Expected results:
Should return instantly

Additional info:
Same bug happens with Q, or Q 1

Comment 1 Paolo Bonzini 2016-07-07 15:34:02 UTC
sed does quit immediately, but the shell doesn't exit until the whole pipeline is done.  Try this:

$ (echo 'PostgreSQL init process complete; ready for start up.'; sleep 3;
     echo foo)|(sed -n -e '/PostgreSQL init process complete/q'; echo bar)

And you'll see that "bar" is printed immediately.