]> git.saurik.com Git - apt.git/commitdiff
Support tabs in sources.list files
authorJulian Andres Klode <jak@debian.org>
Wed, 19 Aug 2015 07:50:19 +0000 (09:50 +0200)
committerJulian Andres Klode <jak@debian.org>
Wed, 19 Aug 2015 07:55:21 +0000 (09:55 +0200)
Also support vertical tabs, as isspace() does the same.

Closes: #796067
apt-pkg/sourcelist.cc
test/integration/test-apt-sources-deb822

index 3e714667c63d07814594db9ff1dc463f3412ef44..d3bcbce5fb1953da42658b83fdf3c174cc5df189 100644 (file)
@@ -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());
 
index adfe0e0037e1ffc5e87b4d1f12d8f8218a8a49db..259763096e7a61be52d11131b50964835034e1a7 100755 (executable)
@@ -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