Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove '.' from @INC #181

Merged
merged 1 commit into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/bin/ccm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use warnings;
# required for CAF
BEGIN {
unshift(@INC, '/usr/lib/perl');
pop @INC if $INC[-1] eq '.';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title should be changed to "only remove '.' when it's the last element in INC".
or replace the BEGIN block with (untested)

BEGIN {
    @INC = ('/usr/lib/perl', grep {$_ ne '.'} @INC);
}

btw, this should be turned in a template in maven-tools, i made quattor/maven-tools#169

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea comes from here (a respected member of the perl community):
https://www.masteringperl.org/2017/01/perl-v5-26-removes-from-inc-but-dont-think-youre-safe/

dot is always last in INC so it should suffice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i wasn't sure. can you also open an issue to switch remaining scripts to taint mode, so this isn't forgotten?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

# minimal Path
Expand Down
1 change: 1 addition & 0 deletions src/main/bin/ccm-fetch
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use warnings;
# required for CAF (Common Application Framework)
BEGIN {
unshift(@INC, '/usr/lib/perl');
pop @INC if $INC[-1] eq '.';
}

use CAF::Application;
Expand Down
1 change: 1 addition & 0 deletions src/main/bin/ccm-initialise
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use warnings;

BEGIN {
unshift(@INC, '/usr/lib/perl');
pop @INC if $INC[-1] eq '.';
}

use CAF::Application;
Expand Down
1 change: 1 addition & 0 deletions src/main/bin/ccm-purge
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use warnings;

BEGIN {
unshift(@INC, '/usr/lib/perl');
pop @INC if $INC[-1] eq '.';
}

use Getopt::Long;
Expand Down