From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#53534: 28.0.91; on netbsd 'gmake install' outputs 'find: chown: No such file or directory' Date: Wed, 26 Jan 2022 21:22:54 -0500 Message-ID: References: <83zgnjgoig.fsf@gnu.org> <5wr18vdsw3.fsf@fencepost.gnu.org> <83r18uhde4.fsf@gnu.org> <34ea3c43-b527-eae2-9f21-404317ed6f3@SDF.ORG> <83y232fs0y.fsf@gnu.org> <27bkzye66g.fsf@fencepost.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31690"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: Van Ly , 53534@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 27 03:24:12 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nCuSJ-0007yp-Am for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 27 Jan 2022 03:24:11 +0100 Original-Received: from localhost ([::1]:39594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nCuSI-0005vn-2V for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jan 2022 21:24:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCuSA-0005vP-6o for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 21:24:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nCuS9-0005y1-Qa for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 21:24:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nCuS9-0003vn-JG for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2022 21:24:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jan 2022 02:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53534 X-GNU-PR-Package: emacs Original-Received: via spool by 53534-submit@debbugs.gnu.org id=B53534.164325019015047 (code B ref 53534); Thu, 27 Jan 2022 02:24:01 +0000 Original-Received: (at 53534) by debbugs.gnu.org; 27 Jan 2022 02:23:10 +0000 Original-Received: from localhost ([127.0.0.1]:53895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCuRJ-0003ud-GB for submit@debbugs.gnu.org; Wed, 26 Jan 2022 21:23:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33188) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nCuRI-0003uQ-0Q for 53534@debbugs.gnu.org; Wed, 26 Jan 2022 21:23:08 -0500 Original-Received: from [2001:470:142:3::e] (port=46594 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCuR8-0005uD-9j; Wed, 26 Jan 2022 21:23:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=PHS3k+CExqNPuBLxlgPlgaWMMUI2JXH9YWZ2D4vR7S8=; b=PJ6LBsTJo1u7RH2WMuE1 UnAhkDPaHbXXE07pvJctaQgQ6pS0GtvxfVxkLwxYxqtYI7s00cYY0FRIZrPEuxUsq/Qejpj7TQJc4 P92yZuDnJ9EAk6hIkE1gKGPyAVKF/9BZkyRtvHgB76Rd2NK20+2Wss9L8lb99fexFRDmgAvnrW90o 4o5f4U45nXpk5BOw//mEoCW9bRRWjYdnvVH+innsq1aAJEtDyDeKuaYpxKiszlW9Z3pZTPzXi2vHH IGES8N4v8wUcu23oHcjq0Ee9sfIX5QREdgDVPSKk9cqYqVu80L7odaJ+fmuF7OFIKC4oFRi8TqheK 0I9VexIgEJlgfA==; Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1nCuR4-0002b5-Nt; Wed, 26 Jan 2022 21:22:54 -0500 X-Spook: BMDO Qaddafi CANSLO quarter Facility CDMA virus Matamoros X-Ran: Ddc0G!pyo]ZYn=wFz,#cCbB(-1Utre`UFgy\x'(kKGE+n`WyV"#y)]p09O:lo:k?|M X-Hue: brightmagenta X-Attribution: GM In-Reply-To: (Glenn Morris's message of "Wed, 26 Jan 2022 13:02:19 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:225319 Archived-At: Here's a patch to use cp -R in preference to tar+chown+chmod. --- i/Makefile.in +++ w/Makefile.in @@ -576,6 +576,12 @@ INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@ ## https://lists.gnu.org/r/emacs-devel/2007-10/msg01672.html ## Needs to be the user running install, so configure can't set it. +## This is only used if we use tar to copy rather than cp -R. +## I think it is buggy, eg if you 'su' to root LOGNAME etc do not change, +## whereas if you 'su -' they do. Since the need to run chown only +## occurs for root, it would probably be better to only chown if UID +## is 0, and just chown to root. But the entire tar branch is +## obsolete and unlikely to be used in practice. set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ `(id -u) 2> /dev/null`; do \ [ -n "$${installuser}" ] && break ; \ @@ -613,12 +619,15 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ ## but not add subdirs.el to them. This was a strange halfway house. ## Nowadays we do not create non-default directories. -## Note that we use tar instead of plain old cp -R/-r because the latter -## is apparently not portable (even in 2012!). +## Historically this used tar, possibly due to portability concerns with cp -R. +## Using tar introduces issues with ownership and permission when run as root. +## Hence the chowns and chmods, the latter because "umask 022; tar +## ..." is not guaranteed to do the right thing if we are root and tar +## is preserving source permissions. +## +## It seems highly likely that cp -R works on all relevant platforms, +## so in 2022 the tar fallback is probably unnecessary. Refs: ## https://lists.gnu.org/r/emacs-devel/2012-05/msg00278.html -## I have no idea which platforms Emacs supports where cp -R does not -## work correctly, and therefore no idea when tar can be replaced. -## See also these comments from 2004 about cp -r working fine: ## https://lists.gnu.org/r/autoconf-patches/2004-11/msg00005.html install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} umask 022 && $(MKDIR_P) "$(DESTDIR)$(includedir)" @@ -637,9 +646,14 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} rm -rf "$${dest}" ; \ umask 022; ${MKDIR_P} "$${dest}" ; \ printf 'Copying %s to %s...\n' "$$dir" "$$dest" ; \ - (cd $${dir}; tar -chf - . ) \ - | (cd "$${dest}"; umask 022; \ - tar -xvf - && cat > /dev/null) || exit 1; \ + dotar= ; \ + destbase=`echo "$${dest}" | sed 's,/[^/]*$$,,'`; \ + if ! cp -R "$$dir" "$$destbase"; then \ + dotar=t; \ + (cd $${dir}; tar -chf - . ) \ + | (cd "$${dest}"; umask 022; \ + tar -xvf - && cat > /dev/null) || exit 1; \ + fi; \ if [ "$${dir}" = "${srcdir}/etc" ]; then \ rm -f "$${dest}/DOC"* ; \ rm -f "$${dest}/refcards"/*.aux "$${dest}/refcards"/*.dvi; \ @@ -648,7 +662,7 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} fi; \ (cd "$${dest}" || exit 1; \ for subdir in `find . -type d -print` ; do \ - chmod a+rx $${subdir} ; \ + [ -z "$$dotar" ] || chmod a+rx $${subdir} ; \ rm -f $${subdir}/.gitignore ; \ rm -f $${subdir}/.arch-inventory ; \ rm -f $${subdir}/.DS_Store ; \ @@ -660,7 +674,8 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} [ "$${dir}" != "${srcdir}/etc" ] && \ rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \ done ); \ - find "$${dest}" -exec chown $${installuser} {} ';' ;\ + [ -z "$$dotar" ] || \ + find "$${dest}" -exec chown $${installuser} {} ';' ;\ done -rm -f "$(DESTDIR)${lispdir}/subdirs.el" umask 022; $(srcdir)/build-aux/update-subdirs "$(DESTDIR)${lispdir}" @@ -678,9 +693,7 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} } -chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS} -## The above chmods are needed because "umask 022; tar ..." is not -## guaranteed to do the right thing; eg if we are root and tar is -## preserving source permissions. +## Final chmod above is not needed if we did not use tar. ## Note that install-arch-indep deletes and recreates the entire ## installed etc/ directory, so we need it to run before this does.