From patchwork Tue Sep 18 21:49:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 29452 Received: (qmail 57151 invoked by alias); 18 Sep 2018 21:49:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 57134 invoked by uid 89); 18 Sep 2018 21:49:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MIME_BASE64_BLANKS autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Sep 2018 21:49:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1537307374; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=F9We6OKav90Aq5vgsoyPrhSAnw/OYTCRZOM9V9sigm0=; b=SKjU3hKKvwgX0kY27pWHjiSYxj2bNYgcmAWlvGTBN+ZiDZVSWttGvoFehKJEwLuQ 9Y1fjAZyYAbNPK6l8J+rqkM1Dm0ZnAmD8xjioMAfqAvQ7VO+I7OUa90M7MT3clzt K+fnPddXvxoWgwUh8VSqZ+aW+l9k1QP8t19z9SZRH6w=; Received: from ESESBMB504.ericsson.se (Unknown_Domain [153.88.183.117]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id B9.76.21978.EE271AB5; Tue, 18 Sep 2018 23:49:34 +0200 (CEST) Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 18 Sep 2018 23:49:32 +0200 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB505.ericsson.se (153.88.183.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Tue, 18 Sep 2018 23:49:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F9We6OKav90Aq5vgsoyPrhSAnw/OYTCRZOM9V9sigm0=; b=UKAVmLo2RcTrVo+Pg8WNCsbguQ5m6EhAy+B72xVmb+ukItopxKpJVlKtNUkidQFyQky05ZzUbOTLOZM4oPhhm/+gZt47PoWB5YCFqR3bqry5fjUlpiXVQP2ObCtD97G5WHIjxa7YSHDkCMbBKtmbhcyRR5dIkpfMdiG4BhWIN38= Received: from BYAPR15MB2390.namprd15.prod.outlook.com (52.135.198.30) by BYAPR15MB2469.namprd15.prod.outlook.com (52.135.200.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.14; Tue, 18 Sep 2018 21:49:29 +0000 Received: from BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::6d9c:234d:1f2f:cecd]) by BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::6d9c:234d:1f2f:cecd%4]) with mapi id 15.20.1143.017; Tue, 18 Sep 2018 21:49:29 +0000 From: Simon Marchi To: Tom Tromey CC: "gdb-patches@sourceware.org" , "Sergio Durigan Junior" Subject: Re: [PATCH] Carry the gnulib getcwd backport as a patch Date: Tue, 18 Sep 2018 21:49:29 +0000 Message-ID: References: <20180918212124.5851-1-simon.marchi@ericsson.com> <875zz2scyg.fsf@tromey.com> In-Reply-To: <875zz2scyg.fsf@tromey.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Content-ID: <3754C427542E914F9611781821D6BDD5@namprd15.prod.outlook.com> MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com X-IsSubscribed: yes On 2018-09-18 05:38 PM, Tom Tromey wrote: > Simon> +# Apply our local patches. > Simon> +apply_patches () > > This should probably be "apply_patch" since it just applies a single patch. Oops yes. > Also there is a comment near the top of update-gnulib.sh: > > # This script will also make a number of other verifications: > # . The gnulib version (it should match $GNULIB_COMMIT_SHA1). > # . The correct versions of the auto-tools that are used to > # regenerate the various scripts and Makefiles are on the PATH. > > I think an addition here about updating the patches would be good. I don't think it belongs in that particular list, because it's not a verification, but I've added a note in that header. Does this look good? From f0584664629ee49216e5b56810c9eec83f9f3a8f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 18 Sep 2018 16:42:53 -0400 Subject: [PATCH] Carry the gnulib getcwd backport as a patch Commit e2fc52e7457 ("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. 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. --- gdb/gnulib/configure | 18 ++++- ...-Use-system-s-getcwd-when-cross-comp.patch | 69 +++++++++++++++++++ gdb/gnulib/update-gnulib.sh | 14 ++++ 3 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 gdb/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch -- 2.19.0 diff --git a/gdb/gnulib/configure b/gdb/gnulib/configure index 5fd52d45ac9..dc6c5b66573 100644 --- a/gdb/gnulib/configure +++ b/gdb/gnulib/configure @@ -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. */ diff --git a/gdb/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch b/gdb/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch new file mode 100644 index 00000000000..1d8cdf6b901 --- /dev/null +++ b/gdb/gnulib/patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch @@ -0,0 +1,69 @@ +From a7447215cdc492a077732420a3f0db6d48b34d51 Mon Sep 17 00:00:00 2001 +From: Sergio Durigan Junior +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 + Date: Thu Aug 23 21:13:19 2018 +0200 + + getcwd: Add cross-compilation guesses. + +gdb/ChangeLog: +2018-09-10 Sergio Durigan Junior + + 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 + diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh index 327b37f3a3c..90b103e50a2 100755 --- a/gdb/gnulib/update-gnulib.sh +++ b/gdb/gnulib/update-gnulib.sh @@ -27,6 +27,8 @@ # . The gnulib version (it should match $GNULIB_COMMIT_SHA1). # . The correct versions of the auto-tools that are used to # regenerate the various scripts and Makefiles are on the PATH. +# +# It will also apply any local patches to gnulib we carry at the time. # The list of gnulib modules we are importing in GDB. IMPORTED_GNULIB_MODULES="\ @@ -158,6 +160,18 @@ if [ $? -ne 0 ]; then exit 1 fi +# Apply our local patches. +apply_patch() +{ + patch -p3 -f -i "$1" + if [ $? -ne 0 ]; then + echo "Failed to apply some patches. Aborting." + exit 1 + fi +} + +apply_patch "patches/0001-Fix-PR-gdb-23558-Use-system-s-getcwd-when-cross-comp.patch" + # Regenerate all necessary files... aclocal -Iimport/m4 && autoconf &&