Skip to content

Commit

Permalink
Item12952: ScriptSuffix checker fails on FreeBSD
Browse files Browse the repository at this point in the history
The $0 perl variable includes the full path on FreeBSD, and the regex
gets tripped up with the "foswik.org" in the path.
  • Loading branch information
gac410 committed Sep 4, 2014
1 parent 2e77b83 commit 7798c61
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/lib/Foswiki/Configure/Checkers/ScriptSuffix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ use Foswiki::Configure::Checker ();
our @ISA = ('Foswiki::Configure::Checker');

sub check_current_value {
my ($this, $reporter) = @_;
my ( $this, $reporter ) = @_;

# SMELL: On FreeBSD, $0 includes the full path.
# Don't allow any path components to disrupt the suffix
my $currentSuffix = ( $0 =~ /(\.[^.\/]*?)$/ ) ? $1 : '';

This comment has been minimized.

Copy link
@wbniv

This comment has been minimized.

Copy link
@gac410

gac410 via email Sep 4, 2014

Author Member

my $currentSuffix = ($0 =~ /(\.[^.]*)$/) ? $1 : '';
my $expectedSuffix = $Foswiki::cfg{ScriptSuffix} || '';

if ($currentSuffix ne $expectedSuffix) {
if ( $currentSuffix ne $expectedSuffix ) {
$reporter->WARN( <<WHINGE );
This script ($0) does not have the expected {ScriptSuffix} ($expectedSuffix)
WHINGE
Expand Down

0 comments on commit 7798c61

Please sign in to comment.