From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 2072F3858D35 for ; Fri, 19 Jun 2020 18:52:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2072F3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 2C08A3000731 for ; Fri, 19 Jun 2020 20:52:51 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id D7B554000C91; Fri, 19 Jun 2020 20:52:51 +0200 (CEST) Message-ID: <376287e529c7e38158105bce0b64d73511e84e01.camel@klomp.org> Subject: Re: [PATCH 06/10] ar, ranlib: Call fchown before fchmod, explicitly check and ignore errors. From: Mark Wielaard To: elfutils-devel@sourceware.org Date: Fri, 19 Jun 2020 20:52:51 +0200 In-Reply-To: <20200616222539.29109-6-mark@klomp.org> References: <20200616222539.29109-1-mark@klomp.org> <20200616222539.29109-6-mark@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2020 18:52:54 -0000 On Wed, 2020-06-17 at 00:25 +0200, Mark Wielaard wrote: > In ar and ranlib we don't mind if the fchown call fails (it normally > would, then the file simply gets own by the current user). We used to > call fchown before fchmod, but that might ignore (or reset) some mode > flags, so call fchown first, then try fchmod (like we already do in > elfcompress). Also explicitly test and then ignore any errors for > chown. We used to do some asm trick, but that confuses some static > analyzers (and it is somewhat unreadable). Also split out the giant > if statements to make them a little bit more understandable. Pushed to master.