unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58080: 29.0.50; Don't hard-code path to pwd
@ 2022-09-25 19:09 Jonas Bernoulli
  2022-09-26  8:01 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Bernoulli @ 2022-09-25 19:09 UTC (permalink / raw)
  To: 58080

On Guix pwd isn't located at /bin/pwd, but that path is hard-coded in
various Makefile.in.  They deal with that by patching these files when
building the emacs package, but when building emacs manually, that isn't
convenient, as doing so would leave the working tree dirty, which makes
it harder to pull whenever one of these files changes.

Please consider making this customizable so one could use, for example:

  make PWDCMD=pwd install

I assume there is a reason why the PWD variable isn't being used and
that /bin/pwd is used because on some other OS using pwd would cause
issues.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-25 19:09 bug#58080: 29.0.50; Don't hard-code path to pwd Jonas Bernoulli
@ 2022-09-26  8:01 ` Eli Zaretskii
  2022-09-26  8:19   ` Gregory Heytings
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2022-09-26  8:01 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: 58080

> From: Jonas Bernoulli <jonas@bernoul.li>
> Date: Sun, 25 Sep 2022 21:09:41 +0200
> 
> On Guix pwd isn't located at /bin/pwd, but that path is hard-coded in
> various Makefile.in.  They deal with that by patching these files when
> building the emacs package, but when building emacs manually, that isn't
> convenient, as doing so would leave the working tree dirty, which makes
> it harder to pull whenever one of these files changes.
> 
> Please consider making this customizable so one could use, for example:
> 
>   make PWDCMD=pwd install
> 
> I assume there is a reason why the PWD variable isn't being used and
> that /bin/pwd is used because on some other OS using pwd would cause
> issues.

I don't see anything like PWDCMD in any of the GNU projects I have
here, but they do use just "pwd", not "/bin/pwd".  So maybe so should
we, and that would solve this particular problem as well?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26  8:01 ` Eli Zaretskii
@ 2022-09-26  8:19   ` Gregory Heytings
  2022-09-26  8:34     ` Andreas Schwab
  0 siblings, 1 reply; 9+ messages in thread
From: Gregory Heytings @ 2022-09-26  8:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 58080, Jonas Bernoulli


>
> I don't see anything like PWDCMD in any of the GNU projects I have here, 
> but they do use just "pwd", not "/bin/pwd".  So maybe so should we, and 
> that would solve this particular problem as well?
>

The difference is that /bin/pwd gives, unlike pwd, the "true" path 
(without symlinks).  Not sure if it's important enough to justify the use 
of /bin/pwd, though.  The use of /bin/pwd instead of pwd dates from 
8672a560f6 by RMS in 1994.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26  8:19   ` Gregory Heytings
@ 2022-09-26  8:34     ` Andreas Schwab
  2022-09-26 10:59       ` Gregory Heytings
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2022-09-26  8:34 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: Eli Zaretskii, Jonas Bernoulli, 58080

On Sep 26 2022, Gregory Heytings wrote:

> The difference is that /bin/pwd gives, unlike pwd, the "true" path
> (without symlinks).

Like pwd -P.  Though if $PWD is no longer accurate, pwd works like pwd -P.

> Not sure if it's important enough to justify the use of /bin/pwd,
> though.  The use of /bin/pwd instead of pwd dates from 8672a560f6 by
> RMS in 1994.

pwd -P didn't yet exist back then.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26  8:34     ` Andreas Schwab
@ 2022-09-26 10:59       ` Gregory Heytings
  2022-09-26 13:02         ` Gregory Heytings
  0 siblings, 1 reply; 9+ messages in thread
From: Gregory Heytings @ 2022-09-26 10:59 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, Jonas Bernoulli, 58080


>> The difference is that /bin/pwd gives, unlike pwd, the "true" path 
>> (without symlinks).
>
> Like pwd -P.  Though if $PWD is no longer accurate, pwd works like pwd 
> -P.
>

Yes, bash's built-in pwd assumes -L by default (which is what POSIX 
mandates), and coreutils' pwd assumes -P by default.  POSIX requires 
support for both -L and -P, so the safe fix here is to replace /bin/pwd by 
pwd -P.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26 10:59       ` Gregory Heytings
@ 2022-09-26 13:02         ` Gregory Heytings
  2022-09-26 20:10           ` Jonas Bernoulli
  0 siblings, 1 reply; 9+ messages in thread
From: Gregory Heytings @ 2022-09-26 13:02 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, Jonas Bernoulli, 58080

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]


Jonas, can you try the attached patch and tell us if it solves your 
problem?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Remove-hard-coded-path-to-pwd-in-Makefiles.patch --]
[-- Type: text/x-diff; name=Remove-hard-coded-path-to-pwd-in-Makefiles.patch, Size: 5907 bytes --]

From c1b85e6f9bc319353d86ceb5f6b7ec4de20f1eeb Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Mon, 26 Sep 2022 12:58:07 +0000
Subject: [PATCH] Remove hard-coded path to pwd in Makefiles.

* Makefile.in:
* lib-src/Makefile.in:
* nextstep/Makefile.in:
* nt/Makefile.in: Replace hard-coded calls to /bin/pwd by calls
to 'pwd -P'.  Fixes bug#58080.
---
 Makefile.in          | 24 ++++++++++++------------
 lib-src/Makefile.in  |  8 ++++----
 nextstep/Makefile.in |  2 +-
 nt/Makefile.in       |  4 ++--
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index c6a2e50959..741a4c5538 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -698,8 +698,8 @@ install-arch-indep:
 	  [ -d $${dir} ] || exit 1 ; \
 	  dest="$$1" ; shift ; \
 	  if [ -d "$${dest}" ]; then \
-	    exp_dest=`cd "$${dest}" && /bin/pwd`; \
-	    [ "$$exp_dest" = "`cd $${dir} && /bin/pwd`" ] && continue ; \
+	    exp_dest=`cd "$${dest}" && pwd -P`; \
+	    [ "$$exp_dest" = "`cd $${dir} && pwd -P`" ] && continue ; \
 	  else true; \
 	  fi; \
 	  rm -rf "$${dest}" ; \
@@ -755,8 +755,8 @@ install-arch-indep:
 install-etcdoc: src install-arch-indep
 	-unset CDPATH; \
 	umask 022; ${MKDIR_P} "$(DESTDIR)${etcdocdir}" ; \
-	exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; /bin/pwd`; \
-	if [ "`cd ./etc; /bin/pwd`" != "$$exp_etcdocdir" ]; \
+	exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; pwd -P`; \
+	if [ "`cd ./etc; pwd -P`" != "$$exp_etcdocdir" ]; \
 	then \
 	   docfile="DOC"; \
 	   printf 'Copying %s to %s ...\n' "etc/$$docfile" \
@@ -771,9 +771,9 @@ install-etcdoc:
 install-info: info
 	umask 022; ${MKDIR_P} "$(DESTDIR)${infodir}"
 	-unset CDPATH; \
-	thisdir=`/bin/pwd`; \
-	exp_infodir=`cd "$(DESTDIR)${infodir}" && /bin/pwd`; \
-	if [ "`cd ${srcdir}/info && /bin/pwd`" = "$$exp_infodir" ]; then \
+	thisdir=`pwd -P`; \
+	exp_infodir=`cd "$(DESTDIR)${infodir}" && pwd -P`; \
+	if [ "`cd ${srcdir}/info && pwd -P`" = "$$exp_infodir" ]; then \
 	  true; \
 	else \
 	   [ -f "$(DESTDIR)${infodir}/dir" ] || \
@@ -802,7 +802,7 @@ install-info:
 ## but not sure if portable.
 install-man:
 	umask 022; ${MKDIR_P} "$(DESTDIR)${man1dir}"
-	thisdir=`/bin/pwd`; \
+	thisdir=`pwd -P`; \
 	cd ${mansrcdir}; \
 	for page in *.1; do \
 	  test "$$page" = ChangeLog.1 && continue; \
@@ -869,7 +869,7 @@ install-etc:
 	  ${srcdir}/etc/emacs.service > $${tmp}; \
 	$(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \
 	rm -f $${tmp}
-	thisdir=`/bin/pwd`; \
+	thisdir=`pwd -P`; \
 	cd ${iconsrcdir} || exit 1; umask 022 ; \
 	for dir in */*/apps */*/mimetypes; do \
 	  [ -d $${dir} ] || continue ; \
@@ -906,8 +906,8 @@ uninstall:
 	-unset CDPATH; \
 	for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" "$(ELN_DESTDIR)" ; do 	\
 	  if [ -d "$${dir}" ]; then			\
-	    case `cd "$${dir}" ; /bin/pwd` in		\
-	      "`cd ${srcdir} ; /bin/pwd`"* ) ;;		\
+	    case `cd "$${dir}" ; pwd -P` in		\
+	      "`cd ${srcdir} ; pwd -P`"* ) ;;		\
 	      * ) rm -rf "$${dir}" ;;			\
 	    esac ;					\
 	    case "$${dir}" in				\
@@ -918,7 +918,7 @@ uninstall:
 	  fi ;						\
 	done
 	-rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}"
-	thisdir=`/bin/pwd`; \
+	thisdir=`pwd -P`; \
 	(info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \
 	 if cd "$(DESTDIR)${infodir}"; then \
 	   for elt in ${INFO_NONMISC} $${info_misc}; do \
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index cf4659fc2c..cfad3fc394 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -306,8 +306,8 @@ $(DESTDIR)${archlibdir}:
 	$(info $ )
 	$(info Installing utilities run internally by Emacs.)
 	umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}"
-	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
-	if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
+	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \
+	if [ "$$exp_archlibdir" != "`pwd -P`" ]; then \
 	  for file in ${UTILITIES}; do \
 	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file \
 	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
@@ -333,8 +333,8 @@ $(DESTDIR)${archlibdir}:
 	 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"
     endif
   endif
-	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
-	if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \
+	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \
+	if [ "$$exp_archlibdir" != "`cd ${srcdir} && pwd -P`" ]; then \
 	  for file in ${SCRIPTS}; do \
 	    $(INSTALL_SCRIPT) ${srcdir}/$$file \
 	      "$(DESTDIR)${archlibdir}/$$file" || exit; \
diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in
index 82bf13bc92..c1200f73fb 100644
--- a/nextstep/Makefile.in
+++ b/nextstep/Makefile.in
@@ -59,7 +59,7 @@ ${ns_appdir}:
 	${MKDIR_P} ${ns_appdir}
 	( cd ${srcdir}/${ns_appsrc} ; tar cfh - . ) | \
 	  ( cd ${ns_appdir} ; umask 022; tar xf - )
-	[ "`cd ${srcdir} && /bin/pwd`" = "`/bin/pwd`" ] || \
+	[ "`cd ${srcdir} && pwd -P`" = "`pwd -P`" ] || \
 	  ( cd ${ns_appsrc} ; tar cfh - . ) | \
 	    ( cd ${ns_appdir} ; umask 022; tar xf - )
 	touch ${ns_appdir}
diff --git a/nt/Makefile.in b/nt/Makefile.in
index c904e6d451..c5a9bf4363 100644
--- a/nt/Makefile.in
+++ b/nt/Makefile.in
@@ -163,8 +163,8 @@ $(DESTDIR)${archlibdir}:
 	@echo
 	@echo "Installing utilities run internally by Emacs."
 	umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
-	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
-	if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
+	exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P`; \
+	if [ "$$exp_archlibdir" != "`pwd -P`" ]; then \
 	  for file in ${UTILITIES}; do \
 	    $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
 	  done ; \
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26 13:02         ` Gregory Heytings
@ 2022-09-26 20:10           ` Jonas Bernoulli
  2022-09-26 20:33             ` Gregory Heytings
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Bernoulli @ 2022-09-26 20:10 UTC (permalink / raw)
  To: Gregory Heytings, Andreas Schwab; +Cc: Eli Zaretskii, 58080

Gregory Heytings <gregory@heytings.org> writes:

> Jonas, can you try the attached patch and tell us if it solves your 
> problem?
> From c1b85e6f9bc319353d86ceb5f6b7ec4de20f1eeb Mon Sep 17 00:00:00 2001
> From: Gregory Heytings <gregory@heytings.org>
> Date: Mon, 26 Sep 2022 12:58:07 +0000
> Subject: [PATCH] Remove hard-coded path to pwd in Makefiles.

That works on my end.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26 20:10           ` Jonas Bernoulli
@ 2022-09-26 20:33             ` Gregory Heytings
  2022-09-28 14:31               ` Gregory Heytings
  0 siblings, 1 reply; 9+ messages in thread
From: Gregory Heytings @ 2022-09-26 20:33 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: Andreas Schwab, Eli Zaretskii, 58080


>
> That works on my end.
>

Great, thanks!  I'll push it if nobody objects in the next couple of days.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#58080: 29.0.50; Don't hard-code path to pwd
  2022-09-26 20:33             ` Gregory Heytings
@ 2022-09-28 14:31               ` Gregory Heytings
  0 siblings, 0 replies; 9+ messages in thread
From: Gregory Heytings @ 2022-09-28 14:31 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: Andreas Schwab, Eli Zaretskii, 58080-done


>> That works on my end.
>
> Great, thanks!  I'll push it if nobody objects in the next couple of 
> days.
>

No further comments.  Pushed, and closing.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-28 14:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 19:09 bug#58080: 29.0.50; Don't hard-code path to pwd Jonas Bernoulli
2022-09-26  8:01 ` Eli Zaretskii
2022-09-26  8:19   ` Gregory Heytings
2022-09-26  8:34     ` Andreas Schwab
2022-09-26 10:59       ` Gregory Heytings
2022-09-26 13:02         ` Gregory Heytings
2022-09-26 20:10           ` Jonas Bernoulli
2022-09-26 20:33             ` Gregory Heytings
2022-09-28 14:31               ` Gregory Heytings

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).