From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 7ab76c92 for ; Wed, 14 Nov 2018 04:18:39 +0000 (UTC) Received: (qmail 14525 invoked by alias); 14 Nov 2018 04:18:26 -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: List-Unsubscribe: X-Seq: 43823 Received: (qmail 25103 invoked by uid 1010); 14 Nov 2018 04:18:26 -0000 X-Qmail-Scanner-Diagnostics: from forward400o.mail.yandex.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(37.140.190.176):SA:0(-2.0/5.0):. Processed in 3.045811 secs); 14 Nov 2018 04:18:26 -0000 X-Envelope-From: me@ratijas.tk X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ratijas.tk; s=mail; t=1542168446; bh=Ht69PCSRCSU9tDgOzvUFgWBlVKmhcfe5tDKdQ4I87AY=; h=From:To:Subject:Date:Message-Id; b=gTTZ4DMnCjS77EY4EoYHE9qn5o4hdHYeGaoaiz3zDfGYx+wKmV83RTk2mW3yhZzln XF7kT0AZeciZ9C32v3Gdnk7xcDaX/Ug76IHG+L/LaGL9r2nWFZeh/mpifdEj6xsu9G Fjo8AzlR9bbTN5Vl62ckEFvwkxheNdBGyHWyO/8o= Authentication-Results: mxback2j.mail.yandex.net; dkim=pass header.i=@ratijas.tk From: ivan tkachenko To: zsh-workers@zsh.org Subject: [PATCH] zstat: double metafy fix MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 14 Nov 2018 12:07:26 +0800 Message-Id: <76470381542168446@iva5-750e13568e4d.qloud-c.yandex.net> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 Hello, zsh team! I've found and successfully fixed a bug of double escaping formatted time in `zstat` builtin with the patch below. This bug only affects locales (or rather languages) other than english and only in some corner cases when characters' codepoints collide with zsh's "Meta" definition, however it was still pretty annoying, for example, for russian locale (ru_RU.UTF-8). Relevant issue in irrelevant repository on GitHub: https://github.com/supercrabtree/k/pull/87 I would also like to add tests for '%b' time formatting, but not sure which way to go, because such test requires some OS setup. For dockerized Debian:jessie steps to reproduce are as follow: 1) Build image from the following Dockerfile % docker build -t zsh . -f- <> /etc/locale.gen \ && locale-gen \ && update-locale ENV LANG=ru_RU.UTF-8 # zsh repository is assumed to be in the current directory ADD . /src WORKDIR /src RUN ./Util/preconfig # tons of options blindly copied from Arch Linux PKGBUILD for zsh # https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/zsh RUN ./configure --prefix=/usr \ --docdir=/usr/share/doc/zsh \ --htmldir=/usr/share/doc/zsh/html \ --enable-etcdir=/etc/zsh \ --enable-zshenv=/etc/zsh/zshenv \ --enable-zlogin=/etc/zsh/zlogin \ --enable-zlogout=/etc/zsh/zlogout \ --enable-zprofile=/etc/zsh/zprofile \ --enable-zshrc=/etc/zsh/zshrc \ --enable-maildir-support \ --with-term-lib='ncursesw' \ --enable-multibyte \ --enable-function-subdirs \ --enable-fndir=/usr/share/zsh/functions \ --enable-scriptdir=/usr/share/zsh/scripts \ --with-tcsetpgrp \ --enable-pcre \ --enable-cap \ --enable-zsh-secure-free RUN make && make install.bin install.modules CMD zsh EOF 2) Run inside the container the following command % zmodload zsh/stat && zstat -F '%b' . 3) See something like atime ноу� mtime сен All the best! diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c index 50a6a9bb2..ed75ea691 100644 --- a/Src/Modules/stat.c +++ b/Src/Modules/stat.c @@ -200,8 +200,6 @@ stattimeprint(time_t tim, long nsecs, char *outbuf, int flags) /* Where the heck does "40" come from? */ int len = ztrftime(oend, 40, timefmt, (flags & STF_GMT) ? gmtime(&tim) : localtime(&tim), nsecs); - if (len > 0) - metafy(oend, len, META_NOALLOC); if (flags & STF_RAW) strcat(oend, ")"); }