bin/54141: wrong behavour of cu(1)

Valentin Nechayev netch at netch.kiev.ua
Fri Apr 30 13:00:38 PDT 2004


The following reply was made to PR bin/54141; it has been noted by GNATS.

From: Valentin Nechayev <netch at netch.kiev.ua>
To: bug-followup at freebsd.org
Cc:  
Subject: Re: bin/54141: wrong behavour of cu(1)
Date: Fri, 30 Apr 2004 22:52:48 +0300

 Well, results of digging uucp:
 
 fsdirect_open() contains call of set/unset hardware flow control
 _always_:
 
   /* Always turn on hardware flow control for a direct port when it is
      opened.  There is no other sensible time to turn it on.  */
   return fsserial_hardflow (qconn, qd->uuconf_fhardflow);
 
 Whether it will be set or unset, depends on qd->uuconf_fhardflow.
 qd->uuconf_fhardflow is sport.uuconf_u.uuconf_sdirect.uuconf_fhardflow,
 where `sport' is automatic variable of main() in cu/cu.c. This variable:
 1) has no predefined initial value (i.e. contains garbage on start),
 2) is rewritten in cycle around uuconf_find_port(), if /etc/uucp/port
 (case of Taylor configs) exists and port is similar to one wanted
 (e.g. has type=direct).
 
 So, whether cu would set or unset crtscts in case of no ports defined,
 depends on uninitialized data on stack.
 The source of turned on crtscts in FreeBSD >= 4.7 may be depended on gcc
 version, binutils version, libc start stub version, CFLAGS in make.conf, etc.
 The following patch fixed it for me in case with no ports defined:
 
 === cut ===
 --- cu.c.orig	Fri Apr 30 22:38:44 2004
 +++ cu.c	Fri Apr 30 22:46:57 2004
 @@ -598,6 +598,7 @@
  	      sport.uuconf_palloc = NULL;
  	      sport.uuconf_u.uuconf_sdirect.uuconf_zdevice = NULL;
  	      sport.uuconf_u.uuconf_sdirect.uuconf_ibaud = ibaud;
 +	      sport.uuconf_u.uuconf_sdirect.uuconf_fhardflow = 0;
  
  	      if (! fconn_init (&sport, &sconn, UUCONF_PORTTYPE_UNKNOWN))
  		ucuabort ();
 === end cut ===
 
 If you have any direct port defined, and want cu to turn off crtscts without
 the patch show above, define a dummy port with `hardflow no' and put it
 last in port file.
 
 I can't provide any suggestion whether it should be fixed in 4.*
 or in ports/net/freebsd-uucp. To give applicable patch, this should
 at least add command-line switch to select whether crtscts should be set.
 
 
 -netch-


More information about the freebsd-bugs mailing list