From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28927 invoked by alias); 19 Mar 2018 23:42:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23263 Received: (qmail 5223 invoked by uid 1010); 19 Mar 2018 23:42:53 -0000 X-Qmail-Scanner-Diagnostics: from mx.spodhuis.org 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(94.142.241.89):SA:0(-4.2/5.0):. Processed in 9.343751 secs); 19 Mar 2018 23:42:53 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: zsh-workers+phil.pennock@spodhuis.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201802; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2OE5U/ll6mSHiGRxAJsj92ophs1squE5G+/FaetJ68A=; b=qAJWvVNNi8RmPw+jx2c1S3HDmH 6ZgmDWnmrMHI3WF9jkoWaZsQEdKIGJP4vJG0XZUu+ETfco/AzBiNJ9p7RUtSIT2HIuLlga7rKz8Xp wbEEcZVWyb/ETscQLP88HBp4e9Qjk5TAM0F2TarWaYKDIGFyCa2MW4+H/S28EfrTbkIMiYaqejyJy q7kdgayx/1WKhW63gl10JMcPAgdl; Date: Mon, 19 Mar 2018 19:42:36 -0400 From: Phil Pennock To: "Vadim A. Misbakh-Soloviov" Cc: "" Subject: Re: zsh/pcre module breakage when static build enabled Message-ID: <20180319234236.GA43407@tower.spodhuis.org> References: <3073701.qdQlh9y6XZ@note> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3073701.qdQlh9y6XZ@note> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc On 2018-03-20 at 00:33 +0700, Vadim A. Misbakh-Soloviov wrote: > Hi there! > I faced strange issue: when I build zsh-5.4.2 as static binary and trying to > run, for example, something like that: > > > $ [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH > > I'm getting following errors: > > > zsh: module `zsh/pcre' has no such feature: `C:pcre-match' > > zsh: -pcre-match not available for regex > > Although, when I rebuild it as dynamically linked binary, pcre starting to > work again > > I think, it looks like a bug. > > Isn't it a way to fix it? I went to do a static build on FreeBSD (Darwin doesn't support static binaries) and when grabbing the configure options used by Ports, saw this: ## Some modules can only be built as a shared library. ## If you enable STATIC, you may get strange errors if you, a script, ## or a plugin tries to use the regex module. So someone has spotted this before, but I don't recall seeing a bug-report. I can't reproduce on FreeBSD, as long as I follow the 'INSTALL' instructions. Perhaps it could be made easier to build static shells with variant features, but I suspect that if you really need a static shell, you can follow the steps. Here's what I did. Did you perhaps skip the '--disable-dynamic' option, required to change how zsh manages the module code when building statically? ----------------8< zsh build zsh-5.4.2-198-gd2350a1e8 >8---------------- git pull git status git clean -fxd ./.preconfig CPPFLAGS=-I/usr/local/include LDFLAGS='-L/usr/local/lib -static' \ ./configure --prefix=$HOME/uzsh \ --enable-etcdir=/etc --with-tcsetpgrp \ --enable-function-subdirs --enable-maildir-support \ --enable-multibyte --enable-zsh-mem --enable-zsh-secure-free \ --sysconfdir=/usr/local \ --disable-dynamic --with-term-lib="tinfow tinfo" \ --enable-pcre --disable-dynamic sed -Ei '' -e '/name=zsh\/(pcre|regex)/s/link=no/link=static/' config.modules make && make install.bin install.modules install.fns ~/uzsh/bin/zsh -f tower% [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH zsh: failed to compile regex: invalid character class tower% setopt rematchpcre tower% [[ 'foo→bar' =~ .([^[:ascii:]]). ]]; print $MATCH o→b ----------------8< zsh build zsh-5.4.2-198-gd2350a1e8 >8---------------- I just rebuilt with 'config.modules' saying 'link=static' for every module except: zsh/attr, zsh/db/gdbm, zsh/example I can use the resulting shell quite well. It even functions well enough to display my prompt, which is a bit of a torture test. :^) -Phil