Larry Wall [Fri, 17 Nov 1989 03:02:33 +0000]
perl 3.0 patch #5 (combined patch)
Some machines have bcopy() but not bzero(), so Configure
tests for them separately now. Likewise for symlink() and lstat().
Some systems have dirent.h but not readdir(). The symbols BZERO,
LSTAT and READDIR are now used to differentiate.
Some machines have <time.h> including <sys/time.h>. Some do
the opposite. Some don't even have <sys/time.h>. Configure
now looks for both kinds of include, and the saga continues...
Configure tested twice for the presence of -lnm because x2p/Makefile.SH
had a reference to the obsolete $libnm variable. It now tests
only once.
Some machines have goodies stashed in /usr/include/sun,
/usr/include/bsd, -lsun and -lbsd. Configure now checks those
locations.
Configure could sometimes add an option to a default of none,
producing [none -DDEBUGGING] prompts. This is fixed.
Many of the units in metaconfig used the construct
if xxx=`loc...`; then
On most machines the exit status of loc ends up in $?, but on
a few machines, the assignment apparently sets $? to 0, since
it always succeeds. Oh well...
The tests for byte order had difficulties with illegal octal
digits and constants that were too long, as well as not defining
the union in try.c correctly.
When <dirent.h> was missing, it was assumed that the field d_namlen
existed. There is now an explicit check of <sys/dir.h> for the field.
The tests of <signal.h> to see how signal() is declared needed to have
signal.h run through the C preprocessor first because of POSIX ifdefs.
The type returned by getgroups() was defaulting wrong on Suns and
such. Configure now checks against the lint library if it exists
to produce a better default.
The construct
foreach $elem (@array) {
foreach $elem (@array) {
...
}
}
didn't work right because the iterator for the array was stored
with the array rather than with the node in the syntax tree.
If you said
defined $foo{'bar'}
it would create the element $foo{'bar'} while returning the
correct value. It now no longer creates the value.
The grep() function was occasionally losing arguments or dumping core.
This was because it called eval() on each argument but didn't
account for the fact that eval() is capable of reallocating the
stack.
If you said
$something ? $foo[1] : $foo[2]
you ended up (usually) with
$something ? $foo[0] : $foo[0]
because of the way the ?: operator tries to fool the stack into
thinking there's only one argument there instead of three. This
only happened to constant subscripts. Interestingly enough,
$abc[1] ? $foo[1] : $bar[1]
would have worked, since the first argument has the same subscript.
Some machines already define TRUE and FALSE, so we have to undef
them to avoid warnings.
Several people sent in some fixes for manual typos and indent problems.
There was a reqeust to clarify the difference between $! and $@, and
I added a gratuitous warning about print making an array context for
its arguments, since people seem to run into that frequently.
suidperl could correctly emulate a setgid script, but then it could
get confused about what the actual effective gid was.
Some machine or other defines sighandler(), so perl's sighandler()
needed to be made static.
We changed uchar to unchar for Crays, and it turns out that lots
of SysV machines typedef unchar instead. Sigh. It's now un_char.
If you did substitutions to chop leading components off a string,
and then set the string from <filehandle>, under certain circumstances
the input string could be corrupted because str_gets() called
str_grow() without making sure to change the strings current length to
be the number of characters just read, rather than the old length.
op.stat occasionally failed with NFS race condition, so it now waits
two seconds instead of one to guarantee that the NFS server advances
its clock at least one second.
IBM PC/RT compiler can't deal with UNI() and LOP() macros. If you
define CRIPPLED_CC it now will recast those macros as subroutines,
which runs a little slower but doesn't give the compiler heartburn.
The } character can terminate either an associative array subscript
or a BLOCK. These set up different expectations as to whether the
next token might be a term or an operator. There was a faulty
heuristic based on whether there was an intervening newline.
It turns out that if } simply leaves the current expectations along,
the right thing happens.
The command y/abcde// didn't work because the length of the first
part was not correctly copied to the second part.
In s2p, line labels without a subsequent statement were done wrong,
since an extra semicolon needs to be supplied. It wasn't always
suppplied, and when it was supplied, it was in the wrong place.
S2p also needed to remove its /tmp files better.
A2p translates
for (a in b)
to
foreach $a} (keys(%b))
on Pyramids, because index(s, '}' + 128) doesn't find a } with the
top bit set. This has been fixed.
Larry Wall [Fri, 10 Nov 1989 16:20:57 +0000]
perl 3.0 patch #4 Patch #2 continued
Larry Wall [Fri, 10 Nov 1989 16:20:25 +0000]
perl 3.0 patch #3 Patch #2 continued
Larry Wall [Fri, 10 Nov 1989 16:10:36 +0000]
perl 3.0 patch #2 (combined patch)
The metaconfig problem with pw_* fields has been fixed.
When you specify extra libraries to link in, Configure now
uses those libraries as well as libc to look for the functions
that are available. From the ccflags you give it now derives
the corresponding flags for the C preprocessor. And it has
better support for the Gnu C preprocessor.
Configure now detects USGness by the behavior of the tr program.
If USGness isn't found, then SIGTSTP determines BSDness.
The define of DEBUGGING has been taken out of perl.h and a2p.h.
If you want debugging you have to add -DDEBUGGING in a cc flag.
If you give an optimizer flag of -g, you get DEBUGGING as a
default.
Machines like the Cray have longs longer than 4 bytes. There
is now support for that.
Some machines have csh in other places than /bin. Configure
now figures out where it is.
Configure now supports Wollongong sockets and knows about
/usr/netinclude and /usr/lib/libnet.a.
Configure now gets sig names directly from signal.h if possible,
and only if that fails does it try to use kill -l.
The $sockethdr variable has been incorporated into $ccflags
Non-BSD machines required two ^D's to exit
while (<>) { ... }
This has been fixed, I believe, though I can't test it here.
It's now possible to compile perl without the DEBUGGING code.
It runs about 10% faster when you take the code out.
Configure now discovers if <sys/time.h> includes <time.h>, or
whether perl must include it itself.
Configure now finds the wait4() routine if available.
'-' x 26 made warnings about undefined value because of a bug
in evalstatic(). (Non-static 'x' didn't have the problem.)
A local list consisting of nothing but an array didn't work
right. Now it does.
A printf %c omitted the format string between the preceeding % field
and the %c. Code to printf %D, %X and %O was misplaced.
Some machines complain about printing signed values with
unsigned format specifiers like %x. The unsigned specifiers
now have a separate cast from the signed specifiers like %d.
The various file modes were not orthogonal. Now you can use
any of:
< > >> +< +> +>> <& >& >>& +<& +>& +>>&
Perl can now detect when a parent process passes in a socket so
that you can write reasonable inetd servers.
File descriptors above 2 are now closed on exec, either by using
the fcntl(), or if unavailable, brute force closing in a loop.
The return values of getsockopt(), getsockname() and getpeername()
were always undefined.
There were several places where a warn("shutdown") had to be
changed to some other function name.
The C routine gethostbyname() was misdeclared as gethostbynam().
telldir() is sometimes a macro, so we can't declare its return
value if it's defined.
Components of a slice corresponding to non-existent index elements
are now undefined rather than just null.
The mkdir and rmdir function will call the mkdir and rmdir
programs if the corresponding system calls aren't available.
The name of the directory was not quoted properly however.
Also, some attempt is now made to translate the odd messages
that some mkdirs and rmdir return into reasonable error codes.
As a final check for mkdir programs that return NO useful status,
a stat is done following the mkdir or rmdir to make sure the
directory is really there or gone.
The fileno, seekdir, rewinddir and closedir functions now specifically
disallow defaults and return undef. Previously they would just crash
perl.
CX/UX needs to set the key each time when iterating over associative
arrays due to a non-standard dbm_nextkey() function.
The lib/getopts.pl routine needed to shift @ARGV explicitly in
several spots.
The malloc pointer corruption check was made more portable by just
checking for alignment errors. It also is removed if DEBUGGING
is not enabled.
The include of <netinet/in.h> needed to be moved down below the
include of <sys/types.h> for some machines.
Not all machines declare the yydebug variable as the same type.
The reference to yydebug was moved to perl.y where it doesn't care.
I documented that a space must separate any word and a subsequent
single-quoted string because of package name prefixes.
Some long lines were broken for nroff, but not for troff.
One example of unshift in the manual had its arguments backwards.
I clarified that operation of ^ and $ on multiline strings when $*
is false is somewhat inconsistent.
People were forced to say !($foo++) when !$foo++ should be legal.
None of the unary operators correctly handled their default
arguments because of a screw-up in the parser actions.
/[\000]/ never matched a null due to some left over non-binary-ness
of perl 2.0.
/\b$foo/ gave up too early in trying to match at the end of a string.
sys_nerr was being used as the maximum error message number, when
in fact it's the maximum+1.
The identifier "uchar" is a typedef on Crays, so the variable of that
name was changed to "unchar".
The TEST program tried to run patch reject files. The reject files
are now rejected by TEST.
One test failed on picky systems because it referred to a filename
longer than 14 chars.
The op.split test assumed that the perl -D switch was available,
when in fact it's only available if perl was compiled with DEBUGGING.
Some header file somewhere defined macro CLINE, which conflicted
with toke.c's CLINE macro.
In s2p, + within patterns needed backslashing because + isn't a
metacharacter for sed. s2p was also printing out some debugging
info to the output file.
In a2p, an awk script with no line actions didn't make a main
loop, but it needs one to keep the awk semantics.
Larry Wall [Thu, 26 Oct 1989 10:31:40 +0000]
perl 3.0 patch #1 (combined patch)
Configure had difficulties if the user's path had weird components.
Now Configure appends the user's path to its own.
Some machines need <netinet/in.h> included in order to define
certain macros for packing or unpacking network order data.
On Suns, the shared library is used by default. If it doesn't
contain something contained in /lib/libc.a, then Configure was
getting things wrong (such as gethostent()). Now Configure uses
the shared library if it's there in preference to libc.a.
When gcc was selected as the compiler, the cc flags defaulted to
-fpcc_struct_return. Unfortunately, the underlines should be hyphens.
Configure figures out if BSD shadow passwords are installed and
the getpw* routines now return slightly different data in the
affected fields.
Some of the prompts in Configure with regard to gid and uid types
were unclear as to their intended use. They are now a little
clearer.
Sometimes you could change a .h file and taintperl and suidperl
didn't get remade correctly because of missing dependencies
in the Makefile.
The README file was misleading about the fact that you have to
say "make test" before you can "cd t; TEST"
The reverse operator was busted in two different ways. Should work
better now. There are now regression tests for it.
Some of the optimizations that perl does are disabled after period
of time if perl decides they aren't doing any good. One of these
caused a string to be freed that was later referenced via another
pointer, causing core dumps. The free turned out to be unnecessary,
so it was removed.
The unless modifier was broken when run under the debugger, due to
the invert() routine in perl.y inverting the logic on the DB
subroutine call instead of the command the unless was modifying.
Configure vfork test was backwards. It now works like other defines.
The numeric switch optimization was broken, and caused code to be
bypassed. This has been fixed.
A split in a subroutine that has no target splits into @_.
Unfortunately, this wrongly freed any referenced arguments passed
in through @_, causing confusing behavior later in the program.
File globbing (<foo.*>) left one orphaned string each time it
called the shell to do the glob.
RCS expanded an unintended $Header in lib/perldb.pl. This has
been fixed simply by replacing the $ with a .
Some forward declarations of static functions were missing from
malloc.c.
There's a strut in malloc for mips machines to extend the overhead
union to the size of a double. This was also enabled for sparc
machines.
DEC risc machines are reported to have a buggy memcmp. I've put
some conditional code into perl.h which I think will undef MEMCMP
appropriately.
In perl.man.4, I documented the desirability of using parens even
where they aren't strictly necessary.
I've grandfathered "format stdout" to be the same as "format STDOUT".
Unary operators can be called with no argument. The corresponding
function call form using empty parens () didn't work right, though
it did for certain functions in 2.0. It now works in 3.0.
The string ordering tests were wrong for pairs of strings in which
one string was a prefix of the other. This affected lt, le, gt,
ge, and the sort operator when used with no subroutine.
$/ didn't work with the stupid code used when STDSTDIO was undefined.
The stupid code has been replaced with smarter code that can do
it right. Special thanks to Piet van Oostrum for the code.
Goulds work better if the union in STR is at an 8 byte boundary.
The fields were rearranged somewhat to provide this.
"sort keys %a" should now work right (though parens are still
desirable for readability).
bcopy() needed a forward declaration on some machines.
In x2p/Makefile.SH, added dependency on ../config.sh so that it
gets linked down from above if it got removed for some reason.
Larry Wall [Wed, 18 Oct 1989 00:00:00 +0000]
perl 3.0: (no announcement message available)
A few of the new features: (18 Oct)
* Perl can now handle binary data correctly and has functions to pack and unpack binary structures into arrays or lists. You can now do arbitrary ioctl functions.
* You can now pass things to subroutines by reference.
* Debugger enhancements.
* An array or associative array may now appear in a local() list.
* Array values may now be interpolated into strings.
* Subroutine names are now distinguished by prefixing with &. You can call subroutines without using do, and without passing any argument list at all.
* You can use the new -u switch to cause perl to dump core so that you can run undump and produce a binary executable image. Alternately you can use the "dump" operator after initializing any variables and such.
* You can now chop lists.
* Perl now uses /bin/csh to do filename globbing, if available. This means that filenames with spaces or other strangenesses work right.
* New functions: mkdir and rmdir, getppid, getpgrp and setpgrp, getpriority and setpriority, chroot, ioctl and fcntl, flock, readlink, lstat, rindex, pack and unpack, read, warn, dbmopen and dbmclose, dump, reverse, defined, undef.
Larry Wall [Tue, 28 Jun 1988 03:41:16 +0000]
perl 2.0 patch 1: removed redundant debugging code in regexp.c
If you used ++ on a variable that had the value '' (as opposed to
being undefined) it would increment the numeric part but not
invalidate the string part, which could then give false results.
Berkeley recently sent out a patch that disables setuid #! scripts
because of an inherent problem in the semantics as they are
currently defined. If you have installed that patch, your setuid
and setgid bits are useless on scripts. I've added a means
for perl to examine those bits and emulate setuid/setgid scripts
itself in what I believe is a secure manner. If normal perl
detects such a script, it passes it off to another version of
perl that runs setuid root, and can run the script under the
desired uid/gid. This feature is optional, and Configure will
ask if you want to do it.
Some machines didn't like config.h when it said #/*undef SYMBOL.
Config.h.SH now is smart enough to tuck the # inside the comment.
There were several small problems in Configure: the return code from
ar was hidden by a piped call to sed, so if ar failed it went
undetected. The Cray uses a program called bld instead of ar.
Let's hear it for compatibilty. At least one version of gnucpp
adds a space after symbol interpolation, which was giving the
C preprocessor detector fits. There was a call to grep '-i' that
needed to have the -i protected by a backslash. Also, Configure
should remove the UU subdirectory that it makes while running.
"make realclean" now knows about the alternate patch extension ~.
In the manual page, I fixed some quotes that were ugly in troff,
and did some clarification of LIST, study, tr and unlink.
regexp.c had some redundant debugging code.
tr/x/y/ could dump core if y is shorter than x. I found this out
when I tried translating a bunch of characters to space by saying
something like y/a-z/ /.
Larry Wall [Sun, 5 Jun 1988 00:00:00 +0000]
perl 2.0 (no announcement message available)
Some of the enhancements from Perl1 included:
* New regexp routines derived from Henry Spencer's.
o Support for /(foo|bar)/.
o Support for /(foo)*/ and /(foo)+/.
o \s for whitespace, \S for non-, \d for digit, \D nondigit
* Local variables in blocks, subroutines and evals.
* Recursive subroutine calls are now supported.
* Array values may now be interpolated into lists: unlink 'foo', 'bar', @trashcan, 'tmp';
* File globbing.
* Use of <> in array contexts returns the whole file or glob list.
* New iterator for normal arrays, foreach, that allows both read and write.
* Ability to open pipe to a forked off script for secure pipes in setuid scripts.
* File inclusion via do 'foo.pl';
* More file tests, including -t to see if, for instance, stdin is a terminal. File tests now behave in a more correct manner. You can do file tests on filehandles as well as filenames. The special filetests -T and -B test a file to see if it's text or binary.
* An eof can now be used on each file of the <> input for such purposes as resetting the line numbers or appending to each file of an inplace edit.
* Assignments can now function as lvalues, so you can say things like ($HOST = $host) =~ tr/a-z/A-Z/; ($obj = $src) =~ s/\.c$/.o/;
* You can now do certain file operations with a variable which holds the name of a filehandle, e.g. open(++$incl,$includefilename); $foo = <$incl>;
* Warnings are now available (with -w) on use of uninitialized variables and on identifiers that are mentioned only once, and on reference to various undefined things.
* There is now a wait operator.
* There is now a sort operator.
* The manual is now not lying when it says that perl is generally faster than sed. I hope.
Jeff Siegal [Mon, 1 Feb 1988 22:56:10 +0000]
perl 1.0 patch 14: a2p incorrectly translates 'for (a in b)' construct.
The code a2p creates for the 'for (a in b)' construct ends
up assigning the wrong value to the key variable.
Kriton Kyrimis [Mon, 1 Feb 1988 22:28:33 +0000]
perl 1.0 patch 13: fix for faulty patch 12, plus random portability glitches
I botched patch #12, so that split(' ') only works on the first
line of input due to unintended interference by the optimization
that was added at the same time. Yes, I tested it, but only on
one line of input. *Sigh*
Some glitches have turned up on some of the rusty pig iron out there,
so here are some unglitchifications.
Kriton Kyrimis [Mon, 1 Feb 1988 04:35:21 +0000]
perl 1.0 patch 12: scripts made by a2p doen't handle leading white space right on input
Awk ignores leading whitespace on split. Perl by default does not.
The a2p translator couldn't handle this. The fix is partly to a2p
and partly to perl. Perl now has a way to specify to split to
ignore leading white space as awk does. A2p now takes advantage of
that.
I also threw in an optimization that let's runtime patterns
compile just once if they are known to be constant, so that
split(' ') doesn't compile the pattern every time.
Mark Biggar [Sun, 31 Jan 1988 20:00:34 +0000]
perl 1.0 patch 11: documentation upgrade
I documented the new eval operator for patch 8 but my automatic
patch generator overlooked it for some reason.
Here's the documentation for the eval operator, along with some
other documentation changes suggested by Mark.
Peter E. Yee [Fri, 29 Jan 1988 20:22:10 +0000]
perl 1.0 patch 10: if your libc is in a strange place, Configure blows up
There's a line in Configure that says libc=ans which should say
libc=$ans. This only shows up if libc.a isn't in /lib.
Marnix (ain't unix!) A. van Ammers [Fri, 29 Jan 1988 19:58:36 +0000]
perl 1.0 patch 9: 3 portability problems
There's a #define YYDEBUG; in perl.h that ought to be
#define YYDEBUG 1. Interesting that it works the former way on
any systems at all.
Patch 2 was defective and introduced a couple of lines with missing
right parens. Learn something old every day...
Some awks can't handle
awk '$6 != "" {print substr($6,2,100)}' </tmp/Cppsym2$$ ;;
if field 6 doesn't exist. Changed conditional to NF > 5.
There was also a problem that I fixed in metaconfig that involved
Configure grepping .SH files out of MANIFEST when the .SH was only
in the commentary. This doesn't affect perl's Configure because
there aren't any comments containing .SH in the MANIFEST file.
But that's the nice thing about metaconfig--you generate a new
Configure script and also get the changes you don't need (yet).
Larry Wall [Wed, 27 Jan 1988 22:18:25 +0000]
perl 1.0 patch 8: perl needed an eval operator and a symbolic debugger
I didn't add an eval operator to the original perl because
I hadn't thought of any good uses for it. Recently I thought
of some. Along with creating the eval operator, this patch
introduces a symbolic debugger for perl scripts, which makes
use of eval to interpret some debugging commands. Having eval
also lets me emulate awk's FOO=bar command line behavior with
a line such as the one a2p now inserts at the beginning of
translated scripts.
Arnold D. Robbins [Tue, 26 Jan 1988 01:16:41 +0000]
perl 1.0 patch 7: use of included malloc.c should be optional
The version of malloc.c that comes with perl was not really intended
to be used everywhere--it was included mostly for debugging purposes.
It's a nice little package, however, so I'm making it optional (via
Configure) as to whether you want it or not.
Andrew Burt [Mon, 25 Jan 1988 23:31:23 +0000]
perl 1.0 patch 6: printf doesn't finish processing format string when out of args.
printf "%% %d %%", 1; produces "% 1 %%", which is counterintuitive.
Arnold D. Robbins [Mon, 25 Jan 1988 20:53:22 +0000]
perl 1.0 patch 5: a2p didn't make use of the config.h generated by Configure
The a2p program used index() and bcopy(), both of do not exist
everywhere. Since Configure was already figuring out about those
functions, it is fairly trivial to get a2p to make use of the info.
Paul Eggert [Mon, 25 Jan 1988 19:48:31 +0000]
perl 1.0 patch 4: make depend doesn't work if . isn't in your PATH
make depend doesn't work if . isn't in your PATH.
Larry Wall [Sat, 23 Jan 1988 15:23:55 +0000]
perl 1.0 patch 3: Patch 2 was incomplete
I left one file out of patch 2. This is perhaps forgivable since
it is a file that is produced automatically by metaconfig along
with Configure.
Andrew Burt [Sat, 23 Jan 1988 14:57:57 +0000]
perl 1.0 patch 2: Various portability fixes.
Some things didn't work right on System V and Pyramids.
Dan Faigin, Doug Landauer [Thu, 21 Jan 1988 09:21:04 +0000]
perl 1.0 patch 1: Portability bugs and one possible SIGSEGV
On some systems the Configure script and C compilations get
warning messages that may scare some folks unnecessarily.
Also, use of the "redo" command if debugging is compiled in
overflows a stack on which the trace context is kept.
Larry Wall [Fri, 18 Dec 1987 00:00:00 +0000]
a "replacement" for awk and sed
[ Perl is kind of designed to make awk and sed semi-obsolete. This posting
will include the first 10 patches after the main source. The following
description is lifted from Larry's manpage. --r$ ]
Perl is a interpreted language optimized for scanning arbitrary text
files, extracting information from those text files, and printing
reports based on that information. It's also a good language for many
system management tasks. The language is intended to be practical
(easy to use, efficient, complete) rather than beautiful (tiny,
elegant, minimal). It combines (in the author's opinion, anyway) some
of the best features of C, sed, awk, and sh, so people familiar with
those languages should have little difficulty with it. (Language
historians will also note some vestiges of csh, Pascal, and even
BASIC-PLUS.) Expression syntax corresponds quite closely to C
expression syntax. If you have a problem that would ordinarily use sed
or awk or sh, but it exceeds their capabilities or must run a little
faster, and you don't want to write the silly thing in C, then perl may
be for you. There are also translators to turn your sed and awk
scripts into perl scripts.