~alpine/users

2 2

[alpine-user] Bug in busybox's sort -s ?

Details
Message ID
<6192349c-0136-40bb-3fd6-3e78441cc418@gmail.com>
Sender timestamp
1503281502
DKIM signature
missing
Download raw message
Hello,

I encountered strange result with "sort -s" on Alpine 3.6.2.
Wanted to check with you before filing a bug:

The following two commands (with and without -s) give different
result on alpine linux 3.6.2/amd64,
withg busybox v1.26.2 (2017-08-03 13:08:12 GMT):

  $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1
  A X 2
  A x 5
  a X 1

  $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1 -s
  A x 5
  A X 2
  a X 1

They give the same result (as they should) with
coreutil's, FreeBSD and OpenBSD's sort.

Strangely, I also get the correct same result
when building busybox on a Debian machine,
tried both the latest git and tag 1_26_2.

It's only on an Alpine VM that I get this discrepancy.

Any ideas?

Thanks!
 - assaf



---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Details
Message ID
<dc1b35b9-6906-8321-1843-9b23be8c731f@owasp.org>
In-Reply-To
<6192349c-0136-40bb-3fd6-3e78441cc418@gmail.com> (view parent)
Sender timestamp
1503296794
DKIM signature
missing
Download raw message
Please check you environment: remove all LC_* variables and set LANG=C
(or unset LANG), then try again.

Just my 2 pence
Achim

On 21.08.2017 04:11, Assaf Gordon wrote:
> Hello,
> 
> I encountered strange result with "sort -s" on Alpine 3.6.2.
> Wanted to check with you before filing a bug:
> 
> The following two commands (with and without -s) give different
> result on alpine linux 3.6.2/amd64,
> withg busybox v1.26.2 (2017-08-03 13:08:12 GMT):
> 
>   $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1
>   A X 2
>   A x 5
>   a X 1
> 
>   $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1 -s
>   A x 5
>   A X 2
>   a X 1
> 
> They give the same result (as they should) with
> coreutil's, FreeBSD and OpenBSD's sort.
> 
> Strangely, I also get the correct same result
> when building busybox on a Debian machine,
> tried both the latest git and tag 1_26_2.
> 
> It's only on an Alpine VM that I get this discrepancy.
> 
> Any ideas?
> 
> Thanks!
>  - assaf




---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Alexey Luchko <soulne4ny@gmail.com>
Details
Message ID
<CAF56u8rKMUDgt7VPUDMoRV3V39zfft=wOM-KFkLLv=3d4K35uA@mail.gmail.com>
In-Reply-To
<6192349c-0136-40bb-3fd6-3e78441cc418@gmail.com> (view parent)
Sender timestamp
1503308506
DKIM signature
missing
Download raw message
https://git.busybox.net/busybox/tree/coreutils/sort.c#n486
It uses qsort() that is not stable by default.  It could have been
made stable by adding line number to the comparison key, however there
is no evidence of any attempt for it.
https://git.busybox.net/busybox/tree/coreutils/sort.c#n125

Regargs
Alex


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)