Bug 87429 - coreutils-5.2.1-r5 uses old i18n patch, cut -f1 fails with wide chars
Bug#: 87429 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: base-system@gentoo.org Reported By: zlynx@acm.org
Component: Core system
URL: 
Summary: coreutils-5.2.1-r5 uses old i18n patch, cut -f1 fails with wide chars
Keywords:  
Status Whiteboard: 
Opened: 2005-03-31 08:52 0000
Description:   Opened: 2005-03-31 08:52 0000
In cut_fields_mb in cut.c, wint_t wc is not initialized before being
compared to WEOF.  It just so happens that when I compile it on my
system, through some miracle of perversity and stack layout, wc picks up
-1 as its initial value.

On cut.c line 836, change wint_t wc; to wint_t wc = 0;  That fixes it
for me.

On the coreutils bug list I was told that this problem has already been fixed in Fedora Core 3 a while ago.  Maybe Gentoo's coreutils needs to get new versions of the i18n patch?

Reproducible: Always
Steps to Reproduce:
1.  Emerge coreutils with at least -O2 and gcc 3.4 or 4.0
Actual Results:  
echo foo:bar | cut -d: -f1 produces no output!

Expected Results:  
foo

------- Comment #1 From SpanKY 2005-04-01 20:31:19 0000 -------
5.2.1-r6 has the updated redhat patch

------- Comment #2 From Jonathan Briggs 2005-04-04 08:51:34 0000 -------
*** Bug 86352 has been marked as a duplicate of this bug. ***

------- Comment #3 From Jakub Moc (RETIRED) 2005-05-19 11:04:37 0000 -------
*** Bug 93234 has been marked as a duplicate of this bug. ***

------- Comment #4 From foser (RETIRED) 2005-05-19 13:19:47 0000 -------
*** Bug 86352 has been marked as a duplicate of this bug. ***