Package: apt-cacher-ng
Version: 0.1.9-1
Severity: normal
Tags: patch

When configuring apt-cacher-ng to remap some paths, you can use
rewrite files and backend files. The documentation suggest that all of
those files maybe either URL lists or RFC822-style name:value lists.
This is not the case for rewrite files, since the function
_ReadRewriteFiles in acfg.cc is missing a special case for URLs.

The attached patch is a quick fix, but merging the differen file reading
functions would probably be the better solution...

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-xen-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt-cacher-ng depends on:
ii  adduser                3.105             add and remove users and groups
ii  libbz2-1.0             1.0.4-2           high-quality block-sorting file co
ii  libc6                  2.7-6             GNU C Library: Shared libraries
ii  libfuse2               2.7.2-1           Filesystem in USErspace library
ii  libgcc1                1:4.3-20080116-1  GCC support library
ii  libstdc++6             4.3-20080116-1    The GNU Standard C++ Library v3
ii  zlib1g                 1:1.2.3.3.dfsg-10 compression library - runtime

apt-cacher-ng recommends no packages.

-- no debconf information
diff -Naur apt-cacher-ng-0.1.9/source/acfg.cc apt-cacher-ng-0.1.9.new/source/acfg.cc
--- apt-cacher-ng-0.1.9/source/acfg.cc	2007-12-10 22:33:21.000000000 +0100
+++ apt-cacher-ng-0.1.9.new/source/acfg.cc	2008-01-20 00:56:23.000000000 +0100
@@ -302,7 +302,7 @@
 	reader.OpenFile(sFile.c_str());
 	
 	if(verbose)
-		cout << "Reading file: " << sFile <<endl;
+		cout << "Reading backend file: " << sFile <<endl;
 	if(!reader.CheckGoodState(false))
 	{
 		if(verbose)
@@ -372,7 +372,7 @@
 
 	filereader reader;
 	if(verbose)
-		cout << "Reading file: " << sFile <<endl;
+		cout << "Reading rewrite file: " << sFile <<endl;
 	reader.OpenFile(sFile.c_str());
 	reader.CheckGoodState(true);
 
@@ -384,7 +384,21 @@
 	{
 		bNotEof=reader.GetOneLine(sLine);
 		
-		if (IsValidButIrrelevantLine(sLine)) // end of block, eof, ... -> commit it
+		if(0==sLine.compare(0, 7, "http://";))
+		{
+			tHttpUrl url;
+			if (url.SetHttpUrl(sLine)) {
+				_FixPostPreSlashes(url.sPath);
+				pair<tHttpUrl, const string*> info(url, _CheckBEentryGetNamePtr(sRepName));
+				mapUrl2pVname.insert(info);
+			} else {
+				cout << "Parse error, invalid URL" << sLine << " on line "
+						<< reader.GetPositionDescription() <<endl;
+				exit(2);
+			}
+			continue;
+		}
+		else if (IsValidButIrrelevantLine(sLine)) // end of block, eof, ... -> commit it
 		{
 			if (hosts.empty() && paths.empty())
 				continue; // dummy run

Reply via email to