cut(1) behaviour changed since 5.2.1

Dmitry Frolov frolov at riss-telecom.ru
Thu Nov 4 09:58:41 PST 2004


[ Cc'ing tjr@ because he is the comitter of the change in question ]

I'm experiencing a minor problem with cut(1) while trying to run shell
script (installer), written for FreeBSD 5.2.1, on 5.3-RC1 system.

I don't know if it's really a bug, but if it is someone may want look
at it. The problem is that on 5.3 cut returns 'Illegal byte sequence'
(EILSEQ) error while parsing files without trailing newline, while on
5.2.1 it doesn't. It looks like the behaviour was changed with the
revision 1.27 of the cut.c (about handling of multibyte characters).

Here is the demonstration:

frol at atlas ttyp0:~$uname -spr
FreeBSD 5.3-RC1 i386
frol at atlas ttyp0:~$echo aaa:bbb | cut -d : -f 1
aaa
frol at atlas ttyp0:~$echo -n aaa:bbb | cut -d : -f 1
cut: stdin: Illegal byte sequence
frol at atlas ttyp0:~$echo $?
1

However on 5.2.1 all goes well:

frol at sva ttyp0:~$uname -spr 
FreeBSD 5.2.1-RELEASE-p7 i386
frol at sva ttyp0:~$echo aaa:bbb | cut -d : -f 1
aaa
frol at sva ttyp0:~$echo -n aaa:bbb | cut -d : -f 1
aaa
frol at sva ttyp0:~$echo $?
0

    wbr&w, dmitry.
-- 
Dmitry Frolov <frolov at riss-telecom.ru>
RISS-Telecom Network, Novosibirsk, Russia
66415911 at ICQ, +7 3832 NO WA1T, DVF-RIPE


More information about the freebsd-current mailing list