Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 786498

Summary: x11-misc/slim-1.3.6-r5 - /.../panel.cpp: error: ordered comparison of pointer with integer zero (GC {aka _XGC*} and int)
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: normal CC: martin, xavier.miller
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 732706    
Attachments: emerge-info.txt
emerge-history.txt
environment
etc.portage.tar.bz2
logs.tar.bz2
temp.tar.bz2
x11-misc:slim-1.3.6-r5:20210428-153705.log
Patch to fix signed comparison with nullptr

Description Toralf Förster gentoo-dev 2021-04-28 15:54:18 UTC
/var/tmp/portage/x11-misc/slim-1.3.6-r5/work/slim-1.3.6/panel.cpp: In constructor ‘Panel::Panel(Display*, int, Window, Cfg*, const string&, Panel::PanelType)’:
/var/tmp/portage/x11-misc/slim-1.3.6-r5/work/slim-1.3.6/panel.cpp:51:27: error: ordered comparison of pointer with integer zero (‘GC’ {aka ‘_XGC*’} and ‘int’)
   51 |                 if (WinGC < 0) {
      |                     ~~~~~~^~~
/var/tmp/portage/x11-misc/slim-1.3.6-r5/work/slim-1.3.6/panel.cpp: In member function ‘bool Panel::OnKeyPress(XEvent&)’:
/var/tmp/portage/x11-misc/slim-1.3.6-r5/work/slim-1.3.6/panel.cpp:549:31: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_no-multilib_hardened-20210427-181545

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-10.3.0
 [2] x86_64-pc-linux-gnu-11.1.0 *
clang version 12.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/12/bin
/usr/lib/llvm/12
12.0.0
Python 3.8.9
Available Ruby profiles:
  [1]   ruby26 (with Rubygems)
  [2]   ruby30 (with Rubygems) *
Available Rust versions:
  [1]   rust-bin-1.51.0 *
The following VMs are available for generation-2:
*)	AdoptOpenJDK 8.292_p10 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8  system-vm


  timestamp(s) of HEAD at this tinderbox image:
/var/db/repos/gentoo	Wed Apr 28 15:20:17 UTC 2021

emerge -qpvO x11-misc/slim
[ebuild  N    ] x11-misc/slim-1.3.6-r5  USE="pam -branding"
Comment 1 Toralf Förster gentoo-dev 2021-04-28 15:54:19 UTC
Created attachment 703335 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2021-04-28 15:54:20 UTC
Created attachment 703338 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2021-04-28 15:54:22 UTC
Created attachment 703341 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2021-04-28 15:54:23 UTC
Created attachment 703344 [details]
etc.portage.tar.bz2
Comment 5 Toralf Förster gentoo-dev 2021-04-28 15:54:24 UTC
Created attachment 703347 [details]
logs.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2021-04-28 15:54:25 UTC
Created attachment 703350 [details]
temp.tar.bz2
Comment 7 Toralf Förster gentoo-dev 2021-04-28 15:54:26 UTC
Created attachment 703353 [details]
x11-misc:slim-1.3.6-r5:20210428-153705.log
Comment 8 Martin Väth 2021-05-03 17:28:59 UTC
Created attachment 705765 [details, diff]
Patch to fix signed comparison with nullptr
Comment 9 Martin Väth 2021-05-03 17:35:13 UTC
Comment to the patch, since it might look wrong at a first glance:

All documentation about the return value of XCreateGC I found states that it returns a proper pointer and in the error case sets some failure stat. In particular, I found no documentation that it returns a "negative" pointer.

The cleanest patch would probably be to check the failure stat, but since I am not sure about it, the most reasonable analogous check to the original code is to check whether we get a null pointer returned. (Very likely, neither the original code nor the patch work properly in the error case, but at least the patch fixes the compilation issue and causes no regression in the non-error case.)
Comment 10 Adrian Bassett 2021-05-05 10:30:43 UTC
(In reply to Martin Väth from comment #9)
> Comment to the patch, since it might look wrong at a first glance:
> 
> All documentation about the return value of XCreateGC I found states that it
> returns a proper pointer and in the error case sets some failure stat. In
> particular, I found no documentation that it returns a "negative" pointer.
> 
> The cleanest patch would probably be to check the failure stat, but since I
> am not sure about it, the most reasonable analogous check to the original
> code is to check whether we get a null pointer returned. (Very likely,
> neither the original code nor the patch work properly in the error case, but
> at least the patch fixes the compilation issue and causes no regression in
> the non-error case.)

Can confirm that the patch fixes building with gcc-11.1.0, thanks.
Comment 11 Larry the Git Cow gentoo-dev 2021-07-25 23:23:44 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ab287d52bf8f597b107156a07e70a6348fecfbd

commit 1ab287d52bf8f597b107156a07e70a6348fecfbd
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-07-25 23:10:55 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-07-25 23:23:34 +0000

    x11-misc/slim: EAPI 7, cmake-utils--, fix build with GCC 11
    
    Closes: https://bugs.gentoo.org/786498
    Signed-off-by: Sam James <sam@gentoo.org>

 x11-misc/slim/files/slim-1.3.6-config.diff         |  4 +--
 x11-misc/slim/files/slim-1.3.6-freetype.patch      |  4 +--
 x11-misc/slim/files/slim-1.3.6-gcc11.patch         | 12 +++++++
 x11-misc/slim/files/slim-1.3.6-honour-cflags.patch |  4 +--
 .../slim-1.3.6-strip-systemd-unit-install.patch    |  4 +--
 x11-misc/slim/slim-1.3.6-r5.ebuild                 | 31 +++++++++-------
 x11-misc/slim/slim-9999.ebuild                     | 42 +++++++++++-----------
 7 files changed, 59 insertions(+), 42 deletions(-)