NetBSD Problem Report #1190
From gnats Mon Jul 3 12:07:16 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id MAA15015 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 3 Jul 1995 12:07:16 -0400
Message-Id: <199507031458.RAA00468@araneus.pp.fi>
Date: Mon, 3 Jul 1995 17:58:48 +0300
From: gson@araneus.pp.fi
Reply-To: gson@araneus.pp.fi
To: gnats-bugs@NetBSD.org
Subject: "tr" is not 8-bit clean
X-Send-Pr-Version: 3.2
>Number: 1190
>Category: bin
>Synopsis: "tr" is not 8-bit clean
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 03 12:20:02 +0000 1995
>Closed-Date: Wed Nov 01 00:35:44 +0000 1995
>Last-Modified: Wed Nov 01 00:45:44 +0000 1995
>Originator: Andreas Gustafsson
>Release: NetBSD-current i386 binary snapshot of May 15, 1995
>Organization:
Araneus Information Systems Oy
>Environment:
System: NetBSD araneus.pp.fi 1.0A NetBSD 1.0A (GUANO) #4: Mon Jul 3 17:08:45 EET DST 1995 gson@araneus.pp.fi:/usr/src/sys/arch/i386/compile/GUANO i386
>Description:
When /usr/bin/tr is given arguments containing characters
with the eighth bit set, it behaves erratically. This is due
to sign extending such characters into negative numbers and
then using those negative numbers as array indices.
>How-To-Repeat:
Uudecode the following shell script and then run it with itself
as standard input like this: "sh trbug <trbug". The output should
not be identical to the input, but it is.
begin 644 trbug
7(R$O8FEN+W-H"G1R("?D]B<@)V%O)PKW
`
end
>Fix:
Apply this patch to /usr/src/usr.bin/tr/extern.h.
*** extern.h.orig Mon Jul 3 17:52:33 1995
--- extern.h Mon Jul 3 17:38:21 1995
***************
*** 43,47 ****
int equiv[2]; /* equivalence set */
int *set; /* set of characters */
! char *str; /* user's string */
} STR;
--- 43,47 ----
int equiv[2]; /* equivalence set */
int *set; /* set of characters */
! unsigned char *str; /* user's string */
} STR;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: pk
State-Changed-When: Tue Oct 31 19:35:44 EST 1995
State-Changed-Why:
Fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.