On Mon, Jun 16, 2003 at 09:02:08PM +0100, Richard Kettlewell wrote:
> Package: trn
> Version: 3.6-16
> 
> Pnews ignores almost all errors from commands it executes.
> 
> If its terminal goes away at the wrong moment it therefore sits in a
> tight loop executing read and echo, ignoring the fact that both are
> failing.
> 
> It should use 'set -e', so that it checks all errors, and any cases
> where errors must be ignored or processed more subtly than by
> terminating should be dealt with explicitly.

I've uploaded the attached NMU to ameliorate this (along with a trn4
upload to fix the last minor bit not done upstream). It still doesn't
use 'set -e' (hence I'm leaving this bug open) but it should at least
make it less likely to spin following a failed read.

-- 
Colin Watson                                       [EMAIL PROTECTED]
diff -Nru /tmp/BJWdmVbFbA/trn-3.6/Pnews.SH /tmp/FjSbhSRZ8n/trn-3.6/Pnews.SH
--- /tmp/BJWdmVbFbA/trn-3.6/Pnews.SH	2000-01-19 12:35:54.000000000 +0000
+++ /tmp/FjSbhSRZ8n/trn-3.6/Pnews.SH	2007-03-05 14:24:36.000000000 +0000
@@ -359,7 +359,7 @@
 while $test "X$file" = Xh ; do
     $echo ""
     $echo $n "Prepared file to include [none]: $c"
-    read file
+    read file || exit 0
     case $file in
     h)
 	$cat <<'EOH'
@@ -420,7 +420,7 @@
 	esac
 	while $test "X$tmp" = Xh ; do
 	    $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"
-	    read tmp
+	    read tmp || state=rescue	# exits on EOF
 	    case $tmp in
 	    h)
 		$cat <<'EOH'
@@ -457,7 +457,7 @@
     ask)
 	$echo ""
 	$echo $n "Check spelling, Send, Abort, Edit, or List? $c"
-	read ans
+	read ans || state=rescue	# exits on EOF
 
 	case "$ans" in
 	[aA]*)
@@ -579,7 +579,7 @@
     while $test "X$ng" = Xh ; do
 	$echo ""
 	$echo $n "Newsgroup(s): $c"
-	read ng
+	read ng || exit 0
 	case $ng in
 	h)
 	    $cat <<'EOH'
@@ -642,7 +642,7 @@
 EOM
     fi
     $echo $n "Distribution ($defdist): $c"
-    read dist
+    read dist || exit 0
     case $dist in
     '') dist="$defdist" ;;
     esac
@@ -689,7 +689,7 @@
     while $test "X$title" = Xh ; do
 	$echo ""
 	$echo $n "Title/Subject: $c"
-	read title
+	read title || exit 0
 	case $title in
 	h)
 	    $cat <<'EOH'
diff -Nru /tmp/BJWdmVbFbA/trn-3.6/debian/changelog /tmp/FjSbhSRZ8n/trn-3.6/debian/changelog
--- /tmp/BJWdmVbFbA/trn-3.6/debian/changelog	2005-11-02 16:10:32.000000000 +0000
+++ /tmp/FjSbhSRZ8n/trn-3.6/debian/changelog	2007-03-05 14:26:30.000000000 +0000
@@ -1,3 +1,11 @@
+trn (3.6-18.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Backport several Pnews fixes from trn4 to avoid busy-waiting if stdin
+    goes away (part of #197677, although we still don't use set -e).
+
+ -- Colin Watson <[EMAIL PROTECTED]>  Mon,  5 Mar 2007 14:26:26 +0000
+
 trn (3.6-18) unstable; urgency=medium
 
   * Fix FTBFS bug in common.h, and add a build-depends (closes: #306318)

Reply via email to