Subject: [netatalk-admins] FreeBSD, netatalk, unusual print problems on some printers (mirror images, multiple jobs)

From: Josh Fryman <[email-masked]>
Date: Sat, 15 Aug 1998 23:07:03 -0400

Hello all ..

Scanned the archives and such, I think this is a unique scenario.  Looking
for any help or possible advice ...

What we're running:

FreeBSD 2.2.6, netatalk 1.4b2 (no asun), mixed MacOS 7.6, 8.1, Win95,98,
	samba 1.9.18p8

What we're getting:

An HP DesignJet 2000 running Miramar AppleTalk whatever on Win95 with the
Lightbridge server ... some print jobs come across with the correct names,
but most come with a garbage name.  We don't receive just one copy of a 
print job, we tend to receive around 5 copies of each job.  If we look in the
lpd-err log file, we see msgs from pap noting a "Bad status" (what a useful
diagnostic)

---

From: Andras Kadinger <[email-masked]>
Date: Sun, 16 Aug 1998 05:28:39 +0200

> lpd-err log file, we see msgs from pap noting a "Bad status" (what a useful

Try the patch below (although it's for asun, I think Adrian didn't touch the printing code, so it should apply cleanly).

This makes pap instead of exiting report it's observations a bit more verbosely. Things might start to work, or crash and go down in flames (everything should be back in the original state after the
two minute PAP timeout however).

If there is garbage in the status message with this patch, then the problem seems to be serious. If the status message seems to be intact, then chances are, only one 'non-essential' (how untrue that
is) field was not filled out properly by the printer/spooler pap is talking to.

I suspect the fault not to be in pap, however report the results please, so that we can elaborate on the issue.

Hope, this helps,

Sincerely,
Andras Kadinger
[email-masked]

--- ../../../netatalk-1.4b2+asun2.1.0-original/bin/pap/pap.c	Fri May 30 02:17:30 1997
+++ pap.c	Sun Aug 16 05:23:46 1998
@@ -683,21 +683,25 @@
 		continue;
 	    }
 
+	    if (
+
 #ifndef NONZEROSTATUS
 	    /*
 	     * The stinking LaserWriter IINTX puts crap in this
 	     * field.
 	     */
-	    if ( ((char *)rniov[ 0 ].iov_base)[ 0 ] != 0 ) {
-		fprintf( stderr, "Bad status response!\n" );
-		exit( 1 );
-	    }
+		    (((char *)rniov[ 0 ].iov_base)[ 0 ] != 0) || 
+
 #endif NONZEROSTATUS
 
-	    if ( ((char *)rniov[ 0 ].iov_base)[ 1 ] != PAP_STATUS ||
-		    atpb.atp_rresiovcnt != 1 ) {
+		    (((char *)rniov[ 0 ].iov_base)[ 1 ] != PAP_STATUS ||
+		    atpb.atp_rresiovcnt != 1 )) {
 		fprintf( stderr, "Bad status response!\n" );
+		fprintf( stderr, "base[0]=%d (should be 0), base[1]=%d (should be %d), rresiovcnt=%d (should be 1)\n",
+			 ((char *)rniov[0].iov_base)[0],((char *)rniov[0].iov_base)[1], PAP_STATUS, atpb.atp_rresiovcnt);
+#if 0
 		exit( 1 );
+#endif
 	    }
 
 DEBUG( printf( "< STATUS\n" ));