bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26574: v4.4: POSIX violation with respect to output of a trailing ne


From: Eric Blake
Subject: bug#26574: v4.4: POSIX violation with respect to output of a trailing newline, even with --posix
Date: Thu, 20 Apr 2017 14:36:39 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

On 04/20/2017 02:32 PM, Michael Klement wrote:

> On macOS 10.12.4 (but not FreeBSD 10.1.2), Sed chokes on bytes that aren't 
> valid in UTF-8 encoding, when using regex-based functionality:
> 
> $ printf '\xfc\n' | sed  -n '/./p'
> sed: RE error: illegal byte sequence
> 

That's locale dependent (should not happen with LC_ALL=C) - but it
illustrates another nice point about POSIX text files: a text file may
not have encoding errors, but as a corollary of that fact, there exist
files which are text files in some locales but binary files in others!

The behavior of sed is only specified when you have no encoding errors,
so your choice of locale can indeed affect whether you get output that
you wanted.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]