Carry the gnulib getcwd backport as a patch

Commit

  e2fc52e745 ("Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB")

backported some changes from a future gnulib version to our import.
However, this means that every time someone wants to change our gnulib
import (e.g. add a module), they must make sure not to include that
backported change.  It also means that someone running the
update-gnulib.sh script without changes will get some diffs and wonder
why.

Instead, I suggest we carry that backport as a patch applied by the
update-gnulib.sh script after running the import tool.  It will make it
clear what backport or local modification we have and should make
running update-gnulib.sh give a reproducible result.

There is a hunk in the configure file in this patch, this is because the
commit that backported the getcwd bits didn't include the re-generated
configure.

Note: you'll need this patch as well to get deterministic results:

  Generate aclocal-m4-deps.mk more deterministically and portably.
  https://sourceware.org/ml/gdb-patches/2018-09/msg00643.html

gdb/ChangeLog:

	* patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch:
	New file.
	* update-gnulib.sh: Apply patch.
	* configure: Re-generate.
This commit is contained in:
Simon Marchi 2018-09-18 23:40:55 -04:00 committed by Simon Marchi
parent 48219c6a06
commit b567ca638c
4 changed files with 103 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2018-09-18 Simon Marchi <simon.marchi@ericsson.com>
* patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch:
New file.
* update-gnulib.sh: Apply patch.
* configure: Re-generate.
2018-09-18 John Baldwin <jhb@FreeBSD.org>
* infcmd.c (_initialize_infcmd): Remove "running" from "info proc"

18
gdb/gnulib/configure vendored
View File

@ -17696,10 +17696,22 @@ else
# Arrange for deletion of the temporary directory this test creates.
ac_clean_files="$ac_clean_files confdir3"
if test "$cross_compiling" = yes; then :
case "$host_os" in
aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
*) gl_cv_func_getcwd_path_max=no;;
# Cross-compilation guesses:
case "$host_os" in
aix*) # On AIX, it has the AIX bug.
gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;;
gnu*) # On Hurd, it is 'yes'.
gl_cv_func_getcwd_path_max=yes ;;
linux* | kfreebsd*)
# On older Linux+glibc it's 'no, but it is partly working',
# on newer Linux+glibc it's 'yes'.
# On Linux+musl libc, it's 'no, but it is partly working'.
# On kFreeBSD+glibc, it's 'no, but it is partly working'.
gl_cv_func_getcwd_path_max='no, but it is partly working' ;;
*) # If we don't know, assume the worst.
gl_cv_func_getcwd_path_max=no ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

View File

@ -0,0 +1,69 @@
From a7447215cdc492a077732420a3f0db6d48b34d51 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Mon, 10 Sep 2018 12:52:04 -0400
Subject: [PATCH] Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling
GDB
This is a backport of a gnulib fix for the following bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=23558
The problem reported there is about the replacement of 'getcwd' when
cross-compiling GDB. With our current gnulib copy, the mechanism for
deciding whether to use the system's 'getcwd' or gnulib's version is
too simplistic and pessimistic, so when cross-compiling we always end
up using gnulib's version, which has a limitation: it cannot handle
the situation when the parent directory doesn't have read permissions.
The solution is to backport the following gnulib commit:
commit a96d2e67052c879b1bcc5bc461722beac75fc372
Author: Bruno Haible <bruno@clisp.org>
Date: Thu Aug 23 21:13:19 2018 +0200
getcwd: Add cross-compilation guesses.
gdb/ChangeLog:
2018-09-10 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/23555
PR gdb/23558
* gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
guesses.
---
gdb/gnulib/import/m4/getcwd-path-max.m4 | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gdb/gnulib/import/m4/getcwd-path-max.m4 b/gdb/gnulib/import/m4/getcwd-path-max.m4
index 2531ccff65c..90bbc77dea1 100644
--- a/gdb/gnulib/import/m4/getcwd-path-max.m4
+++ b/gdb/gnulib/import/m4/getcwd-path-max.m4
@@ -209,9 +209,21 @@ main ()
32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';;
*) gl_cv_func_getcwd_path_max=no;;
esac],
- [case "$host_os" in
- aix*) gl_cv_func_getcwd_path_max='no, it has the AIX bug';;
- *) gl_cv_func_getcwd_path_max=no;;
- esac])
+ [# Cross-compilation guesses:
+ case "$host_os" in
+ aix*) # On AIX, it has the AIX bug.
+ gl_cv_func_getcwd_path_max='no, it has the AIX bug' ;;
+ gnu*) # On Hurd, it is 'yes'.
+ gl_cv_func_getcwd_path_max=yes ;;
+ linux* | kfreebsd*)
+ # On older Linux+glibc it's 'no, but it is partly working',
+ # on newer Linux+glibc it's 'yes'.
+ # On Linux+musl libc, it's 'no, but it is partly working'.
+ # On kFreeBSD+glibc, it's 'no, but it is partly working'.
+ gl_cv_func_getcwd_path_max='no, but it is partly working' ;;
+ *) # If we don't know, assume the worst.
+ gl_cv_func_getcwd_path_max=no ;;
+ esac
+ ])
])
])
--
2.19.0

View File

@ -158,6 +158,18 @@ if [ $? -ne 0 ]; then
exit 1
fi
# Apply our local patches.
apply_patches ()
{
patch -p3 -f -i "$1"
if [ $? -ne 0 ]; then
echo "Failed to apply some patches. Aborting."
exit 1
fi
}
apply_patches "patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch"
# Regenerate all necessary files...
aclocal -Iimport/m4 &&
autoconf &&