Bug 1417336

Summary: urg: FTBFS in rawhide
Product: [Fedora] Fedora Reporter: Jonathan Wakely <jwakely>
Component: urgAssignee: Tim Niemueller <tim>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: daniel, tim
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-03 09:14:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
log of failed build none

Description Jonathan Wakely 2017-01-28 02:00:07 UTC
Created attachment 1245299 [details]
log of failed build

This package fails to build on targets where char is unsigned, and has other portability problems.

/bin/sh ../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../include/cpp  -I../../../src/cpp/system -I../../../src/cpp/common -I../../../src/cpp/connection -I../../../src/cpp/geometry -I../../../src/cpp/coordinate -I../../../src/cpp/urg -I../../../src/cpp/connection/sdl -I../../../src/cpp/monitor   -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c -o UrgCtrl.lo UrgCtrl.cpp
ScipHandler.cpp:254:71: warning: overflow in implicit constant conversion [-Woverflow]
   int substr2int(const string& line, int from_n, int length = string::npos)
                                                                       ^~~~
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::pImpl::connect(const char*, long int)':
ScipHandler.cpp:123:45: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
       char qt_expected_response[] = { 0, -1 };
                                             ^
ScipHandler.cpp:142:51: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
         char scip20_expected_response[] = { 0, -1 };
                                                   ^
ScipHandler.cpp:153:48: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
         char tm2_expected_response[] = { 0, -1 };
                                                ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::pImpl::changeBaudrate(long int)':
ScipHandler.cpp:205:58: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
     char ss_expected_response[] = { 0, 0x3, 0x4, 0xf, -1 };
                                                          ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::pImpl::loadParameter(qrk::RangeSensorParameter&)':
ScipHandler.cpp:219:43: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
     char pp_expected_response[] = { 0, -1 };
                                           ^
ScipHandler.cpp:242:78: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.distance_min = substr2int(lines[RangeSensorParameter::DMIN], 5);
                                                                              ^
ScipHandler.cpp:243:78: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.distance_max = substr2int(lines[RangeSensorParameter::DMAX], 5);
                                                                              ^
ScipHandler.cpp:244:76: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.area_total = substr2int(lines[RangeSensorParameter::ARES], 5);
                                                                            ^
ScipHandler.cpp:245:74: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.area_min = substr2int(lines[RangeSensorParameter::AMIN], 5);
                                                                          ^
ScipHandler.cpp:246:74: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.area_max = substr2int(lines[RangeSensorParameter::AMAX], 5);
                                                                          ^
ScipHandler.cpp:247:76: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.area_front = substr2int(lines[RangeSensorParameter::AFRT], 5);
                                                                            ^
ScipHandler.cpp:248:74: warning: overflow in implicit constant conversion [-Woverflow]
     parameters.scan_rpm = substr2int(lines[RangeSensorParameter::SCAN], 5);
                                                                          ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::pImpl::setLaserOutput(bool, bool)':
ScipHandler.cpp:359:42: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
       char expected_response[] = { 0, -1 };
                                          ^
ScipHandler.cpp:372:47: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
         char qt_expected_response[] = { 0, -1 };
                                               ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::versionLines(std::vector<std::__cxx11::basic_string<char> >&)':
ScipHandler.cpp:780:38: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
   char expected_response[] = { 0, -1 };
                                      ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::setRawTimestampMode(bool)':
ScipHandler.cpp:795:38: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
   char expected_response[] = { 0, -1 };
                                      ^
ScipHandler.cpp: In member function 'bool qrk::ScipHandler::rawTimestamp(int*)':
ScipHandler.cpp:812:38: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing]
   char expected_response[] = { 0, -1 };
                                      ^


The overflow can be fixed by changing the parameter from into to size_t.

The narrowing conversions can be fixed by adding a cast: (char)-1
But I don't know if the resulting code will actually work on ARM targets or if that just hides the error.

Maybe the package should use ExcludeArch: armv7hl aarch64

Comment 1 Fedora End Of Life 2017-02-28 11:06:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Daniel Black 2017-12-18 00:24:34 UTC
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf 6.2.5(3) 

"If any other character is stored in a char object, the resulting value is implementation-defined"

Correct solution is to used "signed char" for whenever implementations rely on -ve values. This is going to solve all architecture bugs on this sort of failure.

Comment 3 Fedora End Of Life 2018-05-03 08:06:32 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 4 Jonathan Wakely 2018-05-03 08:48:41 UTC
(In reply to Daniel Black from comment #2)
> http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf 6.2.5(3) 
> 
> "If any other character is stored in a char object, the resulting value is
> implementation-defined"
> 
> Correct solution is to used "signed char" for whenever implementations rely
> on -ve values. This is going to solve all architecture bugs on this sort of
> failure.

This is C++ not C, and you can't store signed char in a std::string, so it's not that simple, certainly not for all bugs of this sort. There's no problem storing (char)-1 because the value is well-defined by the implementation (GCC) even when char is unsigned. The error is simply due to the form of initializer used.

Comment 5 Jonathan Wakely 2018-05-03 09:14:18 UTC
The build failure has been addressed in urg-0.8.18-20.fc28