[net.sources.bugs] rn bug #27

lwall@sdcrdcf.UUCP (Larry Wall) (12/01/84)

System: rn version 4.1
Priority: LOW
Subject: Pnews and Rnmail can show environment under some circumstances
From: geoff@desint.UUCP (Geoff Kuenning)

Description:
	Pnews.SH uses set `command` to set certain variables.  If the command
	returns nothing, the environment will be displayed on the terminal.

	(There are also some instances of "echo -n" that need generalizing
	in Rnmail.SH, and that are fixed by this patch.)

Repeat-By:
	Temporarily remove the Distribution: line from your NEWSHEADER
	environment variable.  Now enter 'rn' and follow up to an article.
	The current variables of the Pnews script will be shown on the
	terminal.

Fix:	Ensure there is at least one argument to each set command by saying

	set X `command`
	shift

	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.

	After applying the patch, you will need to rerun Pnews.SH and
	Rnmail.SH to produce Pnews and Rnmail, and then install them.

Index: Pnews.SH
Prereq: 4.1.1.3
***************
*** 4,10
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1.1.3 84/10/22 15:16:35 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1.1.3  84/10/22  15:16:35  lwall

--- 4,10 -----
  echo "Extracting Pnews (with variable substitutions)"
  $spitshell >Pnews <<!GROK!THIS!
  $startsh
! # $Header: Pnews.SH,v 4.1.1.4 84/11/30 13:37:19 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1.1.4  84/11/30  13:37:19  lwall
***************
*** 7,12
  # $Header: Pnews.SH,v 4.1.1.3 84/10/22 15:16:35 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
  # Revision 4.1.1.3  84/10/22  15:16:35  lwall
  # Cleaned up distribution code some.
  # 

--- 7,15 -----
  # $Header: Pnews.SH,v 4.1.1.4 84/11/30 13:37:19 lwall Exp $
  #
  # $Log:	Pnews.SH,v $
+ # Revision 4.1.1.4  84/11/30  13:37:19  lwall
+ # Made sure set commands have at least one argument.
+ # 
  # Revision 4.1.1.3  84/10/22  15:16:35  lwall
  # Cleaned up distribution code some.
  # 
***************
*** 246,252
  
  # now build a file with a header for them to edit
  
!     set ${USER-${LOGNAME-`who am i`}}
      logname=$1
      case $logname in
      *!*) logname=`expr "$logname" : '!\(.*\)$'` ;;

--- 249,256 -----
  
  # now build a file with a header for them to edit
  
!     set X ${USER-${LOGNAME-`who am i`}}
!     shift
      logname=$1
      case $logname in
      *!*) logname=`expr "$logname" : '!\(.*\)$'` ;;
***************
*** 299,305
      trap "$rescue" 2
  
  $echo ""
! set `$sed < $tmpart -n -e '/^Distribution: /{' -e p -e q -e '}' -e '/^$/q'`
  case $# in
  0|1)
      set `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`

--- 303,310 -----
      trap "$rescue" 2
  
  $echo ""
! set X `$sed < $tmpart -n -e '/^Distribution: /{' -e p -e q -e '}' -e '/^$/q'`
! shift
  case $# in
  0|1)
      set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
***************
*** 302,308
  set `$sed < $tmpart -n -e '/^Distribution: /{' -e p -e q -e '}' -e '/^$/q'`
  case $# in
  0|1)
!     set `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
      case $# in
      0|1)
  	set "x net.whatever"

--- 307,314 -----
  shift
  case $# in
  0|1)
!     set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
!     shift
      case $# in
      0|1)
  	set "x net.whatever"
***************
*** 483,489
  	;;
      
      send)
! 	set `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
  	case $# in
  	2)
  	    if $inews -h < $tmpart ; then

--- 489,496 -----
  	;;
      
      send)
! 	set X `$sed < $tmpart -n -e '/^Newsgroups: /{' -e p -e q -e '}'`
! 	shift
  	case $# in
  	2)
  	    if $inews -h < $tmpart ; then


Index: Rnmail.SH
Prereq: 4.1
*** /tmp/,RCSt1007848	Fri Nov 30 13:46:57 1984
--- /tmp/,RCSt2007848	Fri Nov 30 13:47:06 1984
***************
*** 3,10
  esac
  echo "Extracting Rnmail (with variable substitutions)"
  $spitshell >Rnmail <<!GROK!THIS!
! #! /bin/sh
! # $Header: Rnmail.SH,v 4.1 84/09/24 11:38:51 lwall Exp $
  # 
  # $Log:	Rnmail.SH,v $
  # Revision 4.1  84/09/24  11:38:51  lwall

--- 3,10 -----
  esac
  echo "Extracting Rnmail (with variable substitutions)"
  $spitshell >Rnmail <<!GROK!THIS!
! $startsh
! # $Header: Rnmail.SH,v 4.1.1.2 84/11/30 13:44:26 lwall Exp $
  # 
  # $Log:	Rnmail.SH,v $
  # Revision 4.1.1.2  84/11/30  13:44:26  lwall
***************
*** 7,12
  # $Header: Rnmail.SH,v 4.1 84/09/24 11:38:51 lwall Exp $
  # 
  # $Log:	Rnmail.SH,v $
  # Revision 4.1  84/09/24  11:38:51  lwall
  # Real baseline.
  # 

--- 7,19 -----
  # $Header: Rnmail.SH,v 4.1.1.2 84/11/30 13:44:26 lwall Exp $
  # 
  # $Log:	Rnmail.SH,v $
+ # Revision 4.1.1.2  84/11/30  13:44:26  lwall
+ # Made sure set gets called with at least one argument.
+ # Also fixed some instances of echo -n.
+ # 
+ # Revision 4.1.1.1  84/09/25  13:19:27  lwall
+ # Branch for sdcrdcf changes.
+ # 
  # Revision 4.1  84/09/24  11:38:51  lwall
  # Real baseline.
  # 
***************
*** 78,84
  	to=h
  	while $test "$to" = h ; do
  	    $echo ""
! 	    $echo -n "To: "
  	    read to
  	    case $to in
  	    h)

--- 85,91 -----
  	to=h
  	while $test "$to" = h ; do
  	    $echo ""
! 	    $echo $n "To: $c"
  	    read to
  	    case $to in
  	    h)
***************
*** 104,110
      title=h
      while $test "$title" = h ; do
  	$echo ""
! 	$echo -n "Title/Subject: "
  	read title
  	case $title in
  	h)

--- 111,117 -----
      title=h
      while $test "$title" = h ; do
  	$echo ""
! 	$echo $n "Title/Subject: $c"
  	read title
  	case $title in
  	h)
***************
*** 142,148
  file=h
  while $test "$file" = h ; do
      $echo ""
!     $echo -n "Input file name?  [RETURN for new file]: "
      read file
      case $file in
      h)

--- 149,155 -----
  file=h
  while $test "$file" = h ; do
      $echo ""
!     $echo $n "Input file name?  [RETURN for new file]: $c"
      read file
      case $file in
      h)
***************
*** 175,181
  	trap "" 2
  	tmp=h
  	while $test "$tmp" = h ; do
! 	    $echo -n "Editor [${VISUAL-${EDITOR-$defeditor}}]: "
  	    read tmp
  	    case $tmp in
  	    h)

--- 182,188 -----
  	trap "" 2
  	tmp=h
  	while $test "$tmp" = h ; do
! 	    $echo $n "Editor [${VISUAL-${EDITOR-$defeditor}}]: $c"
  	    read tmp
  	    case $tmp in
  	    h)
***************
*** 202,208
  	
      ask)
  	$echo ""
! 	$echo -n "Send, abort, edit, or list? "
  	read ans
  	
  	case $ans in

--- 209,215 -----
  	
      ask)
  	$echo ""
! 	$echo $n "Send, abort, edit, or list? $c"
  	read ans
  	
  	case $ans in
***************
*** 245,253
  	    $mailer <$tmpart
  	    ;;
  	*)
! 	    set `$sed <$tmpart -n -e '/^To:/{' -e 's/To: *//p' -e q -e '}'`
! 	    set "$@" `$sed <$tmpart -n -e '/^Cc:/{' -e 's/Cc: *//p' -e q -e '}'`
! 	    set "$@" `$sed <$tmpart -n -e '/^Bcc:/{' -e 's/Bcc: *//p' -e q -e '}'`
  	    $grep -v "^Bcc:"  <$tmpart | $mailer "$@"
  	    ;;
  	esac

--- 252,263 -----
  	    $mailer <$tmpart
  	    ;;
  	*)
! 	    set X `$sed <$tmpart -n -e '/^To:/{' -e 's/To: *//p' -e q -e '}'`
! 	    shift
! 	    set X "$@" `$sed <$tmpart -n -e '/^Cc:/{' -e 's/Cc: *//p' -e q -e '}'`
! 	    shift
! 	    set X "$@" `$sed <$tmpart -n -e '/^Bcc:/{' -e 's/Bcc: *//p' -e q -e '}'`
! 	    shift
  	    $grep -v "^Bcc:"  <$tmpart | $mailer "$@"
  	    ;;
  	esac