[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sed "Bug" report: GNU sed version 4.2.1

From: Kevin Fegan
Subject: sed "Bug" report: GNU sed version 4.2.1
Date: Tue, 29 May 2012 17:55:05 -0500
User-agent: Internet Messaging Program (IMP) H3 (4.2)

[Note: This message was also sent to: address@hidden

I am using sed version 4.2.1 on Windows 7 Home Premium.
(Output from sed --version is at the bottom of this message).

Problem occurs when piping output of sed command to input of another sed command when second sed command uses the "q" command that results in the command ending "early".

The problem is an "inconsistent" error message that is probably issued by the first instance of the sed command.

The error message can be something like:
1) sed: couldn't flush stdout: Invalid argument

2) sed: couldn't flush stdout: No such file or directory

3) sed: couldn't write 275 items to stdout: No such file or directory
The process tried to write to a nonexistent pipe.

and perhaps others.

The variable that seems to determine if an error message is output (and perhaps which error message), is the size of the output generated by the first instance of sed.

The command(s) that I am able to reproduce the problem with are:
type Text.txt|sed -n "/Line/p"|sed q
sed -n "/Line/p" "Text.txt"|sed q
type Text.txt|sed -n "/Line/p"|sed 10q
sed -n "/Line/p" "Text.txt"|sed 10q

The file Text.txt was generated by writing the following text to the file:

That is:
1) writing the un-quoted text: "Line1"
2) writing a "randomish" 5 or 6 digit number
3) writing the un-quoted text: "Line2"
4) writing a "randomish" 5 or 6 digit number
5) repeating this until the file is of sufficient size.

The first sed command will read the file and output matching lines.

In the case of the search expression and the test file used, this results in half of the lines of the file (and about half of the "size" of the file) being output by the first sed command.

If the test file is small, say 8,000 bytes or less, it appears that the commands tested (as shown above) will always succeed.

If the test file is about 12,000 to 15,000 bytes, it will always generate error messages 1 or 2 (shown above).

If the test file is about 30,000 to 50,000 bytes, it will always generate error message 3 (shown above).

Please let me know if you need me to provide any additional information.

Thank you.

Kevin Fegan

sed --version
GNU sed version 4.2.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
to the extent permitted by law.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <address@hidden>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]