Bug 1308204 - uhd: FTBFS in rawhide
uhd: FTBFS in rawhide
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: uhd (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
:
: 1352168 1352298 (view as bug list)
Depends On:
Blocks: F24FTBFS
  Show dependency treegraph
 
Reported: 2016-02-13 17:37 EST by Fedora Release Engineering
Modified: 2016-07-05 01:01 EDT (History)
4 users (show)

See Also:
Fixed In Version: uhd-3.9.4-2.fc24
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-05 01:01:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
build.log (514.06 KB, text/plain)
2016-02-13 17:37 EST, Fedora Release Engineering
no flags Details
root.log (107.54 KB, text/plain)
2016-02-13 17:37 EST, Fedora Release Engineering
no flags Details
state.log (609 bytes, text/plain)
2016-02-13 17:37 EST, Fedora Release Engineering
no flags Details

  None (edit)
Description Fedora Release Engineering 2016-02-13 17:37:39 EST
Your package uhd failed to build from source in current rawhide.

http://koji.fedoraproject.org/koji/taskinfo?taskID=12875584

For details on mass rebuild see https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
Comment 1 Fedora Release Engineering 2016-02-13 17:37:41 EST
Created attachment 1126670 [details]
build.log
Comment 2 Fedora Release Engineering 2016-02-13 17:37:43 EST
Created attachment 1126672 [details]
root.log
Comment 3 Fedora Release Engineering 2016-02-13 17:37:44 EST
Created attachment 1126673 [details]
state.log
Comment 4 Jan Kurik 2016-02-24 10:17:36 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 5 Jonathan Wakely 2016-05-24 08:34:42 EDT
This blocks gqrx from being rebuilt in F24.

The errors are:

/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c: In function 'int base64_decode_value(char)':
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
     static const char decoding[] = {62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-2,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51};
                                                                                                                                                                                                                                                                          ^
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-2' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
/builddir/build/BUILD/uhd-release_003_008_002/host/utils/cdecode.c:11:266: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]

I was surprised that code ever worked on ARM, and in fact it looks like it doesn't:

https://sourceforge.net/p/libb64/bugs/1/
Comment 6 Jonathan Wakely 2016-05-24 09:08:26 EDT
Also https://sourceforge.net/p/libb64/bugs/2/ deals with the same bug, but misses another one. I've attached an improved patch there.
Comment 7 Jaroslav Škarvada 2016-05-24 09:16:08 EDT
I think it's clear to me how to fix it (IIRC I fixed this gcc speciality in few other packages), but I am too lazy to patch it :) I will probably rebase the uhd package as I have already done in rawhide.
Comment 8 Jonathan Wakely 2016-05-24 09:40:18 EDT
Simply casting the literals to char won't fix it, the code is broken and doesn't work correctly (even on x86, see my comment at https://sourceforge.net/p/libb64/bugs/2/ about the off-by-one error).
Comment 9 Jaroslav Škarvada 2016-05-24 10:28:48 EDT
Thanks for info, it seems upstream workaround it the following way [1]:

- they switched from c++ to c, because it's C code,  so the C++11 requirements doesn't apply
- they used explicit conversion the following way:

if ((signed char)value_in < 0 || value_in > decoding_size) return -1;

It seems to compile and work (maybe it relies on gcc behaviour - I am not good at C standards).

[1] https://github.com/EttusResearch/uhd/blob/master/host/lib/usrp/x300/cdecode.c
Comment 10 Jonathan Wakely 2016-05-24 12:36:49 EDT
"It compiles" doesn't mean it's not still horribly broken.

For a start, as I've already said, that line you quoted has an off-by-one error. If value_in == decoding_size then it accesses off the end of the array.
Comment 11 Jonathan Wakely 2016-05-24 13:13:35 EDT
Also, for signed char, if value_in is -128 then this subtraction:

 value_in -= 43;

at https://github.com/EttusResearch/uhd/blob/master/host/lib/usrp/x300/cdecode.c#L13 will underflow, with undefined behaviour.

And when char is unsigned this cast has implementation-defined behaviour (so it works with GCC, but could produce the wrong result and/or raise a signal with other compilers):

                } while ((signed char)fragment < 0);

The code stinks.
Comment 12 Jaroslav Škarvada 2016-05-25 05:41:25 EDT
Right, it relies on undefined gcc behavior, but there is still off by one error. I will patch it downstream. Are you going to pull request your patch to uhd upstream?
Comment 13 Jonathan Wakely 2016-05-25 05:59:24 EDT
Yes, will do.
Comment 14 Jaroslav Škarvada 2016-05-25 06:01:38 EDT
Thanks.
Comment 15 Jaroslav Škarvada 2016-05-25 08:46:48 EDT
Applying https://github.com/EttusResearch/uhd/pull/60 downstream.
Comment 16 Fedora Update System 2016-05-25 11:34:04 EDT
uhd-3.9.4-2.fc24 gr-osmosdr-0.1.3-19.20141023git42c66fdd.fc24 gnuradio-3.7.9.1-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-22f4609f86
Comment 17 Fedora Update System 2016-05-26 01:01:31 EDT
gnuradio-3.7.9.1-4.fc24, gr-osmosdr-0.1.3-19.20141023git42c66fdd.fc24, uhd-3.9.4-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-22f4609f86
Comment 18 Jonathan Wakely 2016-07-03 13:21:54 EDT
*** Bug 1352168 has been marked as a duplicate of this bug. ***
Comment 19 Jaroslav Škarvada 2016-07-04 06:16:48 EDT
*** Bug 1352298 has been marked as a duplicate of this bug. ***
Comment 20 Fedora Update System 2016-07-05 01:01:16 EDT
gnuradio-3.7.9.1-4.fc24, gr-osmosdr-0.1.3-19.20141023git42c66fdd.fc24, uhd-3.9.4-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.