Bug 449 - perl's $] variable is broken
Summary: perl's $] variable is broken
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-05-26 16:20 UTC by fenner
Modified: 1995-05-26 16:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fenner 1995-05-26 16:20:02 UTC
	
	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.

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...
How-To-Repeat: 
	
	print the perl $] value in a numerical context.
Comment 1 Andrey A. Chernov freebsd_committer freebsd_triage 1995-05-28 20:22:07 UTC
State Changed
From-To: open->closed

Applied in perl.c v1.3