Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 569344 - app-cdr/cdrdao-1.2.3-r2 - CdrDriver.cc:498:64: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
Summary: app-cdr/cdrdao-1.2.3-r2 - CdrDriver.cc:498:64: error: narrowing conversion of...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: optical media herd
URL:
Whiteboard:
Keywords:
: 569488 569782 (view as bug list)
Depends on:
Blocks: gcc-5
  Show dependency tree
 
Reported: 2015-12-23 14:47 UTC by Ben Kohler
Modified: 2016-01-11 02:33 UTC (History)
24 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,28.26 KB, text/plain)
2015-12-23 14:47 UTC, Ben Kohler
Details
cdrdao-1.2.3-gcc5.patch from mageia (cdrdao-1.2.3-gcc5.patch,1.08 KB, patch)
2015-12-23 16:03 UTC, Ben Kohler
Details | Diff
cdrdao-1.2.3-gcc5.patch based on comment #8 (cdrdao-1.2.3-gcc5-fix.patch,1.41 KB, patch)
2015-12-26 15:15 UTC, Ben Kohler
Details | Diff
cdrdao-1.2.3-gcc5.patch based on comment #14 (cdrdao-1.2.3-gcc5.patch,1.50 KB, patch)
2016-01-05 19:42 UTC, qbt937
Details | Diff
Working patch (cdrdao-1.2.3-gcc5.3.patch,765 bytes, patch)
2016-01-07 22:48 UTC, hexum
Details | Diff
Working ebuild (cdrdao-1.2.3-r3.ebuild,1.38 KB, text/plain)
2016-01-07 22:49 UTC, hexum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Kohler gentoo-dev 2015-12-23 14:47:40 UTC
Created attachment 420516 [details]
build.log

With gcc-5, our only version of cdrdao doesn't build.  Some other similar bugs suggest this should be fixed in upstream, instead of the relatively ugly workaround of appending -Wno-narrowing to CXXFLAGS.

FWIW, upstream seems pretty well dead, and arch is simply appending -Wno-narrowing:
https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/cdrdao&id=4af207789e80bab315b72f901ad5653a1050145d

I tried to find what fixes other major distros are using but I'm coming up dry.
Comment 1 Ben Kohler gentoo-dev 2015-12-23 15:50:04 UTC
Mageia seems to have a patch that addresses the root of the issue, rather than ignoring it:

http://sophie.zarb.org/sources/cdrdao/cdrdao-1.2.3-gcc5.patch
Comment 2 Ben Kohler gentoo-dev 2015-12-23 15:50:35 UTC
*** Bug 569488 has been marked as a duplicate of this bug. ***
Comment 3 Ben Kohler gentoo-dev 2015-12-23 16:03:30 UTC
Created attachment 420574 [details, diff]
cdrdao-1.2.3-gcc5.patch from mageia

BTW I have tested this patch and it does fix the build problem on gcc-5.3.0.

I have attached the patch for good measure, and here's a direct link to cleaner raw patch @ mageia:

http://svnweb.mageia.org/packages/cauldron/cdrdao/current/SOURCES/cdrdao-1.2.3-gcc5.patch?revision=871727&view=co
Comment 4 Duncan 2015-12-24 08:48:49 UTC
Ben, can you please edit the summary to reflect the correct app-cdr category?  I don't know where media-libs came from, but media-libs/cdrdao isn't found in my copy of the gentoo git tree, at least, updated about an hour ago, while app-cdr/cdrdao shows up in the initial commit converting from the cvs tree, so it has been app-cdr at least since then, and google seems to have no results for "media-libs/cdrdao" (with the quotes), either.  (Apparently google hasn't seen this bug with its current name yet.)
Comment 5 Ben Kohler gentoo-dev 2015-12-24 13:23:35 UTC
Fixed, thanks, that'll help others find the bug more easily.  Not sure where I got media-libs from.
Comment 6 Guy 2015-12-25 21:09:44 UTC
Patch worked for me under gcc-5.3.0
Comment 7 Ben Kohler gentoo-dev 2015-12-26 13:32:05 UTC
*** Bug 569782 has been marked as a duplicate of this bug. ***
Comment 8 Anthony Basile gentoo-dev 2015-12-26 14:56:34 UTC
(In reply to Ben Kohler from comment #3)
> Created attachment 420574 [details, diff] [details, diff]
> cdrdao-1.2.3-gcc5.patch from mageia
> 
> BTW I have tested this patch and it does fix the build problem on gcc-5.3.0.
> 
> I have attached the patch for good measure, and here's a direct link to
> cleaner raw patch @ mageia:
> 
> http://svnweb.mageia.org/packages/cauldron/cdrdao/current/SOURCES/cdrdao-1.2.
> 3-gcc5.patch?revision=871727&view=co

I wonder if a better approach might not be to declare these as unsigned chars instead of doing char(0xff).  The problme is that 0xff is outside of a signed char and gcc-5 is balking at that.

Ben, can you try

-char CdrDriver::REMOTE_MSG_SYNC_[4] = { 0xff, 0x00, 0xff, 0x00 };
+unsigned char CdrDriver::REMOTE_MSG_SYNC_[4] = { 0xff, 0x00, 0xff, 0x00 };

and

-  static char msgSync[4] = { 0xff, 0x00, 0xff, 0x00 };
+  unsigned static char msgSync[4] = { 0xff, 0x00, 0xff, 0x00 };
Comment 9 Ben Kohler gentoo-dev 2015-12-26 15:15:37 UTC
Created attachment 420880 [details, diff]
cdrdao-1.2.3-gcc5.patch based on comment #8

Adjusted patch based on your suggestion.  Tested build on gcc 4.9.3 & gcc-5.3.0.
Comment 10 Geoff Madden 2015-12-27 05:22:23 UTC
(In reply to Ben Kohler from comment #9)
> Created attachment 420880 [details, diff] [details, diff]
> cdrdao-1.2.3-gcc5.patch based on comment #8
> 
> Adjusted patch based on your suggestion.  Tested build on gcc 4.9.3 &
> gcc-5.3.0.

I'm, getting the same fault in cdrdriver.cc with the patch applied
Comment 11 Geoff Madden 2015-12-27 05:26:42 UTC
c
CdrDriver.cc:498:64: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
 char CdrDriver::REMOTE_MSG_SYNC_[4] = { 0xff, 0x00, 0xff, 0x00 };
                                                                ^
CdrDriver.cc:498:64: error: narrowing conversion of ‘255’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../trackdb -I./../paranoia    -DDRIVER_TABLE_FILE=\"/usr/share/cdrdao/drivers\" -O2 -march=athlon64 -pipe -std=c++11 -c -o CDD2600Base.o CDD2600Ba

As in comment 10 this's the failure point
Comment 12 Geoff Madden 2015-12-27 06:37:26 UTC
(In reply to Geoff Madden from comment #11)
> c
> CdrDriver.cc:498:64: error: narrowing conversion of ‘255’ from ‘int’ to
> ‘char’ inside { } [-Wnarrowing]
>  char CdrDriver::REMOTE_MSG_SYNC_[4] = { 0xff, 0x00, 0xff, 0x00 };
>                                                                 ^
> CdrDriver.cc:498:64: error: narrowing conversion of ‘255’ from ‘int’ to
> ‘char’ inside { } [-Wnarrowing]
> x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I.. -I./../trackdb
> -I./../paranoia    -DDRIVER_TABLE_FILE=\"/usr/share/cdrdao/drivers\" -O2
> -march=athlon64 -pipe -std=c++11 -c -o CDD2600Base.o CDD2600Ba
> 
> As in comment 10 this's the failure point

ignore this rant I screwed up the ebuild,corrected my bad and alls well
Comment 13 Juergen Rose 2015-12-27 12:41:33 UTC
(In reply to Ben Kohler from comment #9)
> Created attachment 420880 [details, diff] [details, diff]
> cdrdao-1.2.3-gcc5.patch based on comment #8
> 
> Adjusted patch based on your suggestion.  Tested build on gcc 4.9.3 &
> gcc-5.3.0.

The patch worked here with gcc-5.3.0. But I got the warning:

 * QA Notice: This package installs one or more .desktop files that do not
 * pass validation.
 * 
 *      /usr/share/applications/gcdmaster.desktop: error: (will be fatal in the future): value "gcdmaster.png" for key "Icon" in group "Desktop Entry" is an icon name with an extension, but there should be no extension as described in the Icon Theme Specification if the value is not an absolute path
 *      /usr/share/applications/gcdmaster.desktop: warning: value "GNOME;AudioVideo;Application;X-Fedora;" for key "Categories" in group "Desktop Entry" contains a deprecated value "Application"
 * 

Maybe this could be fixed too.
Comment 14 qbt937 2015-12-28 19:49:35 UTC
Has anyone tested CdDevice::updateProgress after the patch? I don't think that the patch from comment #9 will work (it will build, but I think it will fail at runtime). An element of msgSync is compared with buf[0] on lines 286 and 292. Both msgSync[state] and buf[0] will be promoted to int before comparison, and (int) 255 != (int) -1. There won't be any value of buf[0] that compares equal to 255, as buf[0] is a signed char (-128 to 127). Maybe it would work to make buf into an unsigned char array or just leave msgSync as a signed char array, but they need to be the same type of char. I haven't checked the REMOTE_MSG_SYNC_ change yet.
Comment 15 John Bowler 2015-12-29 20:40:49 UTC
The xdao code doesn't seem to be compiled, if it was the declaration of 'char buf[10] on line 261 of CdDevice.cc would, indeed, have to be changed to unsigned char as well.

The patch for REMOTE_MSG_SYNC_ seems safe because it is only used as an argument to a function (apparently write(2))

Deleting the xdao part of the patch from comment #8 results in a successful build (as, of couse, does the original.)
Comment 16 Alex Barker 2016-01-01 19:44:26 UTC
I am hard masking this, it's been broken in the tree for over a week.  Please version bump when this is fixed.
Comment 17 Ben Kohler gentoo-dev 2016-01-05 14:56:53 UTC
I'm not able to reproduce the problems mentioned with this new patch but I'm only using cdrdao so far as k3b uses it.  If those problems are reproducible, I'd say we should use the original patch as provided by Manjaro.
Comment 18 qbt937 2016-01-05 19:42:48 UTC
Created attachment 422038 [details, diff]
cdrdao-1.2.3-gcc5.patch based on comment #14

It looks like xdao will be compiled if you have the gcdmaster use flag enabled. If you don't then the comment #9 patch won't be a problem. Unfortunately I don't have cdrdao with gcdmaster installed and so I can't test the patch. I think the bug will make gcdmaster freeze when any CD read or write operation is started. The read/write might continue, but the progress bar won't update and gcdmaster will hang.

I have attached a patch that will make buf[10] unsigned as well. I recommend that you either use this patch, the mageia patch, or permanently disable the gcdmaster use flag and use the patch from comment #9. I only mention the last option because it sounds like almost nobody uses gcdmaster anymore. If this is not the case then could someone please test it? I don't have the time to install all of the dependencies of gcdmaster right now.
Comment 19 hexum 2016-01-07 22:48:24 UTC
Created attachment 422254 [details, diff]
Working patch

Just replace integer literals with c-char literals.
Comment 20 hexum 2016-01-07 22:49:36 UTC
Created attachment 422256 [details]
Working ebuild

Uses cdrdao-1.2.3-gcc5.3.patch patch
Comment 21 hexum 2016-01-07 22:51:46 UTC
I've filed bug to upstream, but project seems to be dead.
https://sourceforge.net/p/cdrdao/patches/26/