From owner-freebsd-questions@FreeBSD.ORG Sat Jan 25 23:24:11 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org 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 57A19502 for ; Sat, 25 Jan 2014 23:24:11 +0000 (UTC) Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com [209.85.216.181]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 11FA6115D for ; Sat, 25 Jan 2014 23:24:10 +0000 (UTC) Received: by mail-qc0-f181.google.com with SMTP id e9so6163231qcy.40 for ; Sat, 25 Jan 2014 15:24:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=sZ3CsChSWD23xvXMLj+UKHe7kzdjBU83CUD9XI9LOOY=; b=aTusJb54odBzRW9WkyPCjmA9iXujFa8b+O8WwnL/APyLjErs0at7kk4pjbS1Qp/N11 Ba8pKWOtAaNVbWhbTBo/md3yUQA3Iml+TRa8Gndlm+3r0NctnDEtVuM4x5rQiJgGM/Wt hrCm7TozgFPe3TAxrsn17MywXvGUUylLG+9vJqC+2rpg7I+HtOm3m8+awtBKNpAdWslE zG8ZmL97sAfqv8sDj81cf3wICOUwT5WxuwonKq1fjj1IRL/1BkvvZJpG8CGBVQgVvwnu oQID6knv9camWkjQ8e3L6oo32CcikybOLUowdWYUM6IvS1b6mSe6Rpr3G10Ff6etSzGT iL1A== X-Gm-Message-State: ALoCoQmU41OxKCRaMdDqgmbTfPvd3gB7HKF5jh8/Kmol9LyTP17Bdi/vL1ls5WLNnViXVDC5P/Wv MIME-Version: 1.0 X-Received: by 10.224.121.67 with SMTP id g3mr1693355qar.78.1390692243936; Sat, 25 Jan 2014 15:24:03 -0800 (PST) Received: by 10.229.163.9 with HTTP; Sat, 25 Jan 2014 15:24:03 -0800 (PST) X-Originating-IP: [184.148.68.164] In-Reply-To: References: <52E3C691.8090000@bananmonarki.se> Date: Sat, 25 Jan 2014 18:24:03 -0500 Message-ID: Subject: Re: Field delimiter in sort program in freebsd From: Shayan Pooya To: Bernt Hansson Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jan 2014 23:24:11 -0000 I took a look at the source code of sort and saw this condition: if (sort_opts_vals.field_sep == WEOF) { errno = EINVAL; err(2, NULL); } https://github.com/freebsd/freebsd/blob/master/usr.bin/sort/sort.c#L1063 Removing this condition and remaking sort fixes the issue (at least I can use bash to give 0xff to the sort program, no luck with other shells though). Using \xff as the record separator makes sense for binary files. Any idea why there is such a condition in the sort program? Thanks.