The attached patch fixes the problem.
I've tested it in nearly all possible ocasions and it worked as expected.
diff -Naur ppp-2.4.4rel.save/debian/ppp-udeb.postinst ppp-2.4.4rel/debian/ppp-udeb.postinst
--- ppp-2.4.4rel.save/debian/ppp-udeb.postinst	2010-05-17 19:21:14.000000000 +0000
+++ ppp-2.4.4rel/debian/ppp-udeb.postinst	2010-05-18 16:08:14.000000000 +0000
@@ -27,14 +27,14 @@
 	fi
 	MAXWAIT=20; IW=5; TOTWAIT=$(($MAXWAIT + $MAXWAIT + $IW))
 	R=0
-	rm -f /tmp/probe-finished /tmp/ppp-errors
 	db_progress START 0 $TOTWAIT ppp/detect_progress
-	for P in " " "-U" ; do
+	for P in "" "-U" ; do
+		rm -f /tmp/probe-finished /tmp/ppp-errors
 		( R=$(/usr/sbin/pppoe-discovery -A $P -I $1 2>/tmp/ppp-errors | \
 			grep AC | wc -l)
 		  echo $R > /tmp/probe-finished ) &
 		WAIT=0
-		TO=$(grep Timeout /tmp/ppp-errors 2>/dev/null | wc -l || true)
+		TO=0
 
 		while [ ! -f /tmp/probe-finished ]; do
 			log "Timeout detected $TO"
@@ -51,6 +51,10 @@
 			fi
 			log "pppoe probe output size: $(cat /tmp/probe-finished 2> /dev/null)"
 		done
+		R=$(cat /tmp/probe-finished 2>/dev/null || true)
+		if [ -n "$R" -a 1$R -ne 10 ]; then
+			break
+		fi
 		if [ -z "$P" ]; then
 			sleep $IW
 			db_progress STEP $IW
@@ -58,15 +62,14 @@
 	done
 
 	PROCESS=$(ps -A | grep pppoe-discovery | sed s:^[[:space:]]::g | \
-		  cut -f1 -d' ') || true
+		  cut -f1 -d' ' || true)
 	if [ $TO -ne 1 -a "$PROCESS" ]; then
 		kill $PROCESS
 	fi
-	R=$(cat /tmp/probe-finished 2>/dev/null) || true
-	rm -f /tmp/probe-finished
+	rm -f /tmp/probe-finished /tmp/ppp-errors
 	db_progress STOP
 
-	if [ 1$R -ne 10 ]; then
+	if [ -n "$R" -a 1$R -ne 10 ]; then
 		return 0
 	else
 		return 1

Reply via email to