On Thu, Mar 10, 2016 at 8:14 AM, Jeremie Courreges-Anglas <[email protected]> wrote: > Ingo Schwarze <[email protected]> writes: > >> Hi, > > Hi Ingo, > >> two general remarks: >> >> 1) The head(1) utility is supposed to handle text files.
The posix description for tail seems clear. I suggest following the same treatment for head. >>>> The situation is a bit muddy. :) >>>> 1. GNU head obeys the last command line option >>>> 2. FreeBSD errors out if both -c and -n are specified >>>> 3. NetBSD always follows -c if it has been specified, probably mixing -c >>>> and -n was overlooked >>>> 4. busybox is a bit more broken: >>>> >>>> $ printf '%s\n' a b c d e | busybox head -c 2 -n 5 >>>> a >>>> b >>>> c$ >>>> >>>> ie if -c is passed it always specifies the byte-counting behavior, but >>>> the actual byte count can be modified by subsequent -n options... >>>> >>>> I prefer 1. 'cause I see no reason to do 2. >> >> There are three good reasons for 2.: >> >> 1) >> >>> FWIW our tail(2) does 2, so IMO head should as well. >> >> I agree with Dmitrij, for two more reasons in addition to the already >> quite good one Dmitrij mentions - which, by the way, is not just us, >> but POSIX, too, in the case of tail(1). > > GNU tail busybox tail, FreeBSD tail and NetBSD tail all allow mixing -c > and -n options. Our tail(1) is the one that is different here, so it's > not clear to me that the right move is to follow FreeBSD regarding > head(1) and to differ from them regarding tail(1). > > To repeat myself, the addition of this rather silly option is supposed > to reduce differences from other implementations so that we can stop > wasting time about it. I agree with jca on this one for the reasons he stated. and maybe our tail should be changed.
