| Message ID | 1518788739-16610-1-git-send-email-steffan.karger@fox-it.com |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.57]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id uzzDLrS4iVoEbgAAIUCqbw for <patchwork@openvpn.net>; Sun, 18 Feb 2018 12:32:36 -0500 Received: from proxy13.mail.iad3a.rsapps.net ([172.27.255.57]) by director11.mail.ord1d.rsapps.net (Dovecot) with LMTP id +S5zIrS4iVp3dQAAvGGmqA ; Sun, 18 Feb 2018 12:32:36 -0500 Received: from smtp42.gate.iad3a ([172.27.255.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy13.mail.iad3a.rsapps.net (Dovecot) with LMTP id +jGDJbS4iVrZIQAAwhxzoA ; Sun, 18 Feb 2018 12:32:36 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp42.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=fox-it.com X-Classification-ID: b547c054-14d1-11e8-82ca-782bcb4244d8-1-1 Received: from [216.105.38.7] ([216.105.38.7:5709] helo=lists.sourceforge.net) by smtp42.gate.iad3a.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 01/93-05386-4B8B98A5; Sun, 18 Feb 2018 12:32:36 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.89) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1enSoT-0009L7-R9; Sun, 18 Feb 2018 17:31:45 +0000 Received: from siteops-lb-1.v20.lw.sourceforge.com ([172.30.20.11] helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from <steffan.karger@fox-it.com>) id 1emgL5-0008Ir-2j for openvpn-devel@lists.sourceforge.net; Fri, 16 Feb 2018 13:46:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject: CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QKTLEZbZQblLi/v6tlUV8sOKMr3wG/6S6koeeYkcmcg=; b=KGycg9P4Z4Fcma2ytP7zSi4dVh befczm82LZ9nsAs7og+Hgr6PTbE6EVoIDEy9+vgpdIxWxa574aPFQLpfwThruW033W4pEVyMtSw7U yGXAY+DnTDcIlCVCbIGJU+QjWbBmWiBE6pxWgLIH7by2/ZU9Wxdn9sdJ2n8REr8bydcY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=QKTLEZbZQblLi/v6tlUV8sOKMr3wG/6S6koeeYkcmcg=; b=Y Dx8jvRkQjmhokpewEzc4qqqsSn3aVNOsvjH7wcG94jeg3IsG39dipZDn0BwE27upiF8G2curmo/kQ aCmvy0p21dm1ealInaFsg148sroUzgaQ9bpU7Myk/kGZIauvS/q5RhKrsX95diGz1OG2dtEJEyeBE xO48sWychM4r9T8Y=; Received: from [172.30.20.11] (helo=ns2.fox-it.com) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1:ECDHE-RSA-AES256-SHA:256) (Exim 4.89) id 1emgL4-0003ge-Qt for openvpn-devel@lists.sourceforge.net; Fri, 16 Feb 2018 13:46:11 +0000 Received: from FOXDFT52.FOX.local (unknown [10.0.0.129]) by ns2.fox-it.com (Postfix) with ESMTPS id 75C2B1AF8C0 for <openvpn-devel@lists.sourceforge.net>; Fri, 16 Feb 2018 14:46:09 +0100 (CET) Received: from steffan-fox.fox.local (10.0.3.178) by FOXDFT52.FOX.local (10.0.0.129) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Fri, 16 Feb 2018 14:46:09 +0100 From: Steffan Karger <steffan.karger@fox-it.com> To: <openvpn-devel@lists.sourceforge.net> Date: Fri, 16 Feb 2018 14:45:39 +0100 Message-ID: <1518788739-16610-1-git-send-email-steffan.karger@fox-it.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-ClientProxiedBy: FOXDFT52.FOX.local (10.0.0.129) To FOXDFT52.FOX.local (10.0.0.129) Subject: [Openvpn-devel] [PATCH] Fix format errors when cross-compiling for Windows X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Fix format errors when cross-compiling for Windows
|
|
Commit Message
Steffan Karger
Feb. 16, 2018, 2:45 a.m. UTC
Not all supported windows formatting libs are C99 compliant and some do not
grasp %ll (similar to %zu). Use int64_t and PRIi64 to work around that.
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
---
src/openvpn/error.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi, On Fri, Feb 16, 2018 at 8:45 AM, Steffan Karger <steffan.karger@fox-it.com> wrote: > Not all supported windows formatting libs are C99 compliant and some do not > grasp %ll (similar to %zu). Use int64_t and PRIi64 to work around that. > > Signed-off-by: Steffan Karger <steffan.karger@fox-it.com> > --- > src/openvpn/error.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/openvpn/error.c b/src/openvpn/error.c > index bf987d2..bc14e8c 100644 > --- a/src/openvpn/error.c > +++ b/src/openvpn/error.c > @@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) > struct timeval tv; > gettimeofday(&tv, NULL); > > - fprintf(fp, "%lld.%06lu %x %s%s%s%s", > - (long long)tv.tv_sec, > + fprintf(fp, "%"PRIi64".%06lu %x %s%s%s%s", > + (int64_t)tv.tv_sec, > (unsigned long)tv.tv_usec, > flags, > prefix, > -- This is good but there are a number of such instances (otime.c, packet_id.c, forward.c etc. within code path relevant to Windows). Many related to time_t like here, one or two other uses of %lld. And may be more if some DEBUG flags are enabled. If those are left for future patches, that's ok. Just saying in case its an oversight.. Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On 18-02-18 20:04, Selva Nair wrote: > On Fri, Feb 16, 2018 at 8:45 AM, Steffan Karger > <steffan.karger@fox-it.com> wrote: >> Not all supported windows formatting libs are C99 compliant and some do not >> grasp %ll (similar to %zu). Use int64_t and PRIi64 to work around that. >> >> Signed-off-by: Steffan Karger <steffan.karger@fox-it.com> >> --- >> src/openvpn/error.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/src/openvpn/error.c b/src/openvpn/error.c >> index bf987d2..bc14e8c 100644 >> --- a/src/openvpn/error.c >> +++ b/src/openvpn/error.c >> @@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) >> struct timeval tv; >> gettimeofday(&tv, NULL); >> >> - fprintf(fp, "%lld.%06lu %x %s%s%s%s", >> - (long long)tv.tv_sec, >> + fprintf(fp, "%"PRIi64".%06lu %x %s%s%s%s", >> + (int64_t)tv.tv_sec, >> (unsigned long)tv.tv_usec, >> flags, >> prefix, >> -- > > This is good but there are a number of such instances (otime.c, > packet_id.c, forward.c etc. within code path relevant to Windows). > Many related to time_t like here, one or two other uses of %lld. And > may be more if some DEBUG flags are enabled. > > If those are left for future patches, that's ok. Just saying in case > its an oversight.. Good point - I did the lazy thing and just fixed what my compiler was complaining about. (My OpenVPN-NL buildbots build with "-Werror=implicit -Werror=format -Werror=format-security".) For now, let's leave the rest - that doesn't break my build ;-) - for a future patch. I'll put it on my todo list, but will also happily review patches from someone else if (s)he beats me to it. -Steffan ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On Mon, Feb 19, 2018 at 3:16 AM, Steffan Karger <steffan.karger@fox-it.com> wrote: > Hi, > > On 18-02-18 20:04, Selva Nair wrote: >> On Fri, Feb 16, 2018 at 8:45 AM, Steffan Karger >> <steffan.karger@fox-it.com> wrote: >>> Not all supported windows formatting libs are C99 compliant and some do not >>> grasp %ll (similar to %zu). Use int64_t and PRIi64 to work around that. >>> >>> Signed-off-by: Steffan Karger <steffan.karger@fox-it.com> >>> --- >>> src/openvpn/error.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/src/openvpn/error.c b/src/openvpn/error.c >>> index bf987d2..bc14e8c 100644 >>> --- a/src/openvpn/error.c >>> +++ b/src/openvpn/error.c >>> @@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) >>> struct timeval tv; >>> gettimeofday(&tv, NULL); >>> >>> - fprintf(fp, "%lld.%06lu %x %s%s%s%s", >>> - (long long)tv.tv_sec, >>> + fprintf(fp, "%"PRIi64".%06lu %x %s%s%s%s", >>> + (int64_t)tv.tv_sec, >>> (unsigned long)tv.tv_usec, >>> flags, >>> prefix, >>> -- >> >> This is good but there are a number of such instances (otime.c, >> packet_id.c, forward.c etc. within code path relevant to Windows). >> Many related to time_t like here, one or two other uses of %lld. And >> may be more if some DEBUG flags are enabled. >> >> If those are left for future patches, that's ok. Just saying in case >> its an oversight.. > > Good point - I did the lazy thing and just fixed what my compiler was > complaining about. (My OpenVPN-NL buildbots build with > "-Werror=implicit -Werror=format -Werror=format-security".) Makes sense.. But I'm surprised why it doesn't catch all errors. > > For now, let's leave the rest - that doesn't break my build ;-) - for a > future patch. I'll put it on my todo list, but will also happily review > patches from someone else if (s)he beats me to it. I am sending in a patch that covers all format errors that I see in current windows cross builds. Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, On Mon, Feb 19, 2018 at 3:18 PM, Selva Nair <selva.nair@gmail.com> wrote: > Hi, > > On Mon, Feb 19, 2018 at 3:16 AM, Steffan Karger > <steffan.karger@fox-it.com> wrote: >> Hi, >> >> On 18-02-18 20:04, Selva Nair wrote: >>> On Fri, Feb 16, 2018 at 8:45 AM, Steffan Karger >>> <steffan.karger@fox-it.com> wrote: >>>> Not all supported windows formatting libs are C99 compliant and some do not >>>> grasp %ll (similar to %zu). Use int64_t and PRIi64 to work around that. >>>> >>>> Signed-off-by: Steffan Karger <steffan.karger@fox-it.com> >>>> --- >>>> src/openvpn/error.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/src/openvpn/error.c b/src/openvpn/error.c >>>> index bf987d2..bc14e8c 100644 >>>> --- a/src/openvpn/error.c >>>> +++ b/src/openvpn/error.c >>>> @@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) >>>> struct timeval tv; >>>> gettimeofday(&tv, NULL); >>>> >>>> - fprintf(fp, "%lld.%06lu %x %s%s%s%s", >>>> - (long long)tv.tv_sec, >>>> + fprintf(fp, "%"PRIi64".%06lu %x %s%s%s%s", >>>> + (int64_t)tv.tv_sec, >>>> (unsigned long)tv.tv_usec, >>>> flags, >>>> prefix, >>>> -- >>> >>> This is good but there are a number of such instances (otime.c, >>> packet_id.c, forward.c etc. within code path relevant to Windows). >>> Many related to time_t like here, one or two other uses of %lld. And >>> may be more if some DEBUG flags are enabled. >>> >>> If those are left for future patches, that's ok. Just saying in case >>> its an oversight.. >> >> Good point - I did the lazy thing and just fixed what my compiler was >> complaining about. (My OpenVPN-NL buildbots build with >> "-Werror=implicit -Werror=format -Werror=format-security".) > > Makes sense.. But I'm surprised why it doesn't catch all errors. > >> >> For now, let's leave the rest - that doesn't break my build ;-) Anyway, assuming that (i) my longer patch will take more time to get reviewed/tested and (ii) this is priority if a release is imminent, ACK from me. Acked-by: Selva Nair <selva.nair@gmail.com> (Only compile tested) Selva ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Your patch has been applied to the release/2.4 branch.
Note: the code in master looks subtly different here - also using %lld
for tv.tv_sec, but using %ld / (long) for tv.tv_usec so the patch does not
directly apply. Since Selva is working on fixing all these for good, I've
decided to take the easy way and only apply this patch to 2.4 - which it
very much looks like it's intended for :-)
commit 9ba36639abcac4367c8227d2dd87b18fb56267c4 (release/2.4)
Author: Steffan Karger
Date: Fri Feb 16 14:45:39 2018 +0100
Fix format errors when cross-compiling for Windows
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <1518788739-16610-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16478.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
diff --git a/src/openvpn/error.c b/src/openvpn/error.c index bf987d2..bc14e8c 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -342,8 +342,8 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist) struct timeval tv; gettimeofday(&tv, NULL); - fprintf(fp, "%lld.%06lu %x %s%s%s%s", - (long long)tv.tv_sec, + fprintf(fp, "%"PRIi64".%06lu %x %s%s%s%s", + (int64_t)tv.tv_sec, (unsigned long)tv.tv_usec, flags, prefix,