Browse Source

support 'apt build-dep .' (aka: without /)

Reported-By: Christoph Berg (Myon) on IRC
David Kalnischkies 7 years ago
parent
commit
ff02180ca8
2 changed files with 10 additions and 2 deletions
  1. 2 2
      apt-pkg/sourcelist.cc
  2. 8 0
      test/integration/test-apt-get-build-dep-file

+ 2 - 2
apt-pkg/sourcelist.cc

@@ -619,7 +619,7 @@ bool pkgSourceList::AddVolatileFile(std::string const &File)
 void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<std::string> * const VolatileCmdL)/*{{{*/
 {
    std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) {
-      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/'))))
+      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && (I[1] == '\0' || (I[1] == '.' && (I[2] == '\0' || I[2] == '/')) || I[1] == '/'))))
       {
 	 if (AddVolatileFile(I, VolatileCmdL))
 	    ;
@@ -633,7 +633,7 @@ void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<std::string>
 void pkgSourceList::AddVolatileFiles(CommandLine &CmdL, std::vector<const char*> * const VolatileCmdL)
 {
    std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const * const I) {
-      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && ((I[1] == '.' && I[2] == '/') || I[1] == '/'))))
+      if (I != nullptr && (I[0] == '/' || (I[0] == '.' && (I[1] == '\0' || (I[1] == '.' && (I[2] == '\0' || I[2] == '/')) || I[1] == '/'))))
       {
 	 if (AddVolatileFile(I))
 	 {

+ 8 - 0
test/integration/test-apt-get-build-dep-file

@@ -141,6 +141,14 @@ cd downloaded
 testsuccess aptget build-dep --simulate ../foo-1.0
 testsuccess aptget build-dep --simulate "$(readlink -f ../foo-1.0)"
 cd ..
+cd foo-1.0
+testsuccess aptget build-dep --simulate './'
+testsuccess aptget build-dep --simulate '.'
+cd debian
+testsuccess aptget build-dep --simulate './../'
+testsuccess aptget build-dep --simulate '../'
+testsuccess aptget build-dep --simulate '..'
+cd ../..
 
 testfailureequal 'E: Must specify at least one package to check builddeps for' aptget build-dep
 testfailureequal 'E: No architecture information available for armel. See apt.conf(5) APT::Architectures for setup' aptget build-dep --simulate ./foo-1.0 -a armel