Mailing List Archive

perl5 vs perl4 problems (fwd)
didn't someone have a solution to the readonly of constant
problem in perl5? is this going to happen, larry?

--tom

------- start of forwarded message -------
Path: csnews!boulder!csn!symbios.com!southwind.net!news.sprintlink.net!simtel!harbinger.cc.monash.edu.au!mail_gw.fwall.telecom.com.au!cdn_mail.telecom.com.au!sjg
From: sjg@dn.itg.telecom.com.au (Simon J. Gerraty)
Newsgroups: comp.lang.perl.misc
Subject: perl5 vs perl4 problems
Date: 12 Sep 95 05:11:17 GMT
Organization: Telstra
Lines: 35
Message-ID: <sjg.810882677@netboss>
NNTP-Posting-Host: netboss-fddi.dn.itg.telecom.com.au

I'm having lots of fun trying to get req to work with perl-5.

It basically uses a setuid C wrapper to run a perl script.

The following snipet works fine with perl4 and perl5 when just run
from the command line - no setuid.

sub append_additions {
for $line (@_) {
$line =~ s:\n*$::;
print "$line\n";
}
}

When run under sendmail, with perl5 I get the error:

Modification of a read-only value attempted at /usr/local/req/etc/req-operation line 1404.

which corresponds to the line:
$line =~ s:\n*$::;

changing that to
$line =~ s:\n*\$::;

allows the command to run successfully, but the newlines are obviously not
removed as intended.

It must be possible to fix this, but I can't even reproduce it without the
help of sendmail and the C wrapper.

--sjg
--
Simon J. Gerraty <sjg@telstra.com.au>

#include <disclaimer> /* imagine something _very_ witty here */
------- end of forwarded message -------

--
Tom Christiansen Perl Consultant, Gamer, Hiker tchrist@mox.perl.com


I have a different view of the world. --Andrew Hume. Show&Tell '87
Re: perl5 vs perl4 problems (fwd) [ In reply to ]
: didn't someone have a solution to the readonly of constant
: problem in perl5? is this going to happen, larry?

I suspect this is a problem with tainting. Could well be fixed already.
I've written off for version info.

Larry
Re: perl5 vs perl4 problems (fwd) [ In reply to ]
Excerpts from the mail message of Larry Wall:
)
) : didn't someone have a solution to the readonly of constant
) : problem in perl5? is this going to happen, larry?
)
) I suspect this is a problem with tainting. Could well be fixed already.
) I've written off for version info.

Is the following expected/desirable? It doesn't require SUID or
tainting, so I thought I'd mention it. (perl5.001m, UnixWare 1.1)

% cat readonly.pl
#!/usr/bin/perl
print &func( "This literal is read-only?\n" );
sub func {
$_[0] =~ s/read-only/writable/;
$_[0];
}
% ./readonly.pl
Modification of a read-only value attempted at ./readonly.pl line 4.
%

I can see a point to it if it is intentional and allows
optimization by skipping a memory copy of the string. But it
is a change from perl4 and looked a lot like what was happening
in the note that Tom forwarded.
--
Tye McQueen tye@metronet.com || tye@doober.usu.edu
Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
Re: perl5 vs perl4 problems (fwd) [ In reply to ]
: Excerpts from the mail message of Larry Wall:
: )
: ) : didn't someone have a solution to the readonly of constant
: ) : problem in perl5? is this going to happen, larry?
: )
: ) I suspect this is a problem with tainting. Could well be fixed already.
: ) I've written off for version info.
:
: Is the following expected/desirable? It doesn't require SUID or
: tainting, so I thought I'd mention it. (perl5.001m, UnixWare 1.1)
:
: % cat readonly.pl
: #!/usr/bin/perl
: print &func( "This literal is read-only?\n" );
: sub func {
: $_[0] =~ s/read-only/writable/;
: $_[0];
: }
: % ./readonly.pl
: Modification of a read-only value attempted at ./readonly.pl line 4.
: %
:
: I can see a point to it if it is intentional and allows
: optimization by skipping a memory copy of the string. But it
: is a change from perl4 and looked a lot like what was happening
: in the note that Tom forwarded.

Could be. The note doesn't say what they were passing into the sub.

Larry
Re: perl5 vs perl4 problems (fwd) [ In reply to ]
> Is the following expected/desirable? It doesn't require SUID or
> tainting, so I thought I'd mention it. (perl5.001m, UnixWare 1.1)

> % cat readonly.pl
> #!/usr/bin/perl
> print &func( "This literal is read-only?\n" );
> sub func {
> $_[0] =~ s/read-only/writable/;
> $_[0];
> }
> % ./readonly.pl
> Modification of a read-only value attempted at ./readonly.pl line 4.
> %

> I can see a point to it if it is intentional and allows
> optimization by skipping a memory copy of the string. But it
> is a change from perl4 and looked a lot like what was happening
> in the note that Tom forwarded.

yes, that's exactly the point.

perl4 programs ran with this, although perl5 ones won't.
it's a hidden incompatitibilty that won't show up until very
late into run time, and then quite mysteriously.

--tom