Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] zstat: double metafy fix
- X-seq: zsh-workers 43823
- From: ivan tkachenko <me@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] zstat: double metafy fix
- Date: Wed, 14 Nov 2018 12:07:26 +0800
- Authentication-results: mxback2j.mail.yandex.net; dkim=pass header.i=@ratijas.tk
- 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=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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- <<EOF
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/*
RUN echo "ru_RU.UTF-8 UTF-8" >> /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, ")");
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author