'do' no longer loading files from '.' due to '.' being removed from @INC

Bug #1683179 reported by Jonathan Kamens
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
perl (Ubuntu)
New
Undecided
Unassigned

Bug Description

I just downloaded and compiled stock Perl 5.24.1 without any Ubuntu packages.

Then I put this in a file called foo.pl:

--cut
do 'froodle.conf';
print $froodle, "\n";
--cut

and this in froodle.conf:

--cut
$froodle = 'freedle';
--cut

Then I ran "perl foo.pl" with the stock Perl I had just compiled, and saw this:

--cut
$ perl foo.pl
freedle
$
--cut

However, when I run "perl foo.pl" with the version of Perl included in Zesty, I see this:

--cut
$ perl foo.pl

$
--cut

This is a serious, significant difference in behavior between stock Perl and Ubuntu's Perl, and a regression from Yakkety.

Using "do EXPR" to get variable settings from configuration files is even documented in the Perl documentation (https://perldoc.perl.org/functions/do.html). You can't just break this. :-/

ProblemType: Bug
DistroRelease: Ubuntu 17.04
Package: perl 5.24.1-2ubuntu1
ProcVersionSignature: Ubuntu 4.10.0-19.21-generic 4.10.8
Uname: Linux 4.10.0-19-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.4-0ubuntu4
Architecture: amd64
CurrentDesktop: Unity:Unity7
Date: Sun Apr 16 16:11:29 2017
InstallationDate: Installed on 2016-01-16 (456 days ago)
InstallationMedia: Ubuntu 15.10 "Wily Werewolf" - Release amd64 (20151021)
SourcePackage: perl
UpgradeStatus: Upgraded to zesty on 2017-04-14 (2 days ago)

Revision history for this message
Jonathan Kamens (jik) wrote :
tags: added: regression
Revision history for this message
Jonathan Kamens (jik) wrote :

Hmm. I see this in the output of perl -V:

 DEBPKG:debian/document_inc_removal - Document in perlvar that we remove '.' from @INC by default

So I guess this is a conscious decision to remove "." from @INC in Perl in Zesty?

Is this documented anywhere other than the perlvar man page? Like in Zesty's release notes or something?

Revision history for this message
Dominic Hargreaves (dom) wrote :

Hello, I'm one of the perl maintainers in Debian. In Debian we're still finalising the release notes for this issue for our next release; I suspect noone thought about communicating this change for Ubuntu :( A couple of observations that might be helpful to you and others:

1) you can revert this change (if you need to) by commenting out the relevant line in /etc/perl/sitecustomize.pl

2) I recommend that you in any case check for 'do' returning false, so that you at least don't get a silent failure.

3) This change is being made in the upcoming 5.26.0 release but for release timing reasons we have made it early.

summary: - Variables set inside files executed with do not visible to script
+ silent failure in 'do' due to '.' being removed from @INC
summary: - silent failure in 'do' due to '.' being removed from @INC
+ 'do' no longer loading files from '.' due to '.' being removed from @INC
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.