public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/gdb] gdb-17.2-rebase-f44: Backport [gdb/cli] Don't assert on empty string for core-file
Date: Sun, 28 Jun 2026 00:00:22 GMT	[thread overview]
Message-ID: <178260482233.1.10839368845875051648.rpms-gdb-4cf9f20b1224@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/gdb
            Branch : gdb-17.2-rebase-f44
            Commit : 4cf9f20b122482a09c714e72109aaa56762ebf45
            Author : Bruno Larsen <blarsen@redhat.com>
            Date   : 2021-09-23T15:24:45-03:00
            Stats  : +78/-1 in 5 file(s)
            URL    : https://src.fedoraproject.org/rpms/gdb/c/4cf9f20b122482a09c714e72109aaa56762ebf45?branch=gdb-17.2-rebase-f44

            Log:
            Backport [gdb/cli] Don't assert on empty string for core-file
(Tom de Vries)

Resolves: RHBZ 1916516

---
diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include
index 219586e..bd3f136 100644
--- a/_gdb.spec.Patch.include
+++ b/_gdb.spec.Patch.include
@@ -403,3 +403,7 @@ Patch097: gdb-rhbz1971096-glibc2.34-4.patch
 # Backport patch adjusting test gdb.mi/mi-sym-info.exp (RH BZ 1971096).
 Patch098: gdb-rhbz1971096-glibc2.34-5.patch
 
+#[gdb/cli] Don't assert on empty string for core-file
+#(Tom de Vries)
+Patch099: gdb-rhbz1916516-pathstuffs132-internal-error.patch
+

diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include
index b089bb1..dddd45a 100644
--- a/_gdb.spec.patch.include
+++ b/_gdb.spec.patch.include
@@ -96,3 +96,4 @@
 %patch096 -p1
 %patch097 -p1
 %patch098 -p1
+%patch099 -p1

diff --git a/_patch_order b/_patch_order
index a767691..15fcc3c 100644
--- a/_patch_order
+++ b/_patch_order
@@ -96,3 +96,4 @@ gdb-rhbz1971096-glibc2.34-2.patch
 gdb-rhbz1971096-glibc2.34-3.patch
 gdb-rhbz1971096-glibc2.34-4.patch
 gdb-rhbz1971096-glibc2.34-5.patch
+gdb-rhbz1916516-pathstuffs132-internal-error.patch

diff --git a/gdb-rhbz1916516-pathstuffs132-internal-error.patch b/gdb-rhbz1916516-pathstuffs132-internal-error.patch
new file mode 100644
index 0000000..bb0cd9d
--- /dev/null
+++ b/gdb-rhbz1916516-pathstuffs132-internal-error.patch
@@ -0,0 +1,67 @@
+From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
+From: Bruno Larsen <blarsen@redhat.com>
+Date: Wed, 22 Sep 2021 12:22:44 -0300
+Subject: gdb-rhbz1916516-pathstuffs132-internal-error.patch
+
+;;[gdb/cli] Don't assert on empty string for core-file
+;;(Tom de Vries)
+
+With current gdb we run into:
+...
+$ gdb -batch '' ''
+: No such file or directory.
+pathstuff.cc:132: internal-error: \
+  gdb::unique_xmalloc_ptr<char> gdb_abspath(const char*): \
+  Assertion `path != NULL && path[0] != '\0'' failed.
+...
+
+Fix this by skipping the call to gdb_abspath in core_target_open in the
+empty-string case, such that we have instead:
+...
+$ gdb -batch '' ''
+: No such file or directory.
+: No such file or directory.
+$
+...
+
+Tested on x86_64-linux.
+
+gdb/ChangeLog:
+
+2021-08-30  Tom de Vries  <tdevries@suse.de>
+
+	PR cli/28290
+	* gdb/corelow.c (core_target_open): Skip call to gdb_abspath in the
+	empty-string case.
+
+gdb/testsuite/ChangeLog:
+
+2021-08-30  Tom de Vries  <tdevries@suse.de>
+
+	PR cli/28290
+	* gdb.base/batch-exit-status.exp: Add gdb '' and gdb '' '' tests.
+
+diff --git a/gdb/corelow.c b/gdb/corelow.c
+--- a/gdb/corelow.c
++++ b/gdb/corelow.c
+@@ -446,7 +446,8 @@ core_target_open (const char *arg, int from_tty)
+     }
+ 
+   gdb::unique_xmalloc_ptr<char> filename (tilde_expand (arg));
+-  if (!IS_ABSOLUTE_PATH (filename.get ()))
++  if (strlen (filename.get ()) != 0
++      && !IS_ABSOLUTE_PATH (filename.get ()))
+     filename = gdb_abspath (filename.get ());
+ 
+   flags = O_BINARY | O_LARGEFILE;
+diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp
+--- a/gdb/testsuite/gdb.base/batch-exit-status.exp
++++ b/gdb/testsuite/gdb.base/batch-exit-status.exp
+@@ -76,3 +76,7 @@ test_exit_status 1 "-batch -x $good_commands -x $bad_commands" \
+     "-batch -x good-commands -x bad-commands"
+ test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" \
+     "-batch -x good-commands -ex \"set not-a-thing 4\""
++
++set no_such_re ": No such file or directory\\."
++test_exit_status 1 "-batch \"\"" $no_such_re
++test_exit_status 1 "-batch \"\" \"\"" [multi_line $no_such_re $no_such_re]

diff --git a/gdb.spec b/gdb.spec
index c86647f..010207b 100644
--- a/gdb.spec
+++ b/gdb.spec
@@ -37,7 +37,7 @@ Version: 10.2
 
 # The release always contains a leading reserved number, start it at 1.
 # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
-Release: 7%{?dist}
+Release: 8%{?dist}
 
 License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
 # Do not provide URL for snapshots as the file lasts there only for 2 days.
@@ -1143,6 +1143,10 @@ fi
 %endif
 
 %changelog
+* Wed Sep 22 2021 Bruno Larsen <blarsen@redhat.com> - 10.2-8
+- Backport "[gdb/cli] Don't assert on empty string for core-file"
+  (Tom de Vries)
+
 * Tue Sep 21 2021 Peter Robinson <pbrobinson@fedoraproject.org> 10.2-7
 - Use guile 2.2 (rhbz #1901353)
 

                 reply	other threads:[~2026-06-28  0:00 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=178260482233.1.10839368845875051648.rpms-gdb-4cf9f20b1224@fedoraproject.org \
    --to=blarsen@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