From patchwork Sat Jun 23 02:09:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 381 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id 2x+vHLY4Lls6IgAAIUCqbw for ; Sat, 23 Jun 2018 08:10:30 -0400 Received: from proxy8.mail.iad3b.rsapps.net ([172.31.255.6]) by director7.mail.ord1d.rsapps.net (Dovecot) with LMTP id g/AFFrY4Llv8YAAAovjBpQ ; Sat, 23 Jun 2018 08:10:30 -0400 Received: from smtp37.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.iad3b.rsapps.net with LMTP id EIseFLY4LltcbgAAoCsc3g ; Sat, 23 Jun 2018 08:10:30 -0400 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: smtp37.gate.iad3b.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=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: 6b519032-76de-11e8-a706-5254002ca64a-1-1 Received: from [216.105.38.7] ([216.105.38.7:38402] helo=lists.sourceforge.net) by smtp37.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 1F/86-04893-5B83E2B5; Sat, 23 Jun 2018 08:10:29 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1fWhM1-0002cW-99; Sat, 23 Jun 2018 12:09:21 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fWhM0-0002cL-0X for openvpn-devel@lists.sourceforge.net; Sat, 23 Jun 2018 12:09:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Subject:Cc:To:From: Message-Id:Date:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SdJ8Q12nRzNGDf+Qjv22YtOivrO9fO4G6Avu5xlPF3o=; b=ZznEvKCqZLBKQBK+54qU5bB28 1gQKXu3XTpyv+B0f80/tKTRxEJW55ZM5cTxK9RV5kHcKXsw2uoBmHs2TIbxqBnJNpR9Pi0AsYyyL0 dmppmy08UP/xHXjar7NBVCmYqPnWiT3+FLp8FsNwbI40innjchQRoTMZW/M+S1w6nqbEY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Subject:Cc:To:From:Message-Id:Date:Sender:Reply-To :MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=SdJ8Q12nRzNGDf+Qjv22YtOivrO9fO4G6Avu5xlPF3o=; b=d1GI2SBb9uwx+d6j+VJvQDP2Pj h9CSlBeSpvxyU6CnxssaK18F/JxneWCwyNfgHToB2Iby1C2MhVBiZhSvZpqpLUn+CFRZqPE/8b1p6 eeb9SN+It6lVxdUMlItxZ9gLhKRhuUdzmd38NdMBGcH40yxBs8z5HR0OvWuWEf2o3St8=; Received: from chekov.greenie.muc.de ([193.149.48.178]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fWhLx-001148-I3 for openvpn-devel@lists.sourceforge.net; Sat, 23 Jun 2018 12:09:19 +0000 Received: from chekov.greenie.muc.de (localhost [127.0.0.1]) by chekov.greenie.muc.de (8.15.2/8.15.2) with ESMTPS id w5NC9Ai8028416 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Jun 2018 14:09:10 +0200 (CEST) (envelope-from gert@chekov.greenie.muc.de) Received: (from gert@localhost) by chekov.greenie.muc.de (8.15.2/8.15.2/Submit) id w5NC9AhF028415; Sat, 23 Jun 2018 14:09:10 +0200 (CEST) (envelope-from gert) Date: Sat, 23 Jun 2018 14:09:10 +0200 (CEST) Message-Id: <201806231209.w5NC9AhF028415@chekov.greenie.muc.de> From: Gert Doering To: Antonio Quartulli X-Patchwork-State: Accepted In-Reply-To: <20180623021147.22792-1-a@unstable.cc> References: <20180623021147.22792-1-a@unstable.cc> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1fWhLx-001148-I3 Subject: [Openvpn-devel] [PATCH applied] Re: add support for %lu in argv_printf and prevent ASSERT X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: openvpn-devel@lists.sourceforge.net MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Acked-by: Gert Doering The code is trivially correct, and it does what it says on the lid :-) - and to verify, I've added a unit test to test_argv.c - attached below, we might consider adding something like this, or something more elaborate for all supported argv*() arguments... Your patch has been applied to the master and release/2.4 branch ("someone will fix something else some day, relying on the existance of %lu, and then 2.4 will surprisingly explode"). commit e38d3a004195f33c5c04fe7c04db5d66c53241bc (master) commit 61dcf1513d69ddf1261402744496436923ec14bb (release/2.4) Author: Antonio Quartulli Date: Sat Jun 23 10:11:47 2018 +0800 add support for %lu in argv_printf and prevent ASSERT Signed-off-by: Antonio Quartulli Acked-by: Gert Doering Message-Id: <20180623021147.22792-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17115.html Signed-off-by: Gert Doering ---------- --- 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/tests/unit_tests/openvpn/test_argv.c b/tests/unit_tests/openvpn/test_argv.c index 4a3ba559..0e7a4513 100644 --- a/tests/unit_tests/openvpn/test_argv.c +++ b/tests/unit_tests/openvpn/test_argv.c @@ -116,8 +116,12 @@ argv_str__multiple_argv__correct_output(void **state) argv_printf(&a, "%s%sc", PATH1, PATH2); argv_printf_cat(&a, "%s", PARAM1); argv_printf_cat(&a, "%s", PARAM2); + argv_printf_cat(&a, "%d", -1); + argv_printf_cat(&a, "%u", -1); + argv_printf_cat(&a, "%lu", (unsigned long) (1L<<33) ); output = argv_str(&a, &gc, PA_BRACKET); - assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]"); + assert_string_equal(output, "[" PATH1 PATH2 "] [" PARAM1 "] [" PARAM2 "]" + " [-1] [4294967295] [8589934592]"); argv_reset(&a); gc_free(&gc);