From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2619 invoked by alias); 27 Jun 2017 21:30:51 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41372 Received: (qmail 29594 invoked from network); 27 Jun 2017 21:30:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f173.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.173):SA:0(0.5/5.0):. Processed in 1.423839 secs); 27 Jun 2017 21:30:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.173 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=qA1l1QJxpjObT0Kx1iwg3hFL2EUhiaiIA0+hkJKz8IY=; b=SYn9WcHw0Qi9ExWueQcjojFfubytIeNQOIuCKudgYBO7teuv9nAILh6umAtiQmqwLF gSOLRlR6fwGzYH2ibxqsbGWPKpNLMELHL7J6nY1OsTtmp9ubl8Y2Rwb289iWuehXu/Or dUG/L3oD1BdEMo3cJD5vTPoes2SGq6aqvjMsAybIPLYflkyiRtYIlULzD0bHa+TSThHG qjrEaOTlZB/MGOSsci++CKOZcSFdYVaDP50l+MQHgOg5ETyrxN1HlMIIvtdUD9c65mUr hXn8Njq1RRjH0WouMcsRaK3CA91kOud62De/AETSmfshrHkgTAuVuY4/+CAyLn+nEVzv SwMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=qA1l1QJxpjObT0Kx1iwg3hFL2EUhiaiIA0+hkJKz8IY=; b=kK/IO+64+0nIkwmYwFzeFwcDH5H65B+IGaQ4TyCIzgOiknyfuV3UeTN3ab33f+MYLT 9wjjiL6yc/8TZ9fcueGeWCOGQP9/DA6zKGGv4cqN+omoKLN1d+mm0YJVhE9O65gqcDBc JucFORav6l46YxVUge/wBBONthkzzlTqRkIqImeLhm3ULGdArKG5UmXtRk1uoGrPhmml IPAsShhdVqNbOQWaRt7kvFrpXs7xAoUaE0lSh9gF0Ltg586rv0+t2OG8pMMX7EAeW1MC 3WwCLcHKOBQB5Eq9efD27waqRP42+kVsegZs97dX4mxe7atiAa/J+02prJp93NEKuoC+ DPjg== X-Gm-Message-State: AKS2vOxSHooJ2LeGH0mMXKhW6enNzlWzK6IdMOzCnwt8ugSi4ypCmMHd dZwDhSbkbE89Py8MDVI= X-Received: by 10.176.23.3 with SMTP id j3mr4532222uaf.128.1498599042731; Tue, 27 Jun 2017 14:30:42 -0700 (PDT) From: Bart Schaefer Message-Id: <170627143044.ZM8536@torch.brasslantern.com> Date: Tue, 27 Jun 2017 14:30:44 -0700 In-Reply-To: <2ad57c3b-f0c4-afd9-4789-ae50571c63e1@gmail.com> Comments: In reply to "Guillaume Maudoux (Layus)" "Race condition when setting TERM{,INFO{,_DIRS}}" (Jun 27, 3:52pm) References: <2ad57c3b-f0c4-afd9-4789-ae50571c63e1@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Race condition when setting TERM{,INFO{,_DIRS}} MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 27, 3:52pm, Guillaume Maudoux (Layus) wrote: } } 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. What does "the same" mean here? } 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 ? There aren't threads, but there are signal handlers. We've had issues before where certain terminal emulators will fire signals at the process they are controlling at, shall we say, inopportune times. However, the most common culprit would be the WINCH (window size change) signal, which we block before reading init scripts and don't unblock until ZLE is started up. And I don't know why ncurses would be doing anything at all during /etc/zshenv, except via init_term() from those assignments if ncurses is what provides tgetent(). Normally init_term() is called when setupvals() imports TERM from the environment, which happens before zshenv is read. This would also be the case for import of TERMINFO_DIRS, although if that happens before TERM has been imported, init_term() will do nothing. One thing I have noticed is that if TERMINFO_DIRS is in the environment when the shell first starts up, tgetent() looks *only* there for $TERM. Conversely if the shell starts and then TERMINFO_DIRS is assigned later, the default definitions are also consulted. I don't know if that means that TERMINFO_DIRS is ignored when a default has already been loaded. This might differ in various tgetent() implementations. Also, the "can't find terminal definition for ..." message is suppressed during import from the environment. If TERM is not in the environment Aside: Does it matter that terminfodirssetfn() does not check (x == 0) except before adding to the environment?