bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash 5.1: rl_readline_version = 0x801 (shouldn't it be 0x0801 ?)


From: Koichi Murase
Subject: Re: Bash 5.1: rl_readline_version = 0x801 (shouldn't it be 0x0801 ?)
Date: Tue, 8 Dec 2020 14:35:08 +0800

2020年12月8日(火) 10:04 Testing Purposes <raspberry.teststream@gmail.com>:
> Description:
>
>         I just built Bash 5.1 [...], I ran "gdb bash" and entered
> "print /x (int) rl_readline_version".  I get "0x801" as the output.
> If I do the same thing with Bash 5.0, I get "0x800".
>
> However, readline's online documentation at
> https://tiswww.case.edu/php/chet/readline/readline.html#SEC25 - and
> the "rltech.texi" file in the source code - both indicate that the
> version code format should be slightly different:

1) First of all, the value of `rl_readline_version' is embedded in
`bash' in the binary format, so it is meaningless to discuss whether
that binary data is `0xMMmm' or `0xMmm'.

2) Next, the manual talks about the literal contained in the macro
`RL_READLINE_VERSION' (defined in `lib/readline/readline.h'), which is
nothing to do with the binary value of `rl_readline_version'.  In
fact, the macro value of `RL_READLINE_VERSION' in `readline.h' is
correctly in the format of 0xMMmm as described in the manual.

  $ grep RL_READLINE_VERSION lib/readline/readline.h
  #define RL_READLINE_VERSION     0x0801          /* Readline 8.0 */

Because the information on the literal format used in the source code
is lost in the executable `bash', you need to explicitly specify the
format `0xMMmm' (i.e. %04x) to gdb like this:

(gdb) printf "%04x\n", (int) rl_readline_version
0x0801

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]