Re: [PATCH v2 2/7] Add "help news"

Simon Marchi
2020-07-06T14:18:45Z

On 2020-07-06 10:06 a.m., Simon Marchi wrote:
> On 2020-06-23 9:20 a.m., Tom Tromey wrote:
>> This adds a "help news" subcommand, which simply dumps the NEWS file.
>> The NEWS file is now installed.
>
> (1) I first tried "help news" with GDB in its build directory without passing
> --data-directory, expecting it to fail, just to see how it would fail. It
> says:
>
> (gdb) help news
> could not open the NEWS file: No such file or directory.
>
> Maybe this message should say which path it's trying to open. If this
> happens, the cause would probably be a broken GDB installation, and it
> would be useful to know where is GDB looking for that file.
>
> (2) When trying to "make install", I get this error:
>
> $ make install DESTDIR=/tmp/install
> ...
> make[4]: *** No rule to make target 'install-news', needed by 'install-only'. Stop.
>
> Indeed, the install-news target is used but does not exist.
>
> (3) Since we look for the NEWS file at <data-directory>/NEWS, I presume it won't
> work when running GDB in its build directory, either with
>
> ./gdb --data-directory=data-directory
>
> or
>
> make run
>
> since the NEWS file is not there. It's not a big deal, but if you think of an easy
> way to make it work, it would be nice. Can we put a symlink from data-directory/NEWS
> to NEWS?
>
> (4) I tried what I mentioned just above and I get some sanitizer error:
>
> $ ./gdb -q -nx --data-directory=data-directory
> (gdb) help news
> /home/simark/src/binutils-gdb/gdb/cli/cli-decode.c:1214:60: runtime error: index 1024 out of bounds for type 'char [1024]'
>
> Not sure if it's ASan or UBSan.
>
> Simon
>

Oh and:

(5) the way "help news" is implemented means the "news" part is not discoverable
through tab-completion. I'm not super familiar with how commands work, but would
it work if you registered the "help news" command as a separate command?

That's not a deal-breaker, but I thought I would mention it just in case it's easy
to fix.

Simon