🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #627

Bug in shellutils-1.6/printf

#627
From: peter
Date: Wed, 12 Aug 1992 20:53
52 lines
1698 bytes
Here is the bug report:

bash$ printf \07
HOME=/users3/peterbash$		# beeps then prints first env variable in envp
bash$ printf \07cello		# beeps then no output, treats c as \c

Thanks,
	Pete.

Sorry if it's already been fixed, but here's my patch:

---------8<---------------------8<-----------------------

*** printf.c.orig	Wed Aug 12 21:04:16 1992
--- printf.c	Wed Aug 12 21:37:56 1992
***************
*** 197,202 ****
--- 197,203 ----
        if (esc_length == 0)
  	error (1, 0, "missing hexadecimal number in escape");
        putchar (esc_value);
+       --p;
      }
    else if (*p == '0')
      {
***************
*** 205,214 ****
  	   ++esc_length, ++p)
  	esc_value = esc_value * 8 + octtobin (*p);
        putchar (esc_value);
      }
!   else if (!index ("\"\\abcfnrtv", *p))
!     error (1, 0, "\\%c: invalid escape", *p);
!   print_esc_char (*p);
    return p - escstart;
  }
  
--- 206,219 ----
  	   ++esc_length, ++p)
  	esc_value = esc_value * 8 + octtobin (*p);
        putchar (esc_value);
+       --p;
      }
!   else if (index ("\"\\abcfnrtv", *p))
!       print_esc_char (*p);
!   else
!       error (1, 0, "\\%c: invalid escape", *p);
! 
!   /* return position of end of esc-sequence relative to start */
    return p - escstart;
  }
  
Technical Details
Message-ID: <9208122053.AA10311@casca.robots.ox.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!robots.ox.ac.uk!peter

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!robots.ox.ac.uk!peter
From: peter@robots.ox.ac.uk
Subject: Bug in shellutils-1.6/printf
Message-ID: <9208122053.AA10311@casca.robots.ox.ac.uk>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 12 Aug 1992 20:53:26 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 53