1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
From: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Date: Sat, 30 Aug 2014 17:12:45 -0700
Subject: Make source and destination path expansion behave more like users
expect it
Bug-Debian: http://bugs.debian.org/594049
Author: Axel Beckert <abe@debian.org>
---
mb2md-3.20.pl | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mb2md-3.20.pl b/mb2md-3.20.pl
index 2945254..d18d224 100644
--- a/mb2md-3.20.pl
+++ b/mb2md-3.20.pl
@@ -411,6 +411,7 @@ my $mbfile = undef; # this is an mbox file
my $dest = undef;
my $strip_ext = undef;
my $use_cl = undef; # defines whether we use the Content-Length: header if present
+my $pwd = `pwd`; chomp($pwd);
# if option "-c" is given, we use the Content-Length: header if present
# dangerous! may be unreliable, as the whole CL stuff is a bad idea
@@ -443,7 +444,7 @@ elsif (defined($opts{s}))
# it is a subdir of the users $home
# if it does start with a "/" then
# let's take $mbroot as a absolut path
- $opts{s} = "$homedir/$opts{s}" if ($opts{s} !~ /^\//);
+ $opts{s} = "$homedir/$opts{s}" if ($opts{s} !~ m(^[/.]));
# check if the given source is a mbox file
if (-f $opts{s})
@@ -493,13 +494,13 @@ if(defined($opts{l}))
# if the destination is relative to the home dir,
# check that the home dir exists
-die("Fatal: home dir $homedir doesn't exist.\n") if ($dest !~ /^\// && ! -e $homedir);
+die("Fatal: home dir $homedir doesn't exist.\n") if ($dest !~ m(^[/.]) && ! -e $homedir);
#
# form the destination value
# slap the home dir on the front of the dest if the dest does not begin
# with a '/'
-$dest = "$homedir/$dest" if ($dest !~ /^\//);
+$dest = "$homedir/$dest" if ($dest !~ m(^[/.]));
# get rid of trailing /'s
$dest =~ s/\/$//;
@@ -754,6 +755,7 @@ sub convert
# Change to the target mailbox directory.
chdir "$maildir" ;
+ $mbox = "$pwd/$mbox" if ($mbox !~ m(^[/.]));
# Converts a Mbox to multiple files
# in a Maildir.
|