Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 2014 18:24:03 -0500
From:      Shayan Pooya <shayan@liveve.org>
To:        Bernt Hansson <bah@bananmonarki.se>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Field delimiter in sort program in freebsd
Message-ID:  <CABAubTjqyFuvgsAHgSBL=FmazytGxY0e3YaYkd7Ur%2BOa5dG5mg@mail.gmail.com>
In-Reply-To: <CABAubThPph9My=EhcxCbZVQRf%2Brya8yBmSsARxMSGLXN44aSMQ@mail.gmail.com>
References:  <CABAubTg2RH95LypshV6ZpZP1qQW24TQZfFSSrYs5DzUoqA5tSw@mail.gmail.com> <52E3C691.8090000@bananmonarki.se> <CABAubThPph9My=EhcxCbZVQRf%2Brya8yBmSsARxMSGLXN44aSMQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABAubTjqyFuvgsAHgSBL=FmazytGxY0e3YaYkd7Ur%2BOa5dG5mg>