Investigating a test failure of GNU grep on Alpine Linux 3.17
<https://lists.gnu.org/archive/html/grep-devel/2023-03/msg00003.html>
I found that the cause is:

The 'tr' program on Alpine Linux (origin: BusyBox 1.35.0) does not implement
the [x*n] argument syntax that POSIX mandates
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tr.html>

Here's a proposed patch to the Autoconf documentation, chapter "Limitations
of Usual Tools", to document this. We already documentation limitations in
BusyBox 'sed' and BusyBox 'join' in the same chapter.


>From daee95145afac43c083a50c5d9f17283338737fb Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 3 Mar 2023 14:32:13 +0100
Subject: [PATCH] Document limitation of BusyBox tr.

BusyBox 1.35.0 tr, which is shipped with Alpine Linux 3.17, does not support
the POSIX [x*n] syntax.

* doc/autoconf.texi (Limitations of Usual Tools): Document limitation of 'tr'
from BusyBox.
---
 doc/autoconf.texi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index a37d70de..7fb4370f 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -20373,6 +20373,20 @@ $ @kbd{echo abc | coreutils/tr bc d}
 add
 @end example
 
+On platforms with the BusyBox tools, @command{tr} does not support the
+@code{[@var{x}*@var{n}]} option syntax.
+
+@example
+$ @kbd{echo abc | tr 'abcd' '[A*4]'}
+[A*
+$ @kbd{echo abc | coreutils/tr 'abcd' '[A*4]'}
+AAA
+$ @kbd{echo xyz | tr 'a-z' '[A*]'}
+]]]
+$ @kbd{echo xyz | coreutils/tr 'a-z' '[A*]'}
+AAA
+@end example
+
 Posix requires @command{tr} to operate on binary files.  But at least
 Solaris @command{/usr/ucb/tr} and @command{/usr/bin/tr} silently discard
 @code{NUL} in the input prior to doing any translation.  When using
-- 
2.34.1

Reply via email to