From: Frank Lichtenheld Date: Thu, 20 Sep 2007 01:30:00 +0000 (+0200) Subject: Dpkg.pm: Make regex for $progname more robust X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e198bcd50eb4f58db87b652810e1ef598bc8cabf;p=dpkg Dpkg.pm: Make regex for $progname more robust While it is not very common to have $0 contain no '/', it may happen on occasion (after all it happened to me ;). --- diff --git a/ChangeLog b/ChangeLog index 66d76ac9..88728645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-09-20 Frank Lichtenheld + + * scripts/Dpkg.pm: Make the regex for determining + $progname more robust. + 2007-09-18 Guillem Jover * lib/mlib.c (checksubprocerr): Warn instead of erroring out in case diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm index fc6d8750..7886018d 100644 --- a/scripts/Dpkg.pm +++ b/scripts/Dpkg.pm @@ -6,7 +6,7 @@ use warnings; use base qw(Exporter); our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir); -our ($progname) = $0 =~ m:.*/(.*):; +our ($progname) = $0 =~ m#(?:.*/)?([^/]*)#; # The following lines are automatically fixed at install time our $version = "1.14";