On 1/10/24 13:58, Bruno Haible wrote:

   - POSIX violation or not? Is it valid to pass lines with missing fields
     to 'join', according to POSIX [1]?

It should be valid, yes. POSIX 'join' defers to POSIX 'sort' for the definition of fields, and POSIX 'sort' says missing fields should be treated as empty.

Then, would it make sense to document it in the GNU Autoconf manual? [2]

Sure, I installed the attached patch to the Autoconf manual.

From 141956bbd8675bd4e02d1c6a1576e9f3792c94a4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Wed, 10 Jan 2024 17:45:34 -0800
Subject: [PATCH] doc: mention join bug
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* doc/autoconf.texi: Mention BSD ‘join’ bug
<https://lists.gnu.org/r/bug-gnulib/2024-01/msg00028.html>.
---
 doc/autoconf.texi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index f3ef59e2..bcd35195 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -19705,6 +19705,11 @@ On NetBSD, @command{join -a 1 file1 file2} mistakenly behaves like
 @command{join -a 1 -a 2 1 file1 file2}, resulting in a usage warning;
 the workaround is to use @command{join -a1 file1 file2} instead.
 
+On some circa-2020 BSD-based systems @command{join} mishandles inputs
+with missing fields.  For example, an empty line is not treated as
+containing an empty join field.  As a workaround, input lines should
+always have a join field.
+
 On platforms with the BusyBox tools, the @command{join} command is
 entirely missing.  As a workaround, you can simulate special cases of the
 @command{join} command using an @command{awk} script.  For an example,
-- 
2.43.0

Reply via email to