commit bfe9c573a9e376323929c80b2b71c59727fab0cc (HEAD -> master, origin/master, origin/HEAD)
Author: Chet Ramey <
chet.ramey@case.edu>
Date: Fri Nov 17 16:06:49 2023 -0500
a description of the bug
> Variable: rl_hook_func_t * rl_startup_hook
> If non-zero, this is the address of a function to call just before readline prints the first prompt.
rl_startup_hook is called before readline prints every prompt.
a recipe for recreating the bug reliably
--- rl.c ----
#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
static int
startup () {
printf("startup\n");
return 0;
}
int
main (int c, char **v)
{
char *temp;
rl_startup_hook = startup;
while ((temp = readline ("> ")) != 0) {
printf ("%s\n", temp);
}
exit (0);
}
----
$ ./rl
startup
> foo
foo
startup
> bar
bar
startup
...
a fix for the bug if you have one!
add a flag variable to check the first call.