tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [Patch] Switch nvi from bundled regex to tre

I've found that the previous patch for tre is somehow strange.

- create directory external/bsd/tre/doc BEFORE and,
- s/ for Makefile in that directory AFTER

applying tre.patch. Sorry for the inconvenience.


On 2017/11/15 12:11, Rin Okuyama wrote:
I've proposed to switch nvi from its bundled regex to tre for better
searching multibyte strings. For this purpose, I'm planning to make
tre usable from userland by installing headers etc.

This time, I've updated patch for tre (nvi parts are left untouched):

- change ABI and bump shlib_version

Currently, tre is compiled with TRE_USE_SYSTEM_REGEX_H, by which it
borrows definitions of flags etc from /usr/include/regex.h. This means
that ABI is somehow obscurely changed when libc's regex is modified.

To make things clear, I prefer not using TRE_USE_SYSTEM_REGEX_H and
defining everything necessary by its own. This brings about ABI changes
for libtre. This may not break everything, since it is used only by its
bundled utility, agrep(1), at this moment.

- Regen config.h and tm-config.h

In order to stop using TRE_USE_SYSTEM_REGEX_H, autotools stuffs are
regenerated. Also, according to external/bsd/tre/lib/Makefile, tre is
configured not to use alloca(3), but it is actually not. This change
also fixes it. (By this change some feature-test macros like
HAVE_INTTYPES_H are disabled. This seems strange, but these macros are
not actually referenced by sources.)

- Install documents and pkgconfig file

Any comments or suggestions are welcomed not only for this parts, but
also for changes for nvi.

Without any objections, I will commit them in the weekend.


On 2017/11/13 13:24, Rin Okuyama wrote:
By default, nvi uses its bundled regex which handles wchar_t strings.
However, it is still buggy for wide chars. On the other hand, tre also
provides wchar_t version of regex routines, that are "much better" as
I can see. For example, bracket expressions work fine at least for
ja_JP.UTF-8 and ja_JP.eucJP locales, that do not with the nvi-bundled
regex. I therefore propose to switch nvi from the bundled regex to tre.
For this purpose,

- Install headers from tre into /usr/include/tre, that may also be
  useful for 3rd party softwares.
  (Alternatively: do not install them, and nvi uses them directly from

- Build /rescue/vi (and other crunched-binary versions of nvi in
  miniroot) with USE_WIDECHAR == "no" in order not to link the extra
  library into them. Actually, this is not a real problem; they cannot
  handle wide chars even if they are built with USE_WIDECHAR == "yes",
  because locale stuffs in libc do not work for statically-linked

Any comments or suggestions?


Home | Main Index | Thread Index | Old Index