Package: apt
Version: 0.8.16~exp11
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

currently[1], apt from exp (0.8.16) fails to build on Debian/Hurd.

There are two issues, fixed by the attached patches:
* apt_textOfErrnoZero.diff:
  The GlobalError test assumes the string for the errno 0 is "Success",
  while it isn't the same on GNU/Hurd. The easy solution is to get at
  runtime the string of errno 0 and use it to compose the error strings
  for the checks.
* apt_dmesg.diff:
  There's no `dmesg` on GNU/Hurd (yet), and even in apt' sources (e.g.
  apt-pkg/deb/dpkgpm.cc) it is not considered mandatory. The solution
  I did is to create a "custom_dmesg" function in "run-tests" which
  would use `dmesg` if found, otherwise directly cat /var/log/daemon.log
  if readable, otherwise print an empty string. (Another solution would
  be use a different source for "variable text".)

[1] 
https://buildd.debian.org/status/fetch.php?pkg=apt&arch=hurd-i386&ver=0.8.16%7Eexp11&stamp=1326990779

Thanks,
-- 
Pino
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -3,9 +3,12 @@
 #include "assert.h"
 #include <string>
 #include <errno.h>
+#include <string.h>
 
 int main(int argc,char *argv[])
 {
+	const std::string textOfErrnoZero(strerror(0));
+
 	equals(_error->empty(), true);
 	equals(_error->PendingError(), false);
 	equals(_error->Notice("%s Notice", "A"), false);
@@ -80,7 +83,7 @@
 	equals(_error->PendingError(), true);
 	equals(_error->PopMessage(text), true);
 	equals(_error->PendingError(), false);
-	equals(text, "Something horrible happend 2 times - errno (0: Success)");
+	equals(text, std::string("Something horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 	equals(_error->empty(), true);
 
 	std::string longText;
@@ -92,7 +95,7 @@
 
 	equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happend", 2), false);
 	equals(_error->PopMessage(text), true);
-	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: Success)"));
+	equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")"));
 
 	equals(_error->Warning("Репозиторий не обновлён и будут %d %s", 4, "test"), false);
 	equals(_error->PopMessage(text), false);
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -8,6 +8,16 @@
 LDPATH="$DIR/../../build/bin"
 EXT="_libapt_test"
 
+custom_dmesg() {
+	if `which dmesg`; then
+		dmesg
+	elif [ -r /var/log/dmesg ]; then
+		cat /var/log/dmesg
+	else
+		printf ""
+	fi
+}
+
 # detect if output is on a terminal (colorful) or better not
 if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
 	COLHIGH='\033[1;35m'
@@ -68,7 +78,7 @@
 			"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
 	elif [ $name = "HashSums${EXT}" ]; then
 		TMP="$(mktemp)"
-		dmesg > $TMP
+		custom_dmesg > $TMP
 		echo -n "Testing with \033[1;35m${name}\033[0m ... "
 		LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m"
 		rm $TMP

Reply via email to