bin/142986: /dev/random can not be source for tr(1) | tr: Illegal byte sequence

Yuri Pankov yuri.pankov at gmail.com
Tue Jan 19 21:00:21 UTC 2010


The following reply was made to PR bin/142986; it has been noted by GNATS.

From: Yuri Pankov <yuri.pankov at gmail.com>
To: vermaden <vermaden at interia.pl>
Cc: bug-followup at freebsd.org
Subject: Re: bin/142986: /dev/random can not be source for tr(1) | tr:
 Illegal byte sequence
Date: Tue, 19 Jan 2010 23:51:00 +0300

 /dev/random just isn't guaranteed to produce correct multibyte characters
 (and I guess you are using multibyte locale). Try setting LC_CTYPE to
 single byte locale:
 > locale
 LANG=en_US.UTF-8
 LC_CTYPE="en_US.UTF-8"
 LC_COLLATE="en_US.UTF-8"
 LC_TIME="en_US.UTF-8"
 LC_NUMERIC="en_US.UTF-8"
 LC_MONETARY="en_US.UTF-8"
 LC_MESSAGES="en_US.UTF-8"
 LC_ALL=
 > head -c 200 /dev/urandom | tr -c -d 'A-Za-z0-9'
 tr: Illegal byte sequence
 > head -c 200 /dev/urandom | env LC_CTYPE=C tr -c -d 'A-Za-z0-9'
 myRUBav1EHfJrD0HCSuurHRPYmqMPzWErJhHRgp6ze0YisDoA4x


More information about the freebsd-bugs mailing list