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

Bug 641990

Summary: net-libs/ptlib-2.10.11 - ptclib/podbc.cxx:1220:21: error: no match for ‘operator==’ (operand types are ‘PString’ and ‘char’)
Product: Gentoo Linux Reporter: Martin von Gagern <Martin.vGagern>
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: treecleaner
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 617524    
Attachments: emerge --info
Patch to call IsEmpty

Description Martin von Gagern 2017-12-22 00:17:21 UTC
Created attachment 511428 [details]
emerge --info

ptclib/podbc.cxx: In member function ‘PString PODBCRecord::GetLongData(PINDEX)’:
ptclib/podbc.cxx:1220:21: error: no match for ‘operator==’ (operand types are ‘PString’ and ‘char’)
   if (sbin.Right(1) == '\0')   // Remove Null Char
       ~~~~~~~~~~~~~~^~~~~~~
In file included from /var/tmp/portage/net-libs/ptlib-2.10.11/work/ptlib-2.10.11/include/ptlib/contain.h:624:0,
                 from /var/tmp/portage/net-libs/ptlib-2.10.11/work/ptlib-2.10.11/include/ptlib.h:56,
                 from ptclib/podbc.cxx:35:
/var/tmp/portage/net-libs/ptlib-2.10.11/work/ptlib-2.10.11/include/ptlib/pstring.h:911:10: note: candidate: bool PString:
:operator==(const char*) const <near match>
     bool operator==(
          ^~~~~~~~
/var/tmp/portage/net-libs/ptlib-2.10.11/work/ptlib-2.10.11/include/ptlib/pstring.h:911:10: note:   conversion of argument 1 would be ill-formed:
ptclib/podbc.cxx:1220:24: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   if (sbin.Right(1) == '\0')   // Remove Null Char
                        ^~~~


The offending piece of code has disappeared from the upstream codebase in https://sourceforge.net/p/opalvoip/ptlib/ci/3bb96eb030b295ad8f45e36c2ef6df5ab6
https://sourceforge.net/p/opalvoip/ptlib/ci/e7408aba626157196d3981662d0b50224f
the former of which is in master, the latter in recent tags starting at v2_12_0 from October 2012. v2_16_2 is the latest upstream tag following this pattern.

http://wiki.ekiga.org/index.php/Download_Ekiga_sources suggests that stable ekiga 4.0.x still requires ptlib 2.10 so just bumping to later versions and dropping the older ones might not be a sufficient solution.
Comment 1 Martin von Gagern 2017-12-22 00:32:36 UTC
Created attachment 511430 [details, diff]
Patch to call IsEmpty

I've tried to work out what the code actually was doing in those gcc versions where it did compile.  My assumption is that '\0' would get treated as ((const char*)null_ptr).

include/ptlib/contain.inl says PString::operator==(const char *cstr)
does an InternalCompare invocation which is implemented in
src/ptlib/common/contain.cxx. That has an explicit check for NULL, and
in that case will do an IsEmpty() check, which in turn tests for NULL
array or '\0' at beginning of array.

This the proposed fix is to call IsEmpty directly.

Together with the patch from bug 638122 comment 8 this made the package compile. Not tested at runtime, and haven't performed build time tests either.
Comment 2 Mikle Kolyada (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2018-01-26 22:57:57 UTC
Gone