Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 83761

Summary: idutils3.2 is causing a strtok coredump in libc686 2.2.93
Product: [Retired] Red Hat Linux Reporter: Honisoit Q. Malypense <honisoitqmalypense>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-03 19:49:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Honisoit Q. Malypense 2003-02-07 23:13:25 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.6 (X11; Linux i686; U;) Gecko/20020830

Description of problem:
I seem to be seeing a problem in strtok that is causing id-utils3.2 to fail.

I downloaded the id-utils3.2 source on my redhat 8 machine, ran ./configure,
then make

Everything seems ok, but when I run mkid I get a segfault right away.

I seem to be dying in strtok during the processing of parse_file_name

#0  vectorize_string (string=0x804edfb ".", delimiter_class=0x804f147 "/")
    at walker.c:659
#1  0x0804d8e0 in parse_file_name (file_name=0x804edfb ".", 
    relative_dir_link=0x8059900) at walker.c:534
#2  0x08049305 in main (argc=0, argv=0x8050038) at mkid.c:275
#3  0x420158d4 in __libc_start_main () from /lib/i686/
(gdb) l
654     vectorize_string (char *string, char *delimiter_class)
655     {
656       char **vector_0 = MALLOC (char *, 2 + strlen (string) / 2);
657       char **vector = vector_0;
659       *vector = strtok (string, delimiter_class);
660       while (*vector)
661         *++vector = strtok (0, delimiter_class);
662       return REALLOC (vector_0, char *, ++vector - vector_0);
663     }
(gdb) p string
$1 = 0x804edfb "."
(gdb) p delimiter_class
$2 = 0x804f147 "/"
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x4207af65 in strtok () from /lib/i686/

[root@messugah dublin]# ldd /usr/local/bin/mkid => /lib/i686/ (0x42000000)
        /lib/ => /lib/ (0x40000000)

 file /lib/i686/
/lib/i686/ symbolic link to

According to the docs this looks like the right way to use strtok.


Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. download id-utils3.2
3.try running mkid

Actual Results:  SEGV

Expected Results:  A big lovely ID file should have been created

Additional info:

Comment 1 Jakub Jelinek 2003-02-07 23:20:16 UTC
Wild guess. Isn't that "." passed to vectorize_string a string literal
(ie. read-only data)?

Comment 2 Jakub Jelinek 2004-10-03 19:49:47 UTC
No feedback, plus the hypothesis that "." is in .rodata sounds very likely
(0x804edfb is not really too far away from 0x804d8e0 which certainly
is in r/o segment).