Bug 611274

Summary: [abrt] crash in coreutils-8.4-7.fc13: raise: Process /usr/bin/tr was killed by signal 6 (SIGABRT)
Product: [Fedora] Fedora Reporter: Mihai T. Lazarescu <mihai>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: kdudka, ovasik, p, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard: abrt_hash:832c1089168d939e27bb8bda426868b03b51254d
Fixed In Version: coreutils-8.4-9.fc13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-05 09:11:46 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
File: backtrace none

Description Mihai T. Lazarescu 2010-07-04 12:43:18 EDT
abrt 1.1.1 detected a crash.

architecture: i686
Attached file: backtrace
cmdline: tr '[:upper:] ' [:lower:]
component: coreutils
crash_function: raise
executable: /usr/bin/tr
global_uuid: 832c1089168d939e27bb8bda426868b03b51254d
kernel: 2.6.33.5-124_1.cubbi_tuxonice.fc13.i686
package: coreutils-8.4-7.fc13
rating: 4
reason: Process /usr/bin/tr was killed by signal 6 (SIGABRT)
release: Fedora release 13 (Goddard)

How to reproduce
-----
1. Run: date '+%B%e-cancer.mp3' | tr '[:upper:] ' '[:lower:]'
2. Assert failure happens.
Comment 1 Mihai T. Lazarescu 2010-07-04 12:43:21 EDT
Created attachment 429388 [details]
File: backtrace
Comment 2 Kamil Dudka 2010-07-04 12:49:24 EDT
Thank you for filing the bug.  Please append also the output of 'locale'.
Comment 3 Mihai T. Lazarescu 2010-07-04 13:04:15 EDT
here is the 'locale' command output:

    LANG=en_US.ISO-8859-1
    LC_CTYPE="en_US.ISO-8859-1"
    LC_NUMERIC="en_US.ISO-8859-1"
    LC_TIME="en_US.ISO-8859-1"
    LC_COLLATE="en_US.ISO-8859-1"
    LC_MONETARY="en_US.ISO-8859-1"
    LC_MESSAGES="en_US.ISO-8859-1"
    LC_PAPER="en_US.ISO-8859-1"
    LC_NAME="en_US.ISO-8859-1"
    LC_ADDRESS="en_US.ISO-8859-1"
    LC_TELEPHONE="en_US.ISO-8859-1"
    LC_MEASUREMENT="en_US.ISO-8859-1"
    LC_IDENTIFICATION="en_US.ISO-8859-1"
    LC_ALL=en_US.ISO-8859-1
Comment 4 Kamil Dudka 2010-07-07 11:10:09 EDT
Thanks!  I am able to reproduce the crash:

$ export LC_ALL=en_US.ISO-8859-1
$ gdb -q --args tr '[:upper:] ' '[:lower:]'
(gdb) run
tr: tr.c:1871: main: Assertion `c1 == -1 || truncate_set1' failed.

Program received signal SIGABRT, Aborted.
0x0000003177c326c5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);

(gdb) bt
#0  0x0000003177c326c5 in raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x0000003177c33ea5 in abort () at abort.c:92
#2  0x0000003177c2b7b5 in __assert_fail (assertion=0x408420 "c1 == -1 || truncate_set1", file=<value optimized out>, line=1871, function=<value optimized out>) at assert.c:81
#3  0x00000000004044ae in main (argc=3, argv=0x7fffffffdd08) at tr.c:1871

(gdb) frame 3
#3  0x00000000004044ae in main (argc=3, argv=0x7fffffffdd08) at tr.c:1871
1871              assert (c1 == -1 || truncate_set1);

(gdb) print c1
$1 = 32

(gdb) print truncate_set1
$2 = false
Comment 5 Kamil Dudka 2010-07-08 10:13:54 EDT
I see the same bug in the upstream git HEAD.  However it's not easy for me to track it down.  It does not crash with C locales, but it does with en_US.ISO-8859-1.  The key problem is that is_char_class_member() returns different results for chars >127 if the locales is changed.  If I switch to C locales only within this function, it works again.
Comment 6 Pádraig Brady 2010-09-22 07:34:52 EDT
Ah that's well broken.
It stems from the assumption that there are the same number of
upper and lower chars. However for en_US.iso-8859-1 for example
there are 56 and 59 respectively.

This also messes up in the other direction,
and this incorrectly transforms 0x20 to 0xDE:

  echo "_ _" | LC_ALL=en_US ./src/tr '[:lower:] ' '[:upper:]'

I'll fix it soon upstream and post the patch here.
Comment 8 Fedora Update System 2010-10-01 07:11:10 EDT
coreutils-8.5-6.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/coreutils-8.5-6.fc14
Comment 9 Fedora Update System 2010-10-01 07:53:12 EDT
coreutils-8.4-9.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/coreutils-8.4-9.fc13
Comment 10 Fedora Update System 2010-10-01 21:12:31 EDT
coreutils-8.5-6.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update coreutils'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/coreutils-8.5-6.fc14
Comment 11 Fedora Update System 2010-10-05 09:11:41 EDT
coreutils-8.5-6.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 12 Fedora Update System 2010-10-19 03:12:55 EDT
coreutils-8.4-9.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.