Skip to content

Commit

Permalink
perl 2.0 patch 1: removed redundant debugging code in regexp.c
Browse files Browse the repository at this point in the history
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/ /.
  • Loading branch information
TimToady committed Jun 28, 1988
1 parent a4de7c0 commit ffd30a0
Show file tree
Hide file tree
Showing 152 changed files with 12,435 additions and 4,618 deletions.
89 changes: 89 additions & 0 deletions Changes
@@ -0,0 +1,89 @@
New regexp routines derived from Henry Spencer's.
Support for /(foo|bar)/.
Support for /(foo)*/ and /(foo)+/.
\s for whitespace, \S nonwhitespace
\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 via <*.foo>.

Use of <> in array contexts returns the whole file or glob list:
unlink <*.foo>;

New iterator for normal arrays, foreach, that allows both read and write:
foreach $elem ($array) {
$elem =~ s/foo/bar/;
}

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>;

You can now a subroutine indirectly through a scalar variable:
$which = 'xyz';
do $which('foo'); # calls xyz

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.

The -S switch causes perl to search the PATH for the script so that you can say
eval "exec /usr/bin/perl -S $0 $*"
if $running_under_some_shell;

Reset now resets arrays and associative arrays as well as string variables.

Assigning off the end of an array now nulls out any intervening values.

$#foo is now an lvalue. You can preallocate or truncate arrays, or recover
values lost to prior truncation.

$#foo is now indexed to $[ properly.

s/foo/bar/i optimization bug fixed.

The $x = "...$x..."; bug is fixed.

The @ary = (1); bug is now fixed. You can even say @ary = 1;

$= now returns the correct value.

Several of the larger files are now split into smaller pieces for easier
compilation.

Pattern matches evaluated in an array context now return ($1, $2...).

There is now a wait operator.

There is now a sort operator.

The requirement of parens around certain expressions when taking their value
has been lifted. In particular, you can say
$x = print "foo","bar";
$x = unlink "foo","bar";
chdir "foo" || die "Can't chdir to foo\n";

The manual is now not lying when it says that perl is generally faster than
sed. I hope.

0 comments on commit ffd30a0

Please sign in to comment.