Bläddra i källkod

Support tabs in sources.list files

Also support vertical tabs, as isspace() does the same.

Closes: #796067
Julian Andres Klode 11 år sedan
förälder
incheckning
defe3231c7
2 ändrade filer med 7 tillägg och 1 borttagningar
  1. 1 1
      apt-pkg/sourcelist.cc
  2. 6 0
      test/integration/test-apt-sources-deb822

+ 1 - 1
apt-pkg/sourcelist.cc

@@ -384,7 +384,7 @@ bool pkgSourceList::ParseFileOldStyle(std::string const &File)
 	 continue;
 
       // Grok it
-      std::string const LineType = Buffer.substr(0, Buffer.find(' '));
+      std::string const LineType = Buffer.substr(0, Buffer.find_first_of(" \t\v"));
       if (LineType.empty() || LineType == Buffer)
 	 return _error->Error(_("Malformed line %u in source list %s (type)"),CurLine,File.c_str());
 

+ 6 - 0
test/integration/test-apt-sources-deb822

@@ -31,6 +31,12 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.deb
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
+msgcleantest 'Test sources.list' 'old style with tabs'
+echo "deb	http://ftp.debian.org/debian	stable main" > $LISTS
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
+
 msgcleantest 'Test sources.list' 'old style with options'
 echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
 testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0