Bug 225372 - comms/hylafax: Fails to build (post-Clang 6 import) -- error: comparison between pointer and integer
Summary: comms/hylafax: Fails to build (post-Clang 6 import) -- error: comparison betw...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Kubilay Kocak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-22 06:25 UTC by O. Hartmann
Modified: 2018-10-08 08:58 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+
koobs: maintainer-feedback+
koobs: merge-quarterly+


Attachments
patch-libhylafax_FaxRecvInfo.c++ (413 bytes, text/plain)
2018-03-01 22:12 UTC, Walter Schwarzenfeld
no flags Details
Fix bad pointer comparison (413 bytes, patch)
2018-08-10 18:49 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2018-01-22 06:25:27 UTC
On CURRENT hosting poudriere (both, host and jail, running FreeBSD 12.0-CURRENT 1200056 amd64 with recent poudriere), building port comms/hylafax fails with the following error

/usr/bin/c++ -O2 -pipe  -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -Wall -L/usr/local/lib -fstack-protector -fno-strict-aliasing       -D__ANSI_CPP__ -I. -I.. -I.././libhylafax  -I.././libhylafax -I/usr/include -I/usr/local/include    -c FaxConfig.c++
c++: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
/usr/bin/c++ -O2 -pipe  -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -Wall -L/usr/local/lib -fstack-protector -fno-strict-aliasing       -D__ANSI_CPP__ -I. -I.. -I.././libhylafax  -I.././libhylafax -I/usr/include -I/usr/local/include    -c FaxRecvInfo.c++
c++: warning: argument unused during compilation: '-L/usr/local/lib' [-Wunused-command-line-argument]
In file included from FaxRecvInfo.c++:26:
In file included from ./FaxRecvInfo.h:33:
./Class2Params.h:35:1: warning: 'Class2Params' defined as a class here but previously declared as a struct [-Wmismatched-tags]
class Class2Params
^
./FaxParams.h:32:1: note: did you mean class here?
struct Class2Params;
^~~~~~
class
FaxRecvInfo.c++:115:17: error: comparison between pointer and integer ('const char *' and 'int')
    while (cp+2 != '\0') {
           ~~~~ ^  ~~~~
1 warning and 1 error generated.
*** Error code 1
Comment 1 Walter Schwarzenfeld 2018-03-01 22:12:47 UTC
Created attachment 191117 [details]
patch-libhylafax_FaxRecvInfo.c++
Comment 2 O. Hartmann 2018-04-11 11:47:41 UTC
The patch works for me. Is it going to be commited?
Comment 3 Christian Weisgerber freebsd_committer freebsd_triage 2018-04-12 14:37:23 UTC
The patch doesn't make sense.  It restores the existing behavior but there must be a bug there.  cp+2 will never be NULL (unless we wrap around the end of the address space).  At first glance  cp[2] != '\0'  might have been intended, but I don't understand the overall logic.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2018-08-10 03:23:45 UTC
Dmitry (Clang 6 guru/maintainer) may be able to shed light on the correct course of action from a C++ code point of view.
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2018-08-10 18:49:36 UTC
Created attachment 196063 [details]
Fix bad pointer comparison

Yeah, having looked at that routine, I'm of the opinion that it should be cp[2] != '\0'.  Now I am going to rinse out my eyeballs with some soap, it is a miracle that this software works at all.
Comment 6 commit-hook freebsd_committer freebsd_triage 2018-10-07 10:30:00 UTC
A commit references this bug:

Author: koobs
Date: Sun Oct  7 10:29:07 UTC 2018
New revision: 481438
URL: https://svnweb.freebsd.org/changeset/ports/481438

Log:
  comms/hylafax: Fix build with Clang 6 (and GCC7)

  Add patch from upstream HylaFAX+, fixing a Clang 6 (and GCC7) build error:

  FaxRecvInfo.c++:115:17: error: comparison between pointer and integer ('const char *' and 'int')
      while (cp+2 != '\0') {
             ~~~~ ^  ~~~~

  [1] http://bugs.hylafax.org/show_bug.cgi?id=971
  [2] https://sourceforge.net/p/hylafax/HylaFAX+/2417/
  [3] See Also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853448

  PR:		225372
  Reported by:	O. Hartmann <ohartmann walstatt org>
  Obtained from:	HylaFAX+ [2]
  MFH:		2018Q4

Changes:
  head/comms/hylafax/Makefile
  head/comms/hylafax/files/patch-libhylafax_FaxRecvInfo.c++
Comment 7 commit-hook freebsd_committer freebsd_triage 2018-10-08 08:54:58 UTC
A commit references this bug:

Author: koobs
Date: Mon Oct  8 08:53:59 UTC 2018
New revision: 481526
URL: https://svnweb.freebsd.org/changeset/ports/481526

Log:
  MFH: r481438 comms/hylafax: Fix build with Clang 6 (and GCC7)

  Add patch from upstream HylaFAX+, fixing a Clang 6 (and GCC7) build error:

  FaxRecvInfo.c++:115:17: error: comparison between pointer and integer ('const char *' and 'int')
      while (cp+2 != '\0') {
             ~~~~ ^  ~~~~

  [1] http://bugs.hylafax.org/show_bug.cgi?id=971
  [2] https://sourceforge.net/p/hylafax/HylaFAX+/2417/
  [3] See Also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=853448

  PR:		225372
  Reported by:	O. Hartmann <ohartmann walstatt org>
  Obtained from:	HylaFAX+ [2]

  Approved by:	ports-secteam (miwi)

Changes:
_U  branches/2018Q4/
  branches/2018Q4/comms/hylafax/Makefile
  branches/2018Q4/comms/hylafax/files/patch-libhylafax_FaxRecvInfo.c++
Comment 8 Kubilay Kocak freebsd_committer freebsd_triage 2018-10-08 08:58:15 UTC
Committed (using change obtained from upstream) and merged

Thank you for your help everyone, apologies for the delay.