From philk@rotfl.com.au  Sun Aug 28 08:05:29 2005
Return-Path: <philk@rotfl.com.au>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AD4B116A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Aug 2005 08:05:29 +0000 (GMT)
	(envelope-from philk@rotfl.com.au)
Received: from mail.rotfl.com.au (eth1779.sa.adsl.internode.on.net [150.101.235.242])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1BCAC43D45
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Aug 2005 08:05:28 +0000 (GMT)
	(envelope-from philk@rotfl.com.au)
Received: from localhost (localhost.rotfl.com.au [127.0.0.1])
	by mail.rotfl.com.au (Postfix) with ESMTP id E3B024542A
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Aug 2005 17:35:26 +0930 (CST)
Received: from mail.rotfl.com.au ([127.0.0.1])
 by localhost (mail.rotfl.com.au [127.0.0.1]) (amavisd-new, port 10024)
 with LMTP id 45945-02 for <FreeBSD-gnats-submit@freebsd.org>;
 Sun, 28 Aug 2005 17:35:19 +0930 (CST)
Message-Id: <20050828080519.AE68F45430@mail.rotfl.com.au>
Date: Sun, 28 Aug 2005 17:35:19 +0930 (CST)
From: Phil Kernick <philk@rotfl.com.au>
Reply-To: Phil Kernick <philk@rotfl.com.au>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: port comms/hylafax won't send faxes under FreeBSD5
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         85368
>Category:       ports
>Synopsis:       port comms/hylafax won't send faxes under FreeBSD5
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lawrance
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 28 08:10:22 GMT 2005
>Closed-Date:    Sat Oct 08 08:23:27 GMT 2005
>Last-Modified:  Sat Oct 08 08:23:27 GMT 2005
>Originator:     Phil Kernick
>Release:        FreeBSD 5.4-RELEASE-p6 i386
>Organization:
>Environment:
System: FreeBSD catbert.rotfl.com.au 5.4-RELEASE-p6 FreeBSD 5.4-RELEASE-p6 #0: Mon Aug 15 13:12:48 CST 2005 root@catbert.rotfl.com.au:/usr/src/sys/i386/compile/CATBERT i386


	
>Description:

The HylaFax port (comms/hylafax) won't send Class 1 faxes under FreeBSD5.4.
The sendfax program segfaults.

>How-To-Repeat:

Install the port, try to send a fax, then look in /var/log/messages for
lines like:

Aug 28 17:03:37 catbert FaxQueuer[56995]: JOB 18: Send program terminated
abnormally with exit status 0xb

>Fix:

Apply this patch, which back-ports the fixes for Class 1 sending from the
current development release of HylaFax into 4.2.1.

--- Class1Send.c++.orig	Wed Dec 29 12:46:46 2004
+++ Class1Send.c++	Sun Aug 28 00:02:14 2005
@@ -270,6 +270,8 @@
     HDLCFrame frame(conf.class1FrameOverhead);
 
     do {
+        hadV34Trouble = false;		// to monitor failure type
+	batchingError = false;
 	signalRcvd = 0;
 	if (abortRequested())
 	    return (send_failed);
@@ -320,8 +322,6 @@
 	/*
 	 * Transmit the facsimile message/Phase C.
 	 */
-        hadV34Trouble = false;		// to monitor failure type
-	batchingError = false;
 	if (!sendPage(tif, params, decodePageChop(pph, params), cmd, emsg)) {
 	    if (hadV34Trouble) {
 		protoTrace("The destination appears to have trouble with V.34-Fax.");
@@ -913,6 +913,7 @@
 	ecmBlock[ecmBlockPos++] = ecmFrame[i];
     ecmFramePos = 0;
     if (frameNumber == 256 || lastframe) {
+	fxAssert(frameNumber <= 256, "Invalid frameNumber value.");
 	ecmBlockPos = 0;
 	bool lastblock = lastframe;
 
@@ -1145,7 +1146,7 @@
 			}
 		    }
 		}
-	    } while (!gotppr && (++ppscnt < 3) && (crpcnt < 3));
+	    } while (!gotppr && (++ppscnt < 3) && (crpcnt < 3) && !(useV34 && gotEOT));
 	    if (gotppr) {
 		if (!useV34 && !atCmd(conf.class1SwitchingCmd, AT_OK)) {
 		    emsg = "Failure to receive silence.";
@@ -1485,9 +1486,11 @@
 		return (false);
 	}
     }
-    if (eod && (ecmFramePos != 0)) {
-	while (ecmFramePos < (frameSize + 4))
-	    ecmFrame[ecmFramePos++] = 0x00;
+    if (eod) {
+	if (ecmFramePos != 0)	{
+	    // frame must be filled to end with zero-data
+	    while (ecmFramePos < (frameSize + 4)) ecmFrame[ecmFramePos++] = 0x00;
+	}
 	if (!blockFrame(bitrev, true, ppmcmd, emsg))
 	    return (false);
     }
@@ -1631,7 +1634,7 @@
     }
 
     bool rc = true;
-    ecmBlockPos = ecmFramePos = ecmBitPos = ecmOnes = ecmByte = 0;
+    frameNumber = ecmBlockPos = ecmFramePos = ecmBitPos = ecmOnes = ecmByte = 0;
     protoTrace("SEND begin page");
 
     tstrip_t nstrips = TIFFNumberOfStrips(tif);



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->lawrance 
Responsible-Changed-By: lawrance 
Responsible-Changed-When: Sun Sep 4 16:24:08 GMT 2005 
Responsible-Changed-Why:  
Take 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85368 
State-Changed-From-To: open->feedback 
State-Changed-By: lawrance 
State-Changed-When: Wed Sep 7 11:47:17 GMT 2005 
State-Changed-Why:  
Asked maintainer and submitter for feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85368 

From: Sam Lawrance <lawrance@FreeBSD.org>
To: philk@rotfl.com.au, bug-followup@FreeBSD.org, tdv94ped@cs.umu.se
Cc:  
Subject: Re: ports/85368: port comms/hylafax won't send faxes under FreeBSD5
Date: Wed, 07 Sep 2005 21:45:23 +1000

 Dear maintainer of FreeBSD port comms/hylafax,
 
 Can you please take a look at the following PR:
 http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/85368
 and let us know what you think about the changes?
 
 Phil, maintainer - does the patch fix a FreeBSD-specific issue, or or
 should the changes also be submitted to the upstream authors?
 
 
 
 

From: philk@rotfl.com.au (Phil Kernick)
To: Sam Lawrance <lawrance@FreeBSD.org>
Cc: philk@rotfl.com.au, bug-followup@FreeBSD.org, tdv94ped@cs.umu.se
Subject: Re: ports/85368: port comms/hylafax won't send faxes under FreeBSD5
Date: Fri, 9 Sep 2005 16:30:51 +0930 (CST)

 Hi Sam,
 
 > Phil, maintainer - does the patch fix a FreeBSD-specific issue, or or
 > should the changes also be submitted to the upstream authors?
 
 The patches fix a FreeBSD 5.x specific issue that has been resolved in the
 unreleased CVS version of HylaFax.  These patches are a backport from the
 CVS release.
 
 
 Phil.
 
State-Changed-From-To: feedback->analyzed 
State-Changed-By: lawrance 
State-Changed-When: Wed Sep 28 08:06:02 GMT 2005 
State-Changed-Why:  
Maintainer timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85368 
State-Changed-From-To: analyzed->closed 
State-Changed-By: lawrance 
State-Changed-When: Sat Oct 8 08:23:07 GMT 2005 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=85368 
>Unformatted:
