From owner-dev-commits-src-all@freebsd.org Thu Aug 12 18:29:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B10D8670DCC; Thu, 12 Aug 2021 18:29:11 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GlwFL66Hmz3PKN; Thu, 12 Aug 2021 18:29:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id E97XmiqcRFRDpEFS2mgk6u; Thu, 12 Aug 2021 18:29:10 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id EFS0mHG7UqeviEFS1mcAoa; Thu, 12 Aug 2021 18:29:10 +0000 X-Authority-Analysis: v=2.4 cv=B4F8bMhM c=1 sm=1 tr=0 ts=61156876 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=MhDmnRu9jo8A:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=JRNxp-b1r3qJcsVWaVUA:9 a=CjuIK1q_8ugA:10 a=GZNcuLsopXQA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 137F767A; Thu, 12 Aug 2021 11:29:08 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 17CIT71Q034598; Thu, 12 Aug 2021 11:29:07 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202108121829.17CIT71Q034598@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ed Maste cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: d20e9e02db3d - main - ar: diff reduction against ELF Tool Chain In-reply-to: <202108121729.17CHTWfb033244@slippy.cwsent.com> References: <202108112313.17BNDL1g093210@gitrepo.freebsd.org> <202108121729.17CHTWfb033244@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Thu, 12 Aug 2021 10:29:32 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 12 Aug 2021 11:29:07 -0700 X-CMAE-Envelope: MS4xfGsg9eGshybo1y8vrOB3IstCDJvKj50ObJ1o+T3M725IwK3H9JVZPE9rEngKkoagFgJtH7/JcKb+lGz3EPb6wFBu3LQ/VJUl4HpOTJrfmZdfWBKAkKMo KXqCPYF+cfkMDb9dy7dHGBB0XiBdeoqPoi3LP8oJP9oerxULhjGPy/XDB6bqxky5JEo+xnZLPYzNlfuh7bYI2wtVneu0e8Y/cwiWMYAxYAuLAcYYhzuMPvvq p2LubKFinTV8DVQdlFv065JyZJVZYXWJ2MFFW15k2ioSX9oTGoSVEKSisoDjb1x5yQ6OcKItDHbzuArxMX7NMKH+rmlOQV5+8o2TMZQm16Q= X-Rspamd-Queue-Id: 4GlwFL66Hmz3PKN X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 3.97.99.32) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-0.48 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-0.89)[-0.888]; RWL_MAILSPIKE_VERYGOOD(0.00)[3.97.99.32:from]; NEURAL_HAM_SHORT(-0.99)[-0.987]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all]; RECEIVED_SPAMHAUS_PBL(0.00)[70.66.148.124:received] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 18:29:11 -0000 In message <202108121729.17CHTWfb033244@slippy.cwsent.com>, Cy Schubert writes: > In message <202108112313.17BNDL1g093210@gitrepo.freebsd.org>, Ed Maste > writes: > > The branch main has been updated by emaste: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d20e9e02db3dde383c3de1ce8cec3a > 8c > > 35b3eee6 > > > > commit d20e9e02db3dde383c3de1ce8cec3a8c35b3eee6 > > Author: Ed Maste > > AuthorDate: 2021-08-04 13:54:17 +0000 > > Commit: Ed Maste > > CommitDate: 2021-08-11 23:12:46 +0000 > > > > ar: diff reduction against ELF Tool Chain > > > > - Drop exit status from bsdar_errc. ELF Tool Chain always returns > > EXIT_FAILURE in bsdar_errc. > > > > - Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive > > directly. > > > > Obtained from: ELF Tool Chain > > Reviewed by: markj > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D31496 > > --- > > usr.bin/ar/acpyacc.y | 48 ++++++++++------------ > > usr.bin/ar/ar.c | 52 ++++++++---------------- > > usr.bin/ar/ar.h | 18 +++------ > > usr.bin/ar/read.c | 34 ++++------------ > > usr.bin/ar/util.c | 4 +- > > usr.bin/ar/write.c | 111 +++++++++++++++-------------------------------- > -- > > -- > > 6 files changed, 85 insertions(+), 182 deletions(-) > > > [...] > > diff --git a/usr.bin/ar/ar.h b/usr.bin/ar/ar.h > > index 21b3a669a943..bcccf93a6016 100644 > > --- a/usr.bin/ar/ar.h > > +++ b/usr.bin/ar/ar.h > > @@ -54,7 +54,7 @@ > > */ > > #define AC(CALL) do { > > \ > > if ((CALL)) \ > > - bsdar_errc(bsdar, EXIT_FAILURE, archive_errno(a), "%s", \ > > + bsdar_errc(bsdar, archive_errno(a), "%s", \ > > archive_error_string(a)); \ > > } while (0) > > > > @@ -114,16 +114,8 @@ struct bsdar { > > TAILQ_HEAD(, ar_obj) v_obj; /* object(member) list */ > > }; > > > > -void bsdar_errc(struct bsdar *, int _eval, int _code, > > - const char *fmt, ...) __dead2; > > -void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...); > > -int ar_mode_d(struct bsdar *bsdar); > > -int ar_mode_m(struct bsdar *bsdar); > > -int ar_mode_p(struct bsdar *bsdar); > > -int ar_mode_q(struct bsdar *bsdar); > > -int ar_mode_r(struct bsdar *bsdar); > > -int ar_mode_s(struct bsdar *bsdar); > > -int ar_mode_t(struct bsdar *bsdar); > > -int ar_mode_x(struct bsdar *bsdar); > > -int ar_mode_A(struct bsdar *bsdar); > > void ar_mode_script(struct bsdar *ar); > > +int ar_read_archive(struct bsdar *ar, int mode); > > +int ar_write_archive(struct bsdar *ar, int mode); > > +void bsdar_errc(struct bsdar *, int _code, const char *fmt, ...) __d > ead2; > > +void bsdar_warnc(struct bsdar *, int _code, const char *fmt, ...); > > diff --git a/usr.bin/ar/read.c b/usr.bin/ar/read.c > > index 04130b859c32..81e0bfce1b7e 100644 > > --- a/usr.bin/ar/read.c > > +++ b/usr.bin/ar/read.c > > @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -42,34 +43,11 @@ __FBSDID("$FreeBSD$"); > > > > #include "ar.h" > > > > -static int read_archive(struct bsdar *bsdar, char mode); > > - > > -int > > -ar_mode_p(struct bsdar *bsdar) > > -{ > > - > > - return (read_archive(bsdar, 'p')); > > -} > > - > > -int > > -ar_mode_t(struct bsdar *bsdar) > > -{ > > - > > - return (read_archive(bsdar, 't')); > > -} > > - > > -int > > -ar_mode_x(struct bsdar *bsdar) > > -{ > > - > > - return (read_archive(bsdar, 'x')); > > -} > > - > > /* > > * Handle read modes: 'x', 't' and 'p'. > > */ > > -static int > > -read_archive(struct bsdar *bsdar, char mode) > > +int > > +ar_read_archive(struct bsdar *bsdar, int mode) > > { > > struct archive *a; > > struct archive_entry *entry; > > @@ -87,8 +65,10 @@ read_archive(struct bsdar *bsdar, char mode) > > char find; > > int exitcode, flags, r, i; > > > > + assert(mode == 'p' || mode == 't' || mode == 'x'); > > This is causing port build failures: > > ar -cq libutil.a allwhite.o inctest.o letter.o triedump.o triepdmp.o > trieplk.o trierset.o upcmp8.o upstrcmp.o wchar.o conutil.o error.o exit.o > itoa.o lower.o malloc.o openchk.o trie.o triecnt.o upper.o whitesp.o > ranlib libutil.a > Assertion failed: (mode == 'p' || mode == 't' || mode == 'x'), function > ar_read_archive, file /usr/local/poudriere/jails/main-amd64/usr/src/usr.bin/ > ar/read.c, line 68. > *** Signal 6 > > Notice at line 154 of ar.c that ar_read_archive() is called with mode='s'. > This certainly triggers the assertion. The assertion may also trigger by > the call to ar_read_archive() at line 330 of ar.c where mode is set to > bsdar->mode. It appears that upstream doesn't call ar_read_archive() at line 154 of ar.c. This would explain why they have the assertion they do in ar_read_archive(). There is only one call to ar_read_archive() at line 350 which corresponds to our line 330 of ar.c. > > > + > > if ((a = archive_read_new()) == NULL) > > - bsdar_errc(bsdar, EXIT_FAILURE, 0, "archive_read_new failed"); > > + bsdar_errc(bsdar, 0, "archive_read_new failed"); > > archive_read_support_format_ar(a); > > AC(archive_read_open_filename(a, bsdar->filename, DEF_BLKSZ)); > > > > @@ -122,7 +102,7 @@ read_archive(struct bsdar *bsdar, char mode) > > if (*av == NULL) > > continue; > > if ((bname = basename(*av)) == NULL) > > - bsdar_errc(bsdar, EXIT_FAILURE, errno, > > + bsdar_errc(bsdar, errno, > > "basename failed"); > > if (strcmp(bname, name) != 0) > > continue; > [...] -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few.