Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 1995 16:20:03 -0700
From:      Bill Fenner <fenner@parc.xerox.com>
To:        freebsd-bugs
Subject:   gnu/449: perl's $] variable is broken
Message-ID:  <199505262320.QAA05038@freefall.cdrom.com>
In-Reply-To: Your message of Fri, 26 May 1995 16:12:10 PDT <199505262312.QAA04792@fenestro.parc.xerox.com>

next in thread | previous in thread | raw e-mail | index | archive | help

>Number:         449
>Category:       gnu
>Synopsis:       perl's $] variable is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 26 16:20:02 1995
>Originator:     Bill Fenner
>Organization:
Xerox PARC
>Release:        FreeBSD 2.1.0-Development i386
>Environment:

	
	FreeBSD-2.0 SNAP-950412

>Description:

	
	Perl's $] variable returns "4", not "4.036":

	% perl
	print $] + 0;
	4% 

	On a Sun:

	crevenia% perl
	print $] + 0;
	4.0359999999999995879crevenia% 

	This also appears to (from reading the code) break the auto
	running of taintperl and suidperl.


>How-To-Repeat:

	
	print the perl $] value in a numerical context.

>Fix:
	
	
	Believe it or not, the fix is to put the rcsid back.  Given the
	existing rcsid of

	$RCSfile: perl.c,v $$Revision: 1.2 $$Date: 1994/10/27 23:16:54 $

	the "patchlevel" variable gets set to "4/136", which atof() returns
	4.0 for.  The Revision needs to be 4.0 to get the proper behavior.

	(see usr/src/gnu/usr.sbin/perl/perl/perl.c, line 128:

        sprintf(patchlevel,"%3.3s%2.2d", index(rcsid,'4'), PATCHLEVEL);

	Of course, another fix would simply be to change this to

	sprintf(patchlevel,"%3.3s%2.2d", "4.0", PATCHLEVEL);

	since it's pretty ill to use the rcsid in this manner...
>Audit-Trail:
>Unformatted:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505262320.QAA05038>