NetBSD Problem Report #44232

From Wolfgang.Stukenbrock@nagler-company.com  Tue Dec 14 16:42:38 2010
Return-Path: <Wolfgang.Stukenbrock@nagler-company.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 51EE263B89C
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 14 Dec 2010 16:42:38 +0000 (UTC)
Message-Id: <20101214164229.250CF1E80CE@test-s0.nagler-company.com>
Date: Tue, 14 Dec 2010 17:42:29 +0100 (CET)
From: Wolfgang.Stukenbrock@nagler-company.com
Reply-To: Wolfgang.Stukenbrock@nagler-company.com
To: gnats-bugs@gnats.NetBSD.org
Subject: sort in unique numeric mode failes to distinquish 0 and <empty> in 5.1
X-Send-Pr-Version: 3.95

>Number:         44232
>Category:       bin
>Synopsis:       sort in unique numeric mode failes to distinquish 0 and <empty> in 5.1
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 14 16:45:00 +0000 2010
>Last-Modified:  Sun Feb 13 08:05:01 +0000 2011
>Originator:     Dr. W. Stukenbrock
>Release:        NetBSD 5.1
>Organization:
Dr. Nagler & Company GmbH
>Environment:


System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #0: Tue Aug 17 17:28:09 CEST 2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
	In NetBSD 5.1 the sort command does not distinquish between the number 0 (zero) and an empty field anymore.
	This problem doesn't appear in 5.0.2 or earlier releases.
	This will break some scripts - as it does for our installation script ....
>How-To-Repeat:
	do the following in a /bin/sh:

	ok_raid=" raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7 raid8 raid9 raid10 raid11 raid12 raid13 raid14 raid15"
	echo "$ok_raid" | tr ' ' '\n' | sort -u -k1.5n | tr '\n' ' '

	You will get " raid1 raid2 raid3 raid4 raid5 raid6 raid7 raid8 raid9 raid10 raid11 raid12 raid13 raid14 raid15".
	The "rail0" field is lost ...

	The sort command will take the first line containing 0 or <empty>.
	The command "echo 'raid0  raid1 raid2' | tr ' ' '\n' | sort -u -k1.5n | tr '\n' ' '" will drop the empty line
	resulting in "raid0 raid1 raid2", while "echo ' raid0 raid1 raid2' | tr ' ' '\n' | sort -u -k1.5n | tr '\n' ' '"
	gives " raid1 raid2".

	remark: I'm still in the install-root for amd64 achitecture where I've stumbled over this problem. But I'm shure the
		will be no difference in the behaviour of sort in the final installation.
		At least up to 5.0.2 there was no difference.
		We have an own setup-script to install NetBSD that will setup some predefined configurations.
>Fix:
	fix the sort command - sorry no time at the moment to have a look why this failes since 5.1.

>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/44232: sort in unique numeric mode failes to distinquish 0
 and <empty> in 5.1
Date: Sun, 13 Feb 2011 08:03:31 +0000

 On Tue, Dec 14, 2010 at 04:45:00PM +0000, Wolfgang.Stukenbrock@nagler-company.com wrote:
  > 	ok_raid=" raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7 raid8 raid9 raid10 raid11 raid12 raid13 raid14 raid15"
  > 	echo "$ok_raid" | tr ' ' '\n' | sort -u -k1.5n | tr '\n' ' '
  > 
  > 	You will get " raid1 raid2 raid3 raid4 raid5 raid6 raid7 raid8 raid9 raid10 raid11 raid12 raid13 raid14 raid15".
  > 	The "rail0" field is lost ...

 Here are a couple other somewhat related cases that also do the wrong thing:

    % ( echo 1e+600 ; echo 1e+800 ) | sort -un
    1e+600
    % ( echo 1e+10 ; echo 10e+9 ) | sort -un
    1e+10
    10e+9
    % 

 These problems affect current and not just 5.1. I guess they're a
 consequence of the fixes for various worse problems that appeared in
 5.0's sort...

 -- 
 David A. Holland
 dholland@netbsd.org

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.