From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 4C95D1F461 for ; Mon, 26 Aug 2019 02:13:16 +0000 (UTC) Received: from localhost ([::1]:49142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i24VO-0001Bt-OR for normalperson@yhbt.net; Sun, 25 Aug 2019 22:13:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59723) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i24VL-0001BT-0u for bug-gnulib@gnu.org; Sun, 25 Aug 2019 22:13:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i24VJ-0000rV-4X for bug-gnulib@gnu.org; Sun, 25 Aug 2019 22:13:10 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:58124) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i24VI-0000oO-Tg for bug-gnulib@gnu.org; Sun, 25 Aug 2019 22:13:09 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 7F1F2160079; Sun, 25 Aug 2019 19:13:02 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id lNayDQNNWsX5; Sun, 25 Aug 2019 19:13:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 903041600AD; Sun, 25 Aug 2019 19:13:01 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MLaqSsLURFrW; Sun, 25 Aug 2019 19:13:01 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 6549C160079; Sun, 25 Aug 2019 19:13:01 -0700 (PDT) Subject: Re: install-sh -s on readonly file To: Karl Berry References: <201908260052.x7Q0qjAS005353@freefriends.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sun, 25 Aug 2019 19:13:00 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <201908260052.x7Q0qjAS005353@freefriends.org> Content-Type: multipart/mixed; boundary="------------557743FD24EABEAD3172408B" Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --------------557743FD24EABEAD3172408B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Karl Berry wrote: > - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && > + { test -z "$stripcmd" || ($doit $chmodcmd u+w "$dsttmp"; $doit $stripcmd "$dsttmp") } && How about the attached Automake patch instead? It avoids the extra forks and exec. Admittedly it's longer. --------------557743FD24EABEAD3172408B Content-Type: text/x-patch; name="0001-install-sh-support-s-with-read-only-source.patch" Content-Disposition: attachment; filename="0001-install-sh-support-s-with-read-only-source.patch" Content-Transfer-Encoding: quoted-printable >From c50db415f06d3a29780fe9650654165f6fa28bf0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 25 Aug 2019 18:51:26 -0700 Subject: [PATCH] install-sh: support -s with read-only source MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Problem reported by Karl Berry in: https://lists.gnu.org/r/bug-gnulib/2019-08/msg00067.html * lib/install-sh: If -s is given, create the temporary file with $cp_umask so that =E2=80=98strip=E2=80=99 can write to it. --- lib/install-sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/install-sh b/lib/install-sh index 8175c640f..1f5cdccc7 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -451,7 +451,16 @@ do trap 'ret=3D$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 =20 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && =20 # and set any options; do chmod last to preserve setuid bits. # --=20 2.21.0 --------------557743FD24EABEAD3172408B--