Closed zcutlip closed 2 years ago
The problem appears to be it looking for pages under ~/.tldrc/tldr/pages/osx
. I don't have that directory:
$ ls -1 ~/.tldrc
date
tldr-main/
Under ~/.tldrc/tldr-main/pages
, I have the various platforms, including 'osx'.
So there appears to be two bugs:
opendir()
in parse_tldrlist()
(parser.c:275), it's not checked that the call was successful. In this case opendir()
returns NULL which results in the segfault later.For (1), it looks like TLDR_DIR
and TLDR_EXT
are getting mixed up at various places, but I wasn't able to sort out what was intended
For (2), the following prevents the segfault, although listing still fails:
parse_tldrlist(char const *path, char const *platform)
{
...
directory = opendir(fullpath);
if(!directory)
{
perror("opendir()");
return 1;
}
...
return 0;
}
Creating a symlink is a workaround:
$ ln -s ~/.tldrc/tldr-main ~/.tldrc/tldr
Ah, looks like this PR introduced the regression: https://github.com/tldr-pages/tldr-c-client/pull/66
Reproduction Rate
3 / 3 times
Steps to Reproduce
run
tldr --list
Result
Segmentation fault
Expected Result
A list of all entires in the database
Additional Information
tldr: 1.4.2 macOS 12.1 (12C52)
tldr --list
results in a segfault.tldr -l
results intldr: option '-l' is ambiguous
(which may be a separate bug)I haven't reset the cache or any other artifacts in case they are useful in reproducing.
Full crash report attached. Translated report from Console.app below:
tldr-2021-12-21-194826.ips.zip