GNU bug report logs -
#9236
Fwd: Join
Previous Next
Reported by: "David Gast" <dgast <at> csulb.edu>
Date: Thu, 4 Aug 2011 04:16:02 UTC
Severity: normal
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 9236 <at> debbugs.gnu.org (full text, mbox):
Jim Meyering wrote:
> Jim Meyering wrote:
> ...
>> I started looking at this, and among other things saw
>> a diagnostic that mentioned "file 1", which would do
>> much better to mention the actual file name, so embarked.
>> Here's a preliminary patch (not even a decent ChangeLog entry
>> and the join test still needs to be updated):
>>
>> $ printf '%s\n' b a c > in
>> $ ./join --check-order in in
>> ./join: in:2: is not sorted: a
>> [Exit 1]
>>
>> Subject: [PATCH] join: FIXME: check: print both file name and line number
>>
>> ---
>> src/join.c | 29 +++++++++++++++++++----------
>> 1 files changed, 19 insertions(+), 10 deletions(-)
>
> Here's a much better patch.
>
>>From 2e4ca5100dcc3229e9937c48aed3dc475bb507ea Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering <at> redhat.com>
> Date: Thu, 4 Aug 2011 19:31:50 +0200
> Subject: [PATCH] join: with --check-order print offending file name, line
> number and data
>
> * src/join (g_names): New global (was main's "names").
> (main): Update all uses of "names".
> (line_no[2]): New globals.
> (get_line): Increment after reading each line.
> (check_order): Print the standard "file name:line_no: " prefix
> as well as the offending line when reporting disorder.
> Here is a sample old/new comparison:
> -join: file 1 is not in sorted order
> +join: in:4: is not sorted: contents-of-line-4
> * tests/misc/join: Change the two affected tests to expect
> the new diagnostic.
> Add new tests for more coverage: mismatch in file 2,
> two diagnostics, zero-length out-of-order line.
> * NEWS (Improvements): Mention it.
Nearly forgot.
While coding, I considered the case of an
offending line with no trailing newline,
but hadn't tested it. Just folded this in:
diff --git a/tests/misc/join b/tests/misc/join
index d6528da..a892a10 100755
--- a/tests/misc/join
+++ b/tests/misc/join
@@ -214,6 +214,12 @@ my @tv = (
"$prog: chkodr-5d.1:3: is not sorted: \n" .
"$prog: chkodr-5d.2:3: is not sorted: \n"],
+# Similar, but make it so each offending line has no newline.
+['chkodr-5e', '',
+ ["a\nx\no", "b\ny\np"], "", 1,
+ "$prog: chkodr-5e.1:3: is not sorted: o\n" .
+ "$prog: chkodr-5e.2:3: is not sorted: p\n"],
+
# Without order check, both inputs out of order and some lines
# unpairable. This is NOT supported by the GNU extension. All that
# we really care about for this test is that the return status is
This bug report was last modified 13 years and 290 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.