[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnats/691: sed chokes on an unterminated line in send-pr.sh
From: |
bug-gnats |
Subject: |
gnats/691: sed chokes on an unterminated line in send-pr.sh |
Date: |
Wed, 16 Aug 2006 12:15:01 -0500 (CDT) |
>Number: 691
>Category: gnats
>Synopsis: sed chokes on an unterminated line in send-pr.sh
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 16 12:15:01 -0500 2006
>Originator: Stephane Chazelas <address@hidden>
>Release:
>Description:
Hi guys,
A portability problem with the send-pr command.
"sed" is a /text/ utility, that means it copes with /text/ input.
When given non-text input, the behavior is /unspecified/
A text input is something made of <NL> terminated lines whose
length doesn't exceed some value (that value is at least 2048
IIRC and is unspecified otherwise)
In send-pr,
there's a ... | tr '\n' ' ' | sed ...
What that sed sees is non-text input as the line is not
terminated by a NL character. The result is therefore
unspecified, and Solaris sed for instance discards that line.
A work around is to use paste instead of tr.
>Fix:
Index: send-pr.sh
===================================================================
RCS file: /sources/gnats/gnats/gnats/send-pr.sh,v
retrieving revision 1.2
diff -u -r1.2 send-pr.sh
--- send-pr.sh 31 Dec 2005 21:52:52 -0000 1.2
+++ send-pr.sh 16 Aug 2006 17:01:03 -0000
@@ -375,7 +375,9 @@
else
if [ "$fieldname" != "Category" ]
then
- values=`${bindir}/query-pr --valid-values
$fieldname | tr '\n' ' ' | sed 's/ *$//g; s/ / | /g;s/^/[ /;s/$/ ]/;'`
+ values='[ '`${bindir}/query-pr --valid-values
$fieldname |
+ paste -sd '|' - |
+ sed 's/|/ | /g'`' ]'
valslen=`echo "$values" | wc -c`
else
values="choose from a category listed above"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnats/691: sed chokes on an unterminated line in send-pr.sh,
bug-gnats <=