)]}'
{
  "commit": "31fa6221bf88accee782e2c93cb869eee5d4113c",
  "tree": "e87552b433e6a21f05609e3def1f733e861a5207",
  "parents": [
    "b0c6153ccfbbcf6c57f7eae2efbdea8019e0cba2"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Wed Oct 30 12:16:46 2024 +0000"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Nov 12 14:07:35 2024 +0000"
  },
  "message": "gdb/readline: don\u0027t get stuck thinking an EOF arrived\n\nIt was brought to my attention[1] that if a user makes use of Ctrl+d\nto quit from a secondary prompt (e.g. the prompt used to enter lines\nfor the \u0027commands\u0027 command) then GDB will start displaying some\nunexpected blank lines.  Here\u0027s an example:\n\n  Reading symbols from /tmp/hello.x...\n  (gdb) break main\n  Breakpoint 1 at 0x401198: file hello.c, line 18.\n  (gdb) commands\n  Type commands for breakpoint(s) 1, one per line.\n  End with a line saying just \"end\".\n  \u003equit\t\t\t# \u003c----------- Use Ctrl+d to quit here.\n  (gdb) show architecture\n\t\t\t# \u003c----------- This blank line is unexpected.\n  The target architecture is set to \"auto\" (currently \"i386:x86-64\").\n  (gdb)\n\nI\u0027ve marked up where I press \u0027Ctrl+d\u0027, and also the unexpected blank\nline.\n\nThis issue will only happen if bracketed-paste-mode is in use.  If\nthis has been disabled (e.g. in ~/.inputrc) then this issue will not\noccur.\n\nThe blank line is not just emitted for the \u0027show architecture\u0027\ncommand.  The blank line is actually caused by an extra \u0027\\n\u0027 character\nemitted by readline after it has gathered a complete line of input,\nand so will occur for any command.\n\nThe problem is caused by readline getting \"stuck\" in a state where it\nthinks that an EOF has just been delivered.  This state is set when\nthe \u0027Ctrl+d\u0027 does deliver an EOF, but then this state is never fully\nreset.  As a result, every time readline completes a line, it thinks\nthat the line was completed due to an EOF and so adds an extra \u0027\\n\u0027\ncharacter.\n\nObviously the real fix for this issue is to patch readline, and I do\nhave a patch for that[2], however, version 8.2 of readline has been\nreleased, and contains this issue.  As such, if GDB is linked against\nthe system readline, and that system readline is 8.2, then we can\nexpect to see this issue.\n\nThere\u0027s a pretty simple, and cheap workaround that we can add to GDB\nthat will mitigate this issue.\n\nI propose that we add this workaround to GDB.  If/when the readline\npatch is accepted then I\u0027ll back-port this to our local readline copy,\nbut retaining the workaround will be harmless, and will make GDB play\nnicer with system readline libraries (version 8.2).\n\n[1] https://inbox.sourceware.org/gdb-patches/34ef5438-8644-44cd-8537-5068e0e5e434@redhat.com\n[2] https://lists.gnu.org/archive/html/bug-readline/2024-10/msg00014.html\n\nReviewed-By: Keith Seitz \u003ckeiths@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "e7556f71453d995b599da86f1c384fe6f24ded82",
      "old_mode": 33188,
      "old_path": "gdb/event-top.c",
      "new_id": "38a59ba55a095586c7cdb627a42d258712909949",
      "new_mode": 33188,
      "new_path": "gdb/event-top.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4061e6a15c11e026167c7021678794ab67a6ca9e",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/readline-commands-eof.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c823118c875f5a2334881be4281c5484a128a4e5",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/readline-commands-eof.exp"
    },
    {
      "type": "modify",
      "old_id": "a438a101fc9cdfed2916e7c7643405a4a1c4cce3",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/lib/gdb.exp",
      "new_id": "410f99e3350ff5fd8bf573efdb744eed0e030f57",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/lib/gdb.exp"
    }
  ]
}
