Red Hat Bugzilla – Bug 176894
htdig fails to build in rawhide
Last modified: 2013-01-10 16:50:10 EST
Please see attached log. Build fails on x86_64
Created attachment 122748 [details]
build failure log
I can't test this right now, but I suspect the line that's causing the error in
Display.cc is this one (line 1230 after patches applied):
time_t eternity = ~(1<<(sizeof(time_t)*8-1)); // will be the largest value
holdable by a time_t
On 32-bit systems, the "1" that gets shifted is a 32-bit int, and time_t is a
32-bit "long int". But on 64-bit systems, the 1 is still 32 bits, while time_t
is a 64-bit long int. The fix would probably be to replace the "1" before the
"<<" with "((time_t)1)". Please give that a try and see if it fixes the error.
Created attachment 676555 [details]
patch to supress warning/error message about left shift count >= width of type
I was surprised to see there was still activity on this bug report. Yesterday a CC was added, so I'm assuming there's still an issue building on some 64-bit systems. The only 64 bit Linux system I have is Scientific Linux 6.3 (an RHEL 6.3 clone). There I get a warning, not an error, but it's the same expression in the code causing the problem. A well placed type cast clears up that warning. This patch hits the two files where that expression appears.
Looking at the build failure log more closely, I see I misread it the last couple times. The message about the left shift was a warning in this log too, not an error. I just zeroed in on the last message, rather than looking for the last actual error message. I see that the error was fixed by htdig-3.2.0b6-compile-fix.patch some time ago. In any case, the type casts in my patch above are still a good idea because on some 64 bit architectures you could end up with a very wrong value for "eternity" (e.g. -1) if the shift is done on a 32-bit int rather than a 64-bit one, when the target type is supposed to be 64 bits.