Source: abyss
Version: 1.5.2-1
Severity: normal
Tags: patch

Hi maintainer

Version 1.5.2-1 of abyss FTBFS on 32-bit architectures (armhf, i386 and powerpc) in Ubuntu [1].
Previous versions built fine on all architectures.

I found there were a couple of places in the code that was introduced in version 1.5.2 where size_t data type was used instead of a fixed size data type. I was able to get abyss 1.5.2-1 to build on amd64, i386 and armhf with the attached patch in place and all unit tests passed.
I have no idea where to begin actually testing abyss itself.

Is it worth me uploading abyss with this patch into Ubuntu?
This will at least allow version 1.5.2-1 to migrate from proposed to release. Alternatively, is this software useful on a 32-bit system? The other solution is for me to disable building for these architectures.

Regards
Graham

[1] https://launchpad.net/ubuntu/+source/abyss/1.5.2-1

--- a/Common/StringUtil.h
+++ b/Common/StringUtil.h
@@ -106,7 +106,7 @@
 	return false;
 }
 
-static inline size_t SIToBytes(std::istringstream& iss)
+static inline unsigned long long SIToBytes(std::istringstream& iss)
 {
 	double size;
 	std::string units;
@@ -122,7 +122,7 @@
 		// no units given; clear fail flag
 		// and assume bytes
 		iss.clear(std::ios::eofbit);
-		return (size_t)ceil(size);
+		return (unsigned long long)ceil(size);
 	}
 
 	if (units.size() > 1) {
@@ -133,22 +133,22 @@
 
 	switch(tolower(units[0])) {
 		case 'k':
-			size *= (size_t)1<<10; break;
+			size *= (unsigned long long)1<<10; break;
 		case 'm':
-			size *= (size_t)1<<20; break;
+			size *= (unsigned long long)1<<20; break;
 		case 'g':
-			size *= (size_t)1<<30; break;
+			size *= (unsigned long long)1<<30; break;
 		case 't':
-			size *= (size_t)1<<40; break;
+			size *= (unsigned long long)1<<40; break;
 		default:
 			iss.setstate(std::ios::failbit);
 			return 0;
 	}
 
-	return (size_t)ceil(size);
+	return (unsigned long long)ceil(size);
 }
 
-static inline size_t SIToBytes(const std::string& str)
+static inline unsigned long long SIToBytes(const std::string& str)
 {
 	std::istringstream iss(str);
 	return SIToBytes(iss);
--- a/Bloom/Bloom.h
+++ b/Bloom/Bloom.h
@@ -165,10 +165,10 @@
 		// bloom filter bits
 
 		size_t bits = endBitPos - startBitPos + 1;
-		size_t bytes = (bits + 7) / 8;
+		unsigned long bytes = (bits + 7) / 8;
 		char buf[IO_BUFFER_SIZE];
 		for (size_t i = 0, j = 0; i < bytes;) {
-			size_t writeSize = std::min(IO_BUFFER_SIZE, bytes - i);
+			unsigned long writeSize = std::min(IO_BUFFER_SIZE, bytes - i);
 			for (size_t k = 0; k < writeSize; k++) {
 				buf[k] = 0;
 				for (unsigned l = 0; l < 8; l++, j++) {
@@ -270,11 +270,11 @@
 
 		size_t offset = header.startBitPos;
 		size_t bits = header.endBitPos - header.startBitPos + 1;
-		size_t bytes = (bits + 7) / 8;
+		unsigned long bytes = (bits + 7) / 8;
 
 		char buf[IO_BUFFER_SIZE];
 		for (size_t i = 0, j = offset; i < bytes; ) {
-			size_t readSize = std::min(IO_BUFFER_SIZE, bytes - i);
+			unsigned long readSize = std::min(IO_BUFFER_SIZE, bytes - i);
 			in.read(buf, readSize);
 			assert(in);
 			for (size_t k = 0; k < readSize; k++) {

Reply via email to