[net.sources.bugs] Rn bug patch #16

jonab@sdcrdcf.UUCP (Jonathan Biggar) (11/17/84)

System: rn version 4.1
Bug #: 16
Priority: MEDIUM
Subject: & substitution in fullname incorrect
Index: Pnews.SH, intrp.c
From: mcvax!guido (Guido van Rossum)

Description:
	Neither Pnews nor rn does the & substitution (inserting login name
	into full name) correctly.  This should be of concern only to
	bsd sites.

Repeat-By:
	Have a passwd GCOS entry that uses & substitution.  Get into rn and
	type /<esc>N.  You should end up with your correct name.  If not,
	you have the intrp.c bug.  Run Pnews.  If it produces a header with
	an incorrect full name, you have the Pnews bug.

Fix:	From rn, say "| patch -d DIR", where DIR is your rn source directory.
	Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
	the patch program, apply the following by hand, or get patch.

	The intrp.c patch must be applied only to a revision 4.1.1.3
	intrp.c (with patches 1 and 7).
	
	The Pnews.SH patch should be applied to a stock revision 4.1
	Pnews.SH.  Then rerun Pnews.SH and install the new Pnews.

Prereq: 4.1.1.3
*** intrp.c.old	Mon Oct 15 17:31:31 1984
--- intrp.c	Mon Oct 15 17:31:53 1984
***************
*** 1,4
! /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall

--- 1,4 -----
! /* $Header: intrp.c,v 4.1.1.4 84/10/15 17:25:44 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.4  84/10/15  17:25:44  lwall
***************
*** 1,6
  /* $Header: intrp.c,v 4.1.1.3 84/10/12 14:32:40 lwall Exp $
   *
   * $Log:	intrp.c,v $
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
   * Fixed PHOSTNAME core dump.
   * 

--- 1,9 -----
  /* $Header: intrp.c,v 4.1.1.4 84/10/15 17:25:44 lwall Exp $
   *
   * $Log:	intrp.c,v $
+  * Revision 4.1.1.4  84/10/15  17:25:44  lwall
+  * Reordered init sequence so & fullname substitution works.
+  * 
   * Revision 4.1.1.3  84/10/12  14:32:40  lwall
   * Fixed PHOSTNAME core dump.
   * 
***************
*** 106,116
  
      dotdir = getval("DOTDIR",homedir);
  
-     /* get the real name of the person (%N) */
- 
-     strcpy(tcbuf,getrealname(getuid()));
-     realname = savestr(tcbuf);
- 
      /* get login name */
  
      logname = getenv("USER");

--- 109,114 -----
  
      dotdir = getval("DOTDIR",homedir);
  
      /* get login name */
  
      logname = getenv("USER");
***************
*** 120,125
      if (logname == Nullch)
  	logname = savestr(getlogin());
  #endif
  
      /* name of header file (%h) */
  

--- 118,129 -----
      if (logname == Nullch)
  	logname = savestr(getlogin());
  #endif
+ 
+     /* get the real name of the person (%N) */
+     /* Must be done after logname is read in because BERKNAMES uses that */
+ 
+     strcpy(tcbuf,getrealname(getuid()));
+     realname = savestr(tcbuf);
  
      /* name of header file (%h) */
  
Prereq: 4.1
*** Pnews.SH.old	Mon Oct 15 17:34:56 1984
--- Pnews.SH		Mon Oct 15 17:35:18 1984
***************
*** 4,10
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1 84/09/24 11:37:46 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1  84/09/24  11:37:46  lwall

--- 4,10 -----
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1.1.2 84/10/15 17:28:28 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1.1.2  84/10/15  17:28:28  lwall
***************
*** 7,12
  # $Header: Pnews.SH,v 4.1 84/09/24 11:37:46 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1  84/09/24  11:37:46  lwall
  # Real baseline.
  # 

--- 7,18 -----
  # $Header: Pnews.SH,v 4.1.1.2 84/10/15 17:28:28 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
+ # Revision 4.1.1.2  84/10/15  17:28:28  lwall
+ # Fixed & fullname substitution for bsd names.
+ # 
+ # Revision 4.1.1.1  84/09/25  13:19:11  lwall
+ # Branch for sdcrdcf changes.
+ # 
  # Revision 4.1  84/09/24  11:37:46  lwall
  # Real baseline.
  # 
***************
*** 235,241
      bsd)
  	fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  	case $fullname in
! 	'*&*') : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  	    lname=`$echo lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  	    fullname=`$echo $fullname | $sed 's/&/${lname}/'`

--- 241,247 -----
      bsd)
  	fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  	case $fullname in
! 	*'&'*) : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  	    lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  	    fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
***************
*** 237,244
  	case $fullname in
  	'*&*') : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
! 	    lname=`$echo lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
! 	    fullname=`$echo $fullname | $sed 's/&/${lname}/'`
  	    ;;
  	esac
  	;;

--- 243,250 -----
  	case $fullname in
  	*'&'*) : GACK
  	    lname=`$echo $logname | $tr 'a-z' 'A-Z'`
! 	    lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
! 	    fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
  	    ;;
  	esac
  	;;