[devscripts] 02/05: bts: Use File::Spec in cachefile/mboxfile/cachebugdir

James McCoy jamessan at debian.org
Tue Jun 9 02:35:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 6274145dfdfe52686ec51a3adfea9e041c37fa9d
Author: James McCoy <jamessan at debian.org>
Date:   Sun Jun 7 00:50:21 2015 -0400

    bts: Use File::Spec in cachefile/mboxfile/cachebugdir
    
    f45a0b4b71424b50adffe4f8c47cca64ac5fff53 caused path separators not to
    be included between the cachedir and the trailing element in the
    mentioned functions.  Use of File::Spec (catfile or catdir, accordingly)
    ensures the correct separator is included.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 scripts/bts.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/bts.pl b/scripts/bts.pl
index 37aafb0..8a3a34a 100755
--- a/scripts/bts.pl
+++ b/scripts/bts.pl
@@ -3384,20 +3384,20 @@ sub cachefile {
     $thing =~ s%/%_%g;
     $thgopts =~ s/;/_3B/g;
     $thgopts =~ s/=/_3D/g;
-    return $cachedir.$thing.$thgopts.($thing =~ /\.html$/ ? "" : ".html");
+    return File::Spec->catfile($cachedir, $thing.$thgopts.($thing =~ /\.html$/ ? "" : ".html"));
 }
 
 # Given a thing, returns the filename for its mbox in the cache.
 sub mboxfile {
     my $thing=shift;
-    return $thing =~ /^\d+$/ ? $cachedir.$thing.".mbox" : undef;
+    return $thing =~ /^\d+$/ ? File::Spec->catfile($cachedir, $thing.".mbox") : undef;
 }
 
 # Given a bug number, returns the dirname for it in the cache.
 sub cachebugdir {
     my $thing=shift;
     if ($thing !~ /^\d+$/) { die "$progname: cachebugdir given faulty argument: $thing\n"; }
-    return $cachedir.$thing;
+    return File::Spec->catdir($cachedir, $thing);
 }
 
 # And the reverse: Given a filename in the cache, returns the corresponding
@@ -3783,7 +3783,7 @@ sub runbrowser {
 sub runmailreader {
     my $file = shift;
     my $quotedfile;
-    die "$progname: could not read mbox file!\n" unless -r $file;
+    die "$progname: could not read mbox file $file!\n" unless -r $file;
 
     if ($file !~ /\'/) { $quotedfile = qq['$file']; }
     elsif ($file !~ /[\"\\\$\'\!]/) { $quotedfile = qq["$file"]; }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list