-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item12952: ScriptSuffix checker fails on FreeBSD
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
Showing
1 changed file
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gac410
via email
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 | ||
|
wouldn't http://perldoc.perl.org/File/Basename.html be better?