Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3070239lqt; Tue, 23 Apr 2024 09:30:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGRrlY7mUMG0gp/YOgW3rp1bcMBc2OnVzJNxgn90GOjypPQyPKX9polFPK/+7n2LfIqB8zR6Zea46/+1T7P2ukqfnrhbrV9BW/cZXQDA== X-Google-Smtp-Source: AGHT+IGshk2A672CD/s9YdUXoo118RrqvdR9+IWOI8xJhmz1DM+o+g/sEpqn+caet7Xh8YU2lT86 X-Received: by 2002:a05:6a20:321b:b0:1a7:99c5:802 with SMTP id hl27-20020a056a20321b00b001a799c50802mr17601001pzc.37.1713889819178; Tue, 23 Apr 2024 09:30:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713889819; cv=pass; d=google.com; s=arc-20160816; b=0qOwDK6lmrwS/ZLomg0zoqi2l9vcx/KpMg5omLXaZehSIvisLiJTIRTygGXU01aZf9 WBuI6LSbRK6s5p4z6CfXIujkPlKLxC5uuYeCOwe1ofjS0mbg8tdXZuodbJNA+sawy+tB TOwIqLuSGSbiSdM7BYZ8Fn/1AMrYCvshEUmsSKdRvazcb+GvNYyB4UNNp26ExPW0dhHa ih99VegD+cm4gix+Yfett6Tld1RIIGeSHGHanD0smqc9kxzDMiFdysmmyqWzRWi7EKOk Dxo/UfeUzckhnldSrlNZh5Fel+fitSfc4U7596UdpZEB09UWHL0W+q8nyNhxIZPRpltc cfdw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=rhMmvrw36U0quY1A9BFStVWf15g66rJG5RSaQ4oxvXE=; fh=8qFYTo/dnk/O3qup+3POzP/5TuBru8XM5AGjOiamwJU=; b=Y7DySuR4UzpkvnIpL3UT4qHZJdfRzb0P01k1woMgl1uyhSqO7iA62s5jzHDhTwozZB PLAJ/aq11TxlCUL4UzS99EnNxmNACwps0jIn15wlidHuc1EhiaGnHW8nZjdtfEzV5nkv yupPKJ1Nm9N2x428xALqY7crFHUHgD3PuJx3c2a1yJHKqKi6hfq+NmKLIB+0AbpkWKQ5 sGXJ1vR5N70cxVmddZp8b3LJoQRREikNm0lEjLa5pf3yQt3kndFPpCFFBWju5xhI0ZrK 3RJifHi+uk8GRCnMWFLvRrJozzMb0oWGmOCV9I7HLG/vTnGqmxiXOClcEulhVIHO6jak OhBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-155574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155574-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bw5-20020a056a02048500b0060294283d2bsi2361800pgb.301.2024.04.23.09.30.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 09:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-155574-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155574-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4192028E515 for ; Tue, 23 Apr 2024 16:30:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7670113DBB6; Tue, 23 Apr 2024 16:28:47 +0000 (UTC) Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38ACB13D52A for ; Tue, 23 Apr 2024 16:28:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=163.172.96.212 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713889727; cv=none; b=o7OJ6Rc+h4d5M/WP4ZoQkIbp3rDYJ0QsuxHP3XZmb77jZEXmTl9YfAPisNP2809Q/cxI+ROqgb4wAwHpB9InZHU5tEWyhL1swCc0BVs77Pu0q6akl8BQFPvVKW5EsDoPE/G0VSByRmj1USKrGOHMdMDpEXW3KtByNSMUMfXNSCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713889727; c=relaxed/simple; bh=pB4VKsnN31I2O7fVXpDLnLWksgilJsrVoiT9rsc7u+k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LQYBr0JtAvZezAbxUV4vWPK0zUK1Ajbp+GDuCVV2x+Z2uDcSaeirnvOVh/o5ucdgSKRaj23+RDJLxgv+9V5VKn02XC0Kjrcy0+hKfNU/xMaf9+aD/NFWYKQW525/2T8xb7/uEzhSEzJYhyd/lBgqaACcxhRfMHKV5k7q6h2UYq0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; arc=none smtp.client-ip=163.172.96.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 43NGSVWL022815; Tue, 23 Apr 2024 18:28:31 +0200 Date: Tue, 23 Apr 2024 18:28:31 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Shuah Khan , "Paul E. McKenney" , linux-kernel@vger.kernel.org, Rodrigo Campos Subject: Re: [PATCH v3 4/4] selftests/nolibc: Add tests for strlcat() and strlcpy() Message-ID: References: <20240218195110.1386840-1-rodrigo@sdfg.com.ar> <20240218195110.1386840-5-rodrigo@sdfg.com.ar> <172d25cf-cfd7-4069-8c26-df2e81ffbad1@t-8ch.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <172d25cf-cfd7-4069-8c26-df2e81ffbad1@t-8ch.de> Hi Thomas, On Tue, Apr 23, 2024 at 11:18:06AM +0200, Thomas Wei?schuh wrote: > + Shuah and Paul, please see below. > > So I picked this up and it got picked up by Shuah, but... > > On 2024-02-18 16:51:06+0000, Rodrigo Campos wrote: > > I've verified that the tests matches libbsd's strlcat()/strlcpy() > > implementation. > > > > Please note that as strlcat()/strlcpy() are not part of the libc, the > > tests are only compiled when using nolibc. > > > > Signed-off-by: Rodrigo Campos > > --- > > tools/testing/selftests/nolibc/nolibc-test.c | 40 ++++++++++++++++++++ > > 1 file changed, 40 insertions(+) > > > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > > index 6ba4f8275ac4..d373fc14706c 100644 > > --- a/tools/testing/selftests/nolibc/nolibc-test.c > > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > > @@ -600,6 +600,25 @@ int expect_strne(const char *expr, int llen, const char *cmp) > > return ret; > > } > > > > +#define EXPECT_STRBUFEQ(cond, expr, buf, val, cmp) \ > > + do { if (!(cond)) result(llen, SKIPPED); else ret += expect_str_buf_eq(expr, buf, val, llen, cmp); } while (0) > > + > > +static __attribute__((unused)) > > +int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const char *cmp) > > +{ > > + llen += printf(" = %lu <%s> ", expr, buf); > > This introduces a compiler warning on 32bit: > > i386-linux-gcc -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra -fno-stack-protector -m32 -mstack-protector-guard=global -fstack-protector-all -o nolibc-test \ > -nostdlib -nostdinc -static -Isysroot/i386/include nolibc-test.c nolibc-test-linkage.c -lgcc > nolibc-test.c: In function 'expect_str_buf_eq': > nolibc-test.c:610:30: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] > 610 | llen += printf(" = %lu <%s> ", expr, buf); > | ~~^ ~~~~ > | | | > | | size_t {aka unsigned int} > | long unsigned int > | %u > > > It is easy enough to fix through a cast to "unsigned long". Yes, that's usually what I do as well with size_t everywhere as well. > The original patch was already sent to Shuah and included in -next. > > Shuah, Paul: > > I'd like to rewrite the offending commit instead of having a fixup commit. > As it seems to me the original patch would only go into 6.10 anyways. > > Any objections? I, too, think it would be the cleanest history-wise, I just don't know if that's the easiest for Shuah if it requires to change already published commit IDs. > Notes to self: > > * Add flag to run-tests.sh to use -Werror > * Implement "%zu" in nolibc printf() Could be nice indeed! Thanks Thomas for taking care of this! Willy