From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7210 invoked by alias); 9 Nov 2016 14:47:20 -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: 39889 Received: (qmail 17977 invoked from network); 9 Nov 2016 14:47:20 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f67.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(74.125.82.67):SA:0(0.0/5.0):. Processed in 0.463911 secs); 09 Nov 2016 14:47:20 -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.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: layus.on@gmail.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 74.125.82.67 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=grJC2uKARLNy6KurAM5uvhE1+6S6avVg66+i9NH3Gvo=; b=aiBIHyetAsQypMBNgNZ6l25iQCAX4676ci3N/ZNSd/XNwS98zXCYZKh+/A1KkDQnnz pSck3qZo0mjWTz5q30W18OFM85tNH8rIf1Dcepuu5cmYB6350+PoytGg+2Ydt/VGxYkd FAeuUIkwhfI+mOqPs1xgevJbkKIs7V2qZBp4guRmRhFQGL8wHm2vHmaI9aKS8fdLmEWy +g3P1T4Rud8/0xMaMw5F2AEYfJyFRjjAZJisaVH0/mL/cr/DAK7+wvnyU4KHKSyP4oHG 29EyxpJMCxqzvaSXNKgA+PVSfs1dREko9FqwC9vp84yOfMmjBGXNC7aDxWzv6YoqstN+ Pkmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=grJC2uKARLNy6KurAM5uvhE1+6S6avVg66+i9NH3Gvo=; b=m69JcQJE2rlccCJzQmmiCnJGvGyKopuM+C71wQuUmY08bCkHrBQq7mI6v/5qEFHX2T JAuawfl6murKj95u2uk2f4+XCW6i0EFjb0HNUo5NaIn2GHAM70nQK82aFBx616LL6kyz Ht9U8wkfhCiZxWtoK8FkInNB/RDoLnt/EPx3ihbf/hH1vYzpnYvNGce41wzrP5MO1K9+ QmbBNvNQhJp6jHEfIRa1saxAcA4aGKeRxSeYV3ExBNt59Ptij1SBn4SOiReo3J+Iajay /ELUKhWHeudLkxPeqDXqe2GLQiZHWRS6/9jVsVQ2f7bQlEDw7amrm7x5SS51zIlks4Q2 gXlw== X-Gm-Message-State: ABUngveeamcMFs3H/Br53HKse4wKUhGvz11gDPXPDABt3EM3DiSj8ROo8ia/SEkKnSsRaw== X-Received: by 10.28.8.202 with SMTP id 193mr590719wmi.101.1478702831997; Wed, 09 Nov 2016 06:47:11 -0800 (PST) Subject: Re: [PATCH] make TERMINFO_DIRS variable special To: zsh-workers@zsh.org References: <20161108202651.22527-1-layus.on@gmail.com> From: "Guillaume Maudoux (Layus)" Message-ID: Date: Wed, 9 Nov 2016 15:47:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161108202651.22527-1-layus.on@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit I realize that this patch needs some introduction. First, it is the logical follow-up of commit c59e19cd774a9c5fb658a4b538ab505d608820a5 Author: Peter Stephenson Date: Tue May 10 15:40:32 2011 +0000 29191 (Danek) and 29203 (with fixes): make TERMINFO variable special. Second, there has been discussion on the mailing list about his before. The general idea is that terminfo look for these varibales via getenv(), To pass them correctly, we need to export them to our own environment. The term update is just a nice extra feature avoiding the TERM=$TERM trick. See discussion about this in [1] Third, there has already been an update for this issue in fish[2]. Bash seems unaffected by this issue, but I have no idea why... Finally, this arises from an issue in the nixpkgs tracker, at [3]. I am not aware of the review/accept policy for patches. Could you tell me if this one has any chance to get merged ? Regards Guillaume Maudoux, aka layus. [1] http://www.zsh.org/mla/workers/2011/threads.html#00626 [2] https://github.com/fish-shell/fish-shell/commit/53e865b65434fa9ec12afc11a076aec244cd3c43#diff-4f6a3b01f66a27bdc0739167d1aed5a5 [3] https://github.com/NixOS/nixpkgs/issues/19785 Le 08/11/16 à 21:26, Guillaume Maudoux a écrit : > --- > Doc/Zsh/params.yo | 15 +++++++++++---- > Src/params.c | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 42 insertions(+), 4 deletions(-) > > diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo > index c7d84b9..728fc21 100644 > --- a/Doc/Zsh/params.yo > +++ b/Doc/Zsh/params.yo > @@ -1485,10 +1485,17 @@ take effect. > ) > vindex(TERMINFO) > item(tt(TERMINFO) )( > -A reference to a compiled description of the terminal, used by the > -`terminfo' library when the system has it; see manref(terminfo)(5). > -If set, this causes the shell to reinitialise the terminal, making > -the workaround `tt(TERM=$TERM)' unnecessary. > +A reference to a directory containing the compiled description of > +terminals, used by the `terminfo' library when the system has it; see > +manref(terminfo)(5). If set, this causes the shell to reinitialise the > +terminal, making the workaround `tt(TERM=$TERM)' unnecessary. > +) > +vindex(TERMINFO_DIRS) > +item(tt(TERMINFO_DIRS) )( > +An array (colon-separated list) of paths to be searched for a compiled > +description of the terminal, used by the `terminfo' library when the system has > +it; see manref(terminfo)(5). If set, this causes the shell to reinitialise the > +terminal, making the workaround `tt(TERM=$TERM)' unnecessary. > ) > vindex(TIMEFMT) > item(tt(TIMEFMT))( > diff --git a/Src/params.c b/Src/params.c > index 19a8c29..92b8ac1 100644 > --- a/Src/params.c > +++ b/Src/params.c > @@ -87,6 +87,7 @@ char *ifs, /* $IFS */ > *postedit, /* $POSTEDIT */ > *term, /* $TERM */ > *zsh_terminfo, /* $TERMINFO */ > + *zsh_terminfodirs, /* $TERMINFO_DIRS */ > *ttystrname, /* $TTY */ > *pwd; /* $PWD */ > > @@ -208,6 +209,8 @@ static const struct gsu_scalar term_gsu = > { termgetfn, termsetfn, stdunsetfn }; > static const struct gsu_scalar terminfo_gsu = > { terminfogetfn, terminfosetfn, stdunsetfn }; > +static const struct gsu_scalar terminfodirs_gsu = > +{ terminfodirsgetfn, terminfodirssetfn, stdunsetfn }; > static const struct gsu_scalar wordchars_gsu = > { wordcharsgetfn, wordcharssetfn, stdunsetfn }; > static const struct gsu_scalar ifs_gsu = > @@ -283,6 +286,7 @@ IPDEF2("histchars", histchars_gsu, PM_DONTIMPORT), > IPDEF2("HOME", home_gsu, PM_UNSET), > IPDEF2("TERM", term_gsu, PM_UNSET), > IPDEF2("TERMINFO", terminfo_gsu, PM_UNSET), > +IPDEF2("TERMINFO_DIRS", terminfodirs_gsu, PM_UNSET), > IPDEF2("WORDCHARS", wordchars_gsu, 0), > IPDEF2("IFS", ifs_gsu, PM_DONTIMPORT | PM_RESTRICTED), > IPDEF2("_", underscore_gsu, PM_DONTIMPORT), > @@ -4511,6 +4515,33 @@ terminfosetfn(Param pm, char *x) > term_reinit_from_pm(); > } > > +/* Function to get value of special parameter `TERMINFO_DIRS' */ > + > +/**/ > +char * > +terminfodirsgetfn(UNUSED(Param pm)) > +{ > + return zsh_terminfodirs ? zsh_terminfodirs : dupstring(""); > +} > + > +/* Function to set value of special parameter `TERMINFO_DIRS' */ > + > +/**/ > +void > +terminfodirssetfn(Param pm, char *x) > +{ > + zsfree(zsh_terminfodirs); > + zsh_terminfodirs = x; > + > + /* > + * terminfo relies on the value being exported before > + * we reinitialise the terminal. This is a bit inefficient. > + */ > + if ((pm->node.flags & PM_EXPORTED) && x) > + addenv(pm, x); > + > + term_reinit_from_pm(); > +} > /* Function to get value for special parameter `pipestatus' */ > > /**/