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.7 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE 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 452AE1F461 for ; Mon, 26 Aug 2019 00:52:59 +0000 (UTC) Received: from localhost ([::1]:48882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i23Fh-00080m-S3 for normalperson@yhbt.net; Sun, 25 Aug 2019 20:52:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51103) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i23Fd-00080U-Kb for bug-gnulib@gnu.org; Sun, 25 Aug 2019 20:52:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i23Fa-0001r0-HK for bug-gnulib@gnu.org; Sun, 25 Aug 2019 20:52:51 -0400 Received: from freefriends.org ([96.88.95.60]:48092) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i23Fa-0001os-AS for bug-gnulib@gnu.org; Sun, 25 Aug 2019 20:52:50 -0400 X-Envelope-From: karl@freefriends.org X-Envelope-To: Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id x7Q0qkxo005355 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 25 Aug 2019 18:52:47 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id x7Q0qjAS005353; Sun, 25 Aug 2019 18:52:45 -0600 Date: Sun, 25 Aug 2019 18:52:45 -0600 Message-Id: <201908260052.x7Q0qjAS005353@freefriends.org> From: Karl Berry To: bug-gnulib@gnu.org Subject: install-sh -s on readonly file X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 96.88.95.60 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: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi - I sent this possible patch for install-sh to bug-automake (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36966, appended below for convenience). My fix seems clunky to me, but neither Jim nor I could think of a better way and there were no replies on the list. I just thought I'd send it here to see if anyone had any ideas before we install it ... --thanks, karl. From: Karl Berry To: bug-automake@gnu.org Subject: install-sh -s on 555 executable fails (I'm not on this list, so please keep me in cc if need be.) It seems that install-sh -s (what automake's install-strip target can end up doing) fails if the original file doesn't have the owner-write bit set: cp /bin/cp /tmp/rx # any binary will do chmod 555 /tmp/rx # make unwritable to owner install-sh -s /tmp/rx /tmp/sx # try to install, with strip -> strip: unable to copy file '/tmp/_inst.31092_'; reason: Permission denied echo $? -> 1 Although install-sh (version 2018-03-11.20, lines 224ff.) does some stuff to ensure that umask will not clear an owner-writable bit in the destination, that's not enough to make it owner-writable if it's not already. The only less-than-wonderful fix I could come up with is to explicitly do chmod u+w if strip is being executed. I thought maybe it would be worth trying the strip even if the chmod failed, hence the ; instead of &&, but it's not something I feel strongly about. And maybe there is some nicer way to do it altogether. --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -461,7 +461,7 @@ do # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$stripcmd" || ($doit $chmodcmd u+w "$dsttmp"; $doit $stripcmd "$dsttmp") } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. Wdyt? --thanks, karl.