NetBSD Problem Report #53777

From www@NetBSD.org  Tue Dec 11 15:01:16 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6A4C47A172
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 11 Dec 2018 15:01:16 +0000 (UTC)
Message-Id: <20181211150115.726657A21F@mollari.NetBSD.org>
Date: Tue, 11 Dec 2018 15:01:15 +0000 (UTC)
From: alexwgarvin@gmail.com
Reply-To: alexwgarvin@gmail.com
To: gnats-bugs@NetBSD.org
Subject: www/webkit24-gtk syntax errors -- fails to compile
X-Send-Pr-Version: www-1.0

>Number:         53777
>Category:       pkg
>Synopsis:       www/webkit24-gtk syntax errors -- fails to compile
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 11 15:05:01 +0000 2018
>Closed-Date:    
>Last-Modified:  Tue Dec 11 17:45:00 +0000 2018
>Originator:     Alexander Garvin
>Release:        pkgsrc-current 2018-12-11
>Organization:
>Environment:
Linux -- 4.19.5-300.fc29.x86_64 #1 SMP Tue Nov 27 19:29:23 UTC 2018 x86_64 GNU/Linux
>Description:
abs() is called three times on a "gdouble". in files:

Source/WebCore/platform/gtk/GtkClickCounter.cpp
Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp

This causes errors and the package fails to compile.

>How-To-Repeat:
cd /usr/pkgsrc/www/webkit24-gtk && bmake

>Fix:
diff -ruN Source/WebCore/platform/gtk/GtkClickCounter.cpp Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp
--- Source/WebCore/platform/gtk/GtkClickCounter.cpp	2018-12-11 14:44:31.858499388 +0000
+++ Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp	2018-12-11 14:48:18.482912538 +0000
@@ -83,9 +83,14 @@
     // GDK logic for counting clicks.
     GdkEvent* event(reinterpret_cast<GdkEvent*>(buttonEvent));
     guint32 eventTime = getEventTime(event);
+
+    int abs_bE_sub_prevCP = (buttonEvent->x - m_previousClickPoint.x()) > 0?
+      (buttonEvent->x - m_previousClickPoint.x()) :
+      -(buttonEvent->x - m_previousClickPoint.x());
+	
     if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
-	|| ((abs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance)
-	    && (abs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance)
+	|| ((abs_bE_sub_prevCP < doubleClickDistance)
+	    && (abs_bE_sub_prevCP < doubleClickDistance)
             && (eventTime - m_previousClickTime < static_cast<guint>(doubleClickTime))
             && (buttonEvent->button == m_previousClickButton)))
         m_currentClickCount++;
diff -ruN Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp
--- Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp	2018-12-11 14:41:19.074446577 +0000
+++ Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp	2018-12-11 14:48:00.441720433 +0000
@@ -659,7 +659,8 @@
     if (!std::isfinite(time))
         return String::fromUTF8(_("indefinite time"));

-    int seconds = static_cast<int>(abs(time));
+    float abs_time = time > 0? time : -(time);
+    int seconds = static_cast<int>(abs_time);
     int days = seconds / (60 * 60 * 24);
     int hours = seconds / (60 * 60);
     int minutes = (seconds / 60) % 60;

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/53777: www/webkit24-gtk syntax errors -- fails to compile
Date: Tue, 11 Dec 2018 16:07:35 +0100

 On Tue, Dec 11, 2018 at 03:05:01PM +0000, alexwgarvin@gmail.com wrote:
 > abs() is called three times on a "gdouble". in files:

 What is the error message?

 abs() is a C99 function.
  Thomas

State-Changed-From-To: open->feedback
State-Changed-By: leot@NetBSD.org
State-Changed-When: Tue, 11 Dec 2018 15:33:36 +0000
State-Changed-Why:
Feedback requested.


From: Alexander Garvin <alexwgarvin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53777: www/webkit24-gtk syntax errors -- fails to compile
Date: Tue, 11 Dec 2018 10:36:31 -0500

 in LocalizedStringsGtk.cpp:

 error: call of overloaded 'abs(float&)' is ambiguous

 int seconds = static_cast<int>(abs(time))


 same thing in GtkClickCounter.cpp, except for 'gdouble' instead of float.


State-Changed-From-To: feedback->open
State-Changed-By: leot@NetBSD.org
State-Changed-When: Tue, 11 Dec 2018 17:00:38 +0000
State-Changed-Why:
Feedback provided (avoiding abs() sounds kludgy though).


From: Alexander Garvin <alexwgarvin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53777 (www/webkit24-gtk syntax errors -- fails to compile)
Date: Tue, 11 Dec 2018 12:16:05 -0500

 I agree. Actually, changing abs -> fabs seems to work. I can add a diff 
 if that is preferred.


From: Alexander Garvin <alexwgarvin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53777 (www/webkit24-gtk syntax errors -- fails to compile)
Date: Tue, 11 Dec 2018 12:25:20 -0500

 This compiles for me, and is much cleaner:


 diff -ruN Source/WebCore/platform/gtk/GtkClickCounter.cpp 
 Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp
 --- Source/WebCore/platform/gtk/GtkClickCounter.cpp    2018-12-11 
 14:44:31.858499388 +0000
 +++ Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp 2018-12-11 
 17:20:24.793536184 +0000
 @@ -84,8 +84,8 @@
       GdkEvent* event(reinterpret_cast<GdkEvent*>(buttonEvent));
       guint32 eventTime = getEventTime(event);
       if ((event->type == GDK_2BUTTON_PRESS || event->type == 
 GDK_3BUTTON_PRESS)
 -    || ((abs(buttonEvent->x - m_previousClickPoint.x()) < 
 doubleClickDistance)
 -        && (abs(buttonEvent->y - m_previousClickPoint.y()) < 
 doubleClickDistance)
 +    || ((fabs(buttonEvent->x - m_previousClickPoint.x()) < 
 doubleClickDistance)
 +        && (fabs(buttonEvent->y - m_previousClickPoint.y()) < 
 doubleClickDistance)
               && (eventTime - m_previousClickTime < 
 static_cast<guint>(doubleClickTime))
               && (buttonEvent->button == m_previousClickButton)))
           m_currentClickCount++;
 diff -ruN Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 
 Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp
 --- Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2018-12-11 
 14:41:19.074446577 +0000
 +++ Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp 
 2018-12-11 17:20:34.322613686 +0000
 @@ -659,7 +659,7 @@
       if (!std::isfinite(time))
           return String::fromUTF8(_("indefinite time"));

 -    int seconds = static_cast<int>(abs(time));
 +    int seconds = static_cast<int>(fabs(time));
       int days = seconds / (60 * 60 * 24);
       int hours = seconds / (60 * 60);
       int minutes = (seconds / 60) % 60;

From: Alexander Garvin <alexwgarvin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53777 (www/webkit24-gtk syntax errors -- fails to compile)
Date: Tue, 11 Dec 2018 12:35:59 -0500

 Apologies for the last reply. Here is the patch:


 diff -ruN Source/WebCore/platform/gtk/GtkClickCounter.cpp 
 Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp

 --- Source/WebCore/platform/gtk/GtkClickCounter.cpp    2018-12-11 
 14:44:31.858499388 +0000
 +++ Source.patched/WebCore/platform/gtk/GtkClickCounter.cpp 2018-12-11 
 17:20:24.793536184 +0000
 @@ -84,8 +84,8 @@
       GdkEvent* event(reinterpret_cast<GdkEvent*>(buttonEvent));
       guint32 eventTime = getEventTime(event);
       if ((event->type == GDK_2BUTTON_PRESS || event->type == 
 GDK_3BUTTON_PRESS)
 -    || ((abs(buttonEvent->x - m_previousClickPoint.x()) < 
 doubleClickDistance)
 -        && (abs(buttonEvent->y - m_previousClickPoint.y()) < 
 doubleClickDistance)
 +    || ((fabs(buttonEvent->x - m_previousClickPoint.x()) < 
 doubleClickDistance)
 +        && (fabs(buttonEvent->y - m_previousClickPoint.y()) < 
 doubleClickDistance)
               && (eventTime - m_previousClickTime < 
 static_cast<guint>(doubleClickTime))
               && (buttonEvent->button == m_previousClickButton)))
           m_currentClickCount++;
 diff -ruN Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 
 Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp
 --- Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2018-12-11 
 14:41:19.074446577 +0000
 +++ Source.patched/WebCore/platform/gtk/LocalizedStringsGtk.cpp 
 2018-12-11 17:20:34.322613686 +0000
 @@ -659,7 +659,7 @@
       if (!std::isfinite(time))
           return String::fromUTF8(_("indefinite time"));

 -    int seconds = static_cast<int>(abs(time));
 +    int seconds = static_cast<int>(fabs(time));
       int days = seconds / (60 * 60 * 24);
       int hours = seconds / (60 * 60);
       int minutes = (seconds / 60) % 60;

From: Alexander Garvin <alexwgarvin@gmail.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53777 (www/webkit24-gtk syntax errors -- fails to compile)
Date: Tue, 11 Dec 2018 12:44:27 -0500

 Alright, I'm not sure what is going on with my email client, I 
 definitely sent that last one as plaintext.

 Anyway, the change is just abs->fabs on:

 GtkClickCounter.cpp lines 87 and 88, and

 LocalizedStringsGtk.cpp line 662


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.