zsh-workers
 help / color / mirror / code / Atom feed
* Race condition when setting TERM{,INFO{,_DIRS}}
@ 2017-06-27 13:52 Guillaume Maudoux (Layus)
  2017-06-27 21:30 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Guillaume Maudoux (Layus) @ 2017-06-27 13:52 UTC (permalink / raw)
  To: zsh-workers

Hi,

Half a year after submitting a patch to treat TERMINFO_DIRS like 
TERMINFO and TERM, I now see a race condition in handling these vars.

Zsh handles these variables specially because ncurses looks for them in 
the environment of the current process.
To make changes to these variables apply to zsh itself, they are 
exported to the process environment, where ncurses can find them.

But there is a possible race condition between exporting these vars 
(setenv) and refreshing the ncurses handle (getent).
In my case, when TERMINFO_DIRS is set from /etc/zshenv, the new value is 
ignored by ncurses.
The same applies to the subsequent TERM=$TERM in /etc/zshenv.

However, if I add a delay before TERM=$TERM, then the TERMINFO_DIRS 
update is seen, and the terminal is properly detected.

Could it be that there are threads involved in zsh ?
This seems really weird because the code looks sequential.

Any hint welcome.

-- Layus


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-30 17:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 13:52 Race condition when setting TERM{,INFO{,_DIRS}} Guillaume Maudoux (Layus)
2017-06-27 21:30 ` Bart Schaefer
2017-06-30 11:49   ` Guillaume Maudoux (Layus)
2017-06-30 12:05     ` getenv() caching bug Guillaume Maudoux (Layus)
2017-06-30 17:33       ` Thomas Dickey
2017-06-30 12:34     ` Race condition when setting TERM{,INFO{,_DIRS}} Mikael Magnusson
2017-06-30 13:36       ` Guillaume Maudoux (Layus)

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).