From owner-freebsd-bugs@FreeBSD.ORG Wed Feb 26 14:40:01 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6CBBBB3 for ; Wed, 26 Feb 2014 14:40:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A72641038 for ; Wed, 26 Feb 2014 14:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s1QEe10x066636 for ; Wed, 26 Feb 2014 14:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s1QEe14e066635; Wed, 26 Feb 2014 14:40:01 GMT (envelope-from gnats) Resent-Date: Wed, 26 Feb 2014 14:40:01 GMT Resent-Message-Id: <201402261440.s1QEe14e066635@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Shayan Pooya Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B753A09 for ; Wed, 26 Feb 2014 14:31:14 +0000 (UTC) Received: from newred.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 46D721FC0 for ; Wed, 26 Feb 2014 14:31:14 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by newred.freebsd.org (8.14.7/8.14.7) with ESMTP id s1QEVDnY042575 for ; Wed, 26 Feb 2014 14:31:13 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.7/8.14.7/Submit) id s1QEVDxK042543; Wed, 26 Feb 2014 14:31:13 GMT (envelope-from nobody) Message-Id: <201402261431.s1QEVDxK042543@cgiserv.freebsd.org> Date: Wed, 26 Feb 2014 14:31:13 GMT From: Shayan Pooya To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: bin/187083: Sort cannot be used for binary data. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 14:40:02 -0000 >Number: 187083 >Category: bin >Synopsis: Sort cannot be used for binary data. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 26 14:40:01 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Shayan Pooya >Release: 10.0 >Organization: Chango >Environment: The problem is independent of the OS version and can be reproduced on all public versions. >Description: Sort has an unnecessary check that prevents it from being used for binary data: https://github.com/freebsd/freebsd/blob/master/usr.bin/sort/sort.c#L1063 Here is the mailing list discussion (not very useful): http://freebsd.1045724.n5.nabble.com/Field-delimiter-in-sort-program-in-freebsd-td5879776.html >How-To-Repeat: $ sort -t $'\xff' complains about the delimiter. >Fix: Just remove the bogus condition: diff --git a/sort.c b/sort.c index d811a86..664b214 100644 --- a/sort.c +++ b/sort.c @@ -1060,10 +1060,6 @@ main(int argc, char **argv) } sort_opts_vals.tflag = true; sort_opts_vals.field_sep = btowc(optarg[0]); - if (sort_opts_vals.field_sep == WEOF) { - errno = EINVAL; - err(2, NULL); - } if (!gnusort_numeric_compatibility) { if (symbol_decimal_point == sort_opts_vals.field_sep) symbol_decimal_point = WEOF; >Release-Note: >Audit-Trail: >Unformatted: