Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Sergio Durigan Junior <sergiodj@redhat.com>
Subject: [PATCH 2/2] Fix PR gdb/23558: Use system's 'getcwd' when cross-compiling GDB
Date: Mon, 10 Sep 2018 17:12:00 -0000	[thread overview]
Message-ID: <20180910171205.18594-3-sergiodj@redhat.com> (raw)
In-Reply-To: <20180910171205.18594-1-sergiodj@redhat.com>

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-03  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR gdb/23555
	PR gdb/23558
	* gnulib/import/m4/getcwd-path-max.m4: Add cross-compilation
	guesses.
---
 gdb/ChangeLog                           |  7 +++++++
 gdb/gnulib/import/m4/getcwd-path-max.m4 | 20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fdeaf8a302..aaa4590ae6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
 2018-09-10  Sergio Durigan Junior  <sergiodj@redhat.com>
 
 	Revert:
diff --git a/gdb/gnulib/import/m4/getcwd-path-max.m4 b/gdb/gnulib/import/m4/getcwd-path-max.m4
index 2531ccff65..90bbc77dea 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.17.1


  reply	other threads:[~2018-09-10 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 17:12 [PATCH 0/2] Revert gnulib update and backport gnulib fix for PR gdb/23558 Sergio Durigan Junior
2018-09-10 17:12 ` Sergio Durigan Junior [this message]
2018-09-10 17:17 ` [PATCH 1/2] Revert "Update gnulib to current upstream master" Sergio Durigan Junior
2018-09-10 17:39 ` [PATCH 0/2] Revert gnulib update and backport gnulib fix for PR gdb/23558 Kevin Buettner
2018-09-10 17:55   ` Sergio Durigan Junior
2018-09-10 18:14     ` Tom Tromey
2018-09-10 18:24       ` Sergio Durigan Junior
2018-09-12 22:42       ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180910171205.18594-3-sergiodj@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox