On Tue, Feb 17, 2015 at 10:56 PM, Ulf Magnusson <[email protected]> wrote: > On Tue, Feb 17, 2015 at 10:48 PM, Chet Ramey <[email protected]> wrote: >> On 2/17/15 4:25 PM, Ulf Magnusson wrote: >> >>> Is the following comment in terminal.c outdated by the way? >>> >>> /* If we're being compiled as part of bash, set the environment >>> variables $LINES and $COLUMNS to new values. Otherwise, just >>> do a pair of putenv () or setenv () calls. */ >>> if (rl_change_environment) >>> sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth); >>> >>> It doesn't seem to matter whether readline is compiled as part of bash. >> >> It does, actually. The trick is the traditional Unix linker behavior. >> There is a source file in the readline library that provides a set of >> functions whose names begin with sh_ (shell.o): >> >> sh_single_quote (string) >> sh_set_lines_and_columns (lines, cols) >> sh_get_env_value (varname) >> sh_get_home_dir () >> sh_unset_nodelay_mode (fd) >> >> When readline is linked as part of bash, those are resolved from the >> bash binary, since those names are already known to the linker when it >> processes libreadline.a. All of the functions in that file are resolved >> from bash, so the file is not linked in. When readline is not being >> compiled as part of bash, those functions are not known when processing >> libreadline.a, and are resolved using the built-in readline versions, so >> the symbols in shell.o are used. > > Ah, that clarifies it. :) > >> If you don't want readline to modify $LINES and $COLUMNS, set >> rl_change_environment to 0. >> >> Chet > > Yeah, I'll do that. > > Thanks, > Ulf
Re. rl_change_environment, there's this in the source: /* If this is non-zero, readline will set LINES and COLUMNS in the environment when it handles SIGWINCH. */ int rl_change_environment = 1; However, afaics readline does not update LINES and COLUMNS in the SIGWINCH handler, at least not in the non-bash case. Is there some motivation for this (besides being a bit tricky due to putenv/setenv not being async-signal-safe)? The comment seems a little misleading either way. :) (I've set rl_catch_signals and rl_catch_sigwinch to 0 already to decouple things further from ncurses, but got curious.) /Ulf _______________________________________________ Bug-readline mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-readline
