public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] fix-dup-patch: Backport upstream commit d2cc16cd7fc, fixing fileio.exp failures
Date: Thu, 23 Jul 2026 18:36:28 GMT [thread overview]
Message-ID: <178483178819.1.1534173830351997284.rpms-gdb-230a79f98f9c@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/gdb
Branch : fix-dup-patch
Commit : 230a79f98f9c848640864bf7e8f5c73c1a62ee85
Author : Kevin Buettner <kevinb@redhat.com>
Date : 2026-02-25T00:26:13-07:00
Stats : +103/-0 in 5 file(s)
URL : https://src.fedoraproject.org/rpms/gdb/c/230a79f98f9c848640864bf7e8f5c73c1a62ee85?branch=fix-dup-patch
Log:
Backport upstream commit d2cc16cd7fc, fixing fileio.exp failures
---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 2ab3a30..caecc50 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -52,3 +52,8 @@ Patch009: gdb-rhbz2435950-skip-revert.patch
# (RHBZ 2413405).
Patch010: gdb-rhbz2413405-gcore-unreadable-pages.patch
+# Backport of upstream commit d2cc16cd7fc from Jan Vrany fixing
+# FAILs in gdb.base/fileio.exp caused by macro expansion of path
+# components (e.g. "linux") in OUTDIR.
+Patch011: gdb-fileio-test-fixes.patch
+
diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index 6295406..a409d9f 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -8,3 +8,4 @@
%patch -p1 -P008
%patch -p1 -P009
%patch -p1 -P010
+%patch -p1 -P011
diff --git a/_patch_order b/_patch_order
index fa89f55..f5a24f6 100644
--- a/_patch_order
+++ b/_patch_order
@@ -8,3 +8,4 @@ gdb-rhbz2403580-misplaced-symtabs.patch
gdb-index-generation-fixes.patch
gdb-rhbz2435950-skip-revert.patch
gdb-rhbz2413405-gcore-unreadable-pages.patch
+gdb-fileio-test-fixes.patch
diff --git a/gdb-fileio-test-fixes.patch b/gdb-fileio-test-fixes.patch
new file mode 100644
index 0000000..6d09fda
--- /dev/null
+++ b/gdb-fileio-test-fixes.patch
@@ -0,0 +1,91 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Kevin Buettner <kevinb@redhat.com>
+Date: Wed, 25 Feb 2026 00:20:16 -0700
+Subject: gdb-fileio-test-fixes.patch
+
+;; Backport of upstream commit d2cc16cd7fc from Jan Vrany fixing
+;; FAILs in gdb.base/fileio.exp caused by macro expansion of path
+;; components (e.g. "linux") in OUTDIR.
+
+gdb/testsuite: fix FAILs in fileio.exp
+
+I'm experiencing intermittent FAILs in fileio.exp when running on (my)
+CI:
+
+ FAIL: gdb.base/fileio.exp: Open a file
+ FAIL: gdb.base/fileio.exp: Creating already existing file returns EEXIST
+ FAIL: gdb.base/fileio.exp: Open for write but no write permission returns EACCES
+ FAIL: gdb.base/fileio.exp: Writing to a file
+ ...
+
+The problem turned out to be the way the OUTDIR gets defined in fileio.c.
+The path is passed down "naked" and turned into string by STRINGIFY macro.
+
+However, if the path happens to contain name of unrelated pre-existing
+C macro, this macro gets expanded during the "stringification", resulting
+in (likely) different path than used in fileio.exp and therefore causing
+failures.
+
+For example, if the GDB is compiled and tested in directory
+
+ /var/lib/jenkins/workspace/binutils-gdb/build/x86_64-linux-gnu
+
+then fileio.c is compiled with
+
+ -DOUTDIR_=/var/lib/jenkins/workspace/binutils-gdb/build/x86_64-linux-gnu/gdb/testsuite/outputs/gdb.base/fileio
+
+But because there's also C macro named "linux" defined to 1, the resulting
+OUTDIR is actually:
+
+ /var/lib/jenkins/workspace/binutils-gdb/build/x86_64-1-gnu/gdb/testsuite/outputs/gdb.base/fileio
+
+This commit fixes this by defining the OUTDIR as string literal in first
+place (similarly to how it was done prior commit cc91060) and updating
+quote_for_host to handle strings that themselves contains quote (").
+
+Tested on x86_64-linux by running all tests using quote_for_host with
+both target board unix and host/target board local-remote-host-native.
+
+Approved-By: Tom Tromey <tom@tromey.com>
+
+diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c
+--- a/gdb/testsuite/gdb.base/fileio.c
++++ b/gdb/testsuite/gdb.base/fileio.c
+@@ -73,10 +73,6 @@ static const char *strerrno (int err);
+
+ #define STRING "Hello World"
+
+-#define STRINGIFY(s) STRINGIFY_(s)
+-#define STRINGIFY_(s) #s
+-#define OUTDIR STRINGIFY (OUTDIR_)
+-
+ static void stop (void) {}
+
+ /* A NULL string. We pass this to stat below instead of a NULL
+diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
+--- a/gdb/testsuite/gdb.base/fileio.exp
++++ b/gdb/testsuite/gdb.base/fileio.exp
+@@ -27,7 +27,7 @@ if {[is_remote host]} {
+
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable \
+- [list debug additional_flags=[quote_for_host -DOUTDIR_=$outdir/]]] != "" } {
++ [list debug additional_flags=[quote_for_host -DOUTDIR=\"$outdir/\"]]] != "" } {
+ untested "failed to compile"
+ return -1
+ }
+diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
+--- a/gdb/testsuite/lib/gdb.exp
++++ b/gdb/testsuite/lib/gdb.exp
+@@ -6150,9 +6150,9 @@ proc escape_for_host { str } {
+ proc quote_for_host { args } {
+ set str [join $args]
+ if { [is_remote host] } {
+- set str [join [list {\"} $str {\"}] ""]
++ set str [join [list {\"} [regsub -all {"} $str {\\\"}] {\"}] ""]
+ } else {
+- set str [join [list {"} $str {"}] ""]
++ set str [join [list {"} [regsub -all {"} $str {\"}] {"}] ""]
+ }
+ return $str
+ }
diff --git a/gdb.spec b/gdb.spec
index a35f3bf..6958684 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -932,6 +932,11 @@ fi
# endif scl
%changelog
+* Wed Feb 25 2026 Kevin Buettner <kevinb@redhat.com>
+- Backport upstream commit d2cc16cd7fc from Jan Vrany to fix
+ FAILs in gdb.base/fileio.exp caused by macro expansion of
+ path components in OUTDIR.
+
* Tue Feb 24 2026 Kevin Buettner <kevinb@redhat.com>
- Backport upstream commit c1da013915e from Kevin Buettner to fix
gcore failures caused by glibc 2.42 guard page changes (RHBZ 2413405).
reply other threads:[~2026-07-23 18:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=178483178819.1.1534173830351997284.rpms-gdb-230a79f98f9c@fedoraproject.org \
--to=kevinb@redhat.com \
--cc=git-commits@fedoraproject.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