emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#21880: closed (Possible bug in sort --check --key)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#21880: closed (Possible bug in sort --check --key)
Date: Wed, 11 Nov 2015 20:02:02 +0000

Your message dated Wed, 11 Nov 2015 13:01:07 -0700
with message-id <address@hidden>
and subject line Re: bug#21880: Possible bug in sort --check --key
has caused the debbugs.gnu.org bug report #21880,
regarding Possible bug in sort --check --key
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
21880: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21880
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Possible bug in sort --check --key Date: Wed, 11 Nov 2015 21:50:14 +0300 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
Hello!

In sort man page nothing told about working sort --check with '--key' option. IMHO this behaviour is strange:

This case is succeeded:

$ echo -e '1\t2\n1\t1' | LC_ALL=C sort --key=1b,1 --check --stable --field-separator=$'\t'

But this (without option '--stable') is failed:

$ echo -e '1\t2\n1\t1' | LC_ALL=C sort --key=1b,1 --check --field-separator=$'\t'
sort: -:2: disorder: 1  1

It seems to me both of situation is equal with relation of line key, why does the output is different?

Sincerely yours, Alexander K



--- End Message ---
--- Begin Message --- Subject: Re: bug#21880: Possible bug in sort --check --key Date: Wed, 11 Nov 2015 13:01:07 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
tag 21880 notabug
thanks

On 11/11/2015 11:50 AM, Alexander Kindyakov wrote:
> Hello!
> 
> In sort man page nothing told about working sort --check with '--key'
> option. IMHO this behaviour is strange:

Thanks for the report.

> 
> This case is succeeded:
> 
>  $ echo -e '1\t2\n1\t1' | LC_ALL=C sort --key=1b,1 --check --stable
> --field-separator=$'\t'

'echo -e' is not portable; better is using printf.

Let's see what sort was looking at here (it's a shame that --check and
--debug can't be used at the same time; but seeing _what_ gets sorted
without --check explains whether --check will succeed):

$ printf '1\t2\n1\t1\n' | LC_ALL=C sort --debug -k1b,1 -s -t$'\t'
sort: using simple byte comparison
1>2
_
1>1
_
$

So, in this version, you were checking JUST the first field, and nothing
else; among the portion of the line checked, everything was identical,
so --check has nothing to complain about.

> 
> But this (without option '--stable') is failed:
> 
> $ echo -e '1\t2\n1\t1' | LC_ALL=C sort --key=1b,1 --check
> --field-separator=$'\t'
> sort: -:2: disorder: 1  1

Again, look at the debug output:

$ printf '1\t2\n1\t1\n' | LC_ALL=C sort --debug -k1b,1 -t$'\t'
sort: using simple byte comparison
1>1
_
___
1>2
_
___
$

Notice that the removal of --stable behaves as if you had added another
--key=1 (that is, sort the ENTIRE line as a last-resort key); and now
that you have the entire line involved, --check can indeed see an
out-of-order difference in the input.

> 
> It seems to me both of situation is equal with relation of line key, why
> does the output is different?

The output differs because of your use of --stable.  Therefore, this is
not a bug in sort, and I'm closing this bug.  However, do feel free to
add further comments to this thread.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]