From nobody@FreeBSD.org  Thu Nov 22 03:05:57 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id DB84C37B405
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 22 Nov 2001 03:05:56 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id fAMB5uF36346;
	Thu, 22 Nov 2001 03:05:56 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200111221105.fAMB5uF36346@freefall.freebsd.org>
Date: Thu, 22 Nov 2001 03:05:56 -0800 (PST)
From: WATANABE Yuichi <yuu-w@ascii.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: lpd problem.
X-Send-Pr-Version: www-1.0

>Number:         32183
>Category:       bin
>Synopsis:       [MFC] lpd problem.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gad
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 22 03:10:00 PST 2001
>Closed-Date:    Tue Dec 11 11:54:46 PST 2001
>Last-Modified:  Tue Dec 11 11:55:35 PST 2001
>Originator:     WATANABE Yuichi
>Release:        FreeBSD 4.4R
>Organization:
ASCII Corp.
>Environment:
FreeBSD oapc13.oa.ascii.co.jp 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Wed Sep 26 16:55:13 JST 2001     root@oapc13.oa.ascii.co.jp:/usr/src/sys/compile/PRTSVR00  i386
>Description:
if
 1) lpd received printing-job request from remote-cliant
and
 2) target-printe is busy
then
 some messages are in /var/log/messages, /var/log/lpd-errs

 lpd[nnnn]: Error receiving job from hostname.com:
 lpd[nnnn]: prt01: ctl_renametf invalid filename: tfB521hostname.com

I made comparison source program of 4.4R with 3.4R.

/usr/src/usr.sbin/lpr/lpd/recvjob.c
 readjob(pp)
 @ case '\2':      /* read cf file */

In the 3.4R,
-----
 if (link(tfname, cp) < 0)
        frecverr("%s: %m", tfname);
 (void) unlink(tfname);
 tfname[0] = '\0';
-----
In the 4.4R
-----
 tfname[0] = '\0';
 if (errmsg != NULL) {
    frecverr("%s: %s", pp->printer, errmsg);
     /*NOTREACHED*/
  /* (void) unlink(tfname); */         /* need !? */
 }
-----

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gad 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Thu Nov 22 06:30:52 PST 2001 
Responsible-Changed-Why:  
Garance's problem ;-) 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32183 

From: Garance A Drosihn <drosih@rpi.edu>
To: freebsd-gnats-submit@FreeBSD.org, yuu-w@ascii.co.jp
Cc:  
Subject: Re: bin/32183: lpd problem
Date: Thu, 22 Nov 2001 11:57:35 -0500

 WATANABE Yuichi (yuu-w) writes:
 >  if
 >    1) lpd received printing-job request from remote-client
 >  and
 >    2) target-printer is busy
 >  then
 >    some messages are in /var/log/messages, /var/log/lpd-errs
 >
 >    lpd[nnnn]: Error receiving job from hostname.com:
 >    lpd[nnnn]: prt01: ctl_renametf invalid filename: tfB521hostname.com
 
 This error message comes from the routine ctl_renametf, which is in
 common_source/ctlinfo.c .  The reason it's complaining is that the
 temporary control file should start with 'tfA', not 'tfB'.
 
 Now to find out why it might be 'tfB'...
 
 The temporary filename is created (in recvjob.c) by:
 	strlcpy(tfname, cp, sizeof(tfname));
 	tfname[sizeof (tfname) - 1] = '\0';
 	tfname[0] = 't';
 
 This implies that the sending-host wants to send a control-file which
 starts with 'cfB'.  I have never seen that happen.  I am pretty sure
 there are a number of places in lpr/lpd which assume a control file is
 always going to start with 'cfA', so if someone is sending 'cfB' then
 I will need to keep that in mind as I check through the source.
 
 Could you tell me what operating system is sending the job to your
 freebsd box?  Could you check the queue for prt01 on that box, and
 see if it really does have a 'cfB*' file in it?  Are there any other
 files which start with 'cf*' but do not start with 'cfA*' or 'cfB*'?
 
 I am not sure why it would matter if the 'target-printer is busy'.
 How busy is it?  Is there a large backlog of jobs?
 
 If control files can have a third letter of other than 'A', I can change
 the processing in ctlinfo.c to allow that.  Note that right now ctlinfo
 works by creating another temp file starting with 'tfB', so which is why
 I had that check in there.  I can fix that, of course, but first I want
 to figure out why this is happening.
 
 -- 
 Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
 Senior Systems Programmer           or  gad@freebsd.org
 Rensselaer Polytechnic Institute    or  drosih@rpi.edu
 
 
State-Changed-From-To: open->suspended 
State-Changed-By: gad 
State-Changed-When: Tue Nov 27 21:01:29 PST 2001 
State-Changed-Why:  
I wrote a patch for this problem and sent it to the user.  The user has 
tried it, and it did fix the problem they were seeing.  A version of this 
fix has been committed to -current, and will be MFC'ed to -stable within 
a few weeks (hopefully in 10 days...). 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32183 
State-Changed-From-To: suspended->closed 
State-Changed-By: gad 
State-Changed-When: Tue Dec 11 11:54:46 PST 2001 
State-Changed-Why:  
The fix for this reported problem has now been committed to 4.4-stable. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=32183 
>Unformatted:
