From owner-dev-commits-src-main@freebsd.org Thu Aug 12 17:29:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8567166FE6D; Thu, 12 Aug 2021 17:29:36 +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 4Gltwc213cz3LRM; Thu, 12 Aug 2021 17:29:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id EBYmmixH7FRDpEEWNmgQ9A; Thu, 12 Aug 2021 17:29:35 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id EEWLmaP2VM8olEEWMmf8LB; Thu, 12 Aug 2021 17:29:35 +0000 X-Authority-Analysis: v=2.4 cv=Ua6U9IeN c=1 sm=1 tr=0 ts=61155a7f a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=MhDmnRu9jo8A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=Dk8YGwJLn-YpwTmex9IA:9 a=CjuIK1q_8ugA:10 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 7048151F; Thu, 12 Aug 2021 10:29:32 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 17CHTWfb033244; Thu, 12 Aug 2021 10:29:32 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202108121729.17CHTWfb033244@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: <202108112313.17BNDL1g093210@gitrepo.freebsd.org> References: <202108112313.17BNDL1g093210@gitrepo.freebsd.org> Comments: In-reply-to Ed Maste message dated "Wed, 11 Aug 2021 23:13:21 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 12 Aug 2021 10:29:32 -0700 X-CMAE-Envelope: MS4xfJAglP3KywsO72c8cOy/Y3MeArYoPhdCj/h40dNV820yOcyRq2Sw9FWBA2OkQPVkcbyMAkRWeGPYcunmy8EP0628M1NWID84XI9A32X4JVrwoye76eM/ 3WiNfehnd6AjnKD04hWJDqAXxzTI7pVycvM3lY1tDiVNWjmQaNtbz0r+ATEei6j7HJ8xc7RbvPjBqx6FI4CgA+xUmrSXNArxGFnAa6zOWMC+SBAcGsVj/sZd hwCzYa3vgYOdCoz6ZKfKxkpvE9arn3izrtfGDJXpFFJZju5GCaRaHCy+NV1S441wa2xBzm4xl78QZC9l0jfBYF+zztgN6ppC5lgDNHbdrNM= X-Rspamd-Queue-Id: 4Gltwc213cz3LRM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 17:29:36 -0000 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=d20e9e02db3dde383c3de1ce8cec3a8c > 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, ...) __dead2; > +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. > + > 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.