Your message dated Mon, 22 Sep 2008 01:03:07 +0100
with message-id <[EMAIL PROTECTED]>
and subject line Re: Segmentation fault in dirname - Not a bug, string-literals 
can be unmodifiable in C
has caused the Debian Bug report #499684,
regarding Fwd: Segmentation fault in dirname
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [EMAIL PROTECTED]
immediately.)


-- 
499684: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=499684
Debian Bug Tracking System
Contact [EMAIL PROTECTED] with problems
--- Begin Message ---
Package: libc6
Version: 2.7-13
Severity: critical
Justification: breaks unrelated software


Using this sample code :

#include <stdio.h>
#include <libgen.h>

int main(){
  dirname("/tmp/foo/foo/1.c");
  return 0;
}

The error that it gave is :

[EMAIL PROTECTED]:/tmp/foo/foo2/foo3$ gdb ./a.out
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html> <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r
Starting program: /tmp/foo/foo2/foo3/a.out

Program received signal SIGSEGV, Segmentation fault.
0x00007f55c533219a in dirname () from /lib/libc.so.6
(gdb) bt
#0  0x00007f55c533219a in dirname () from /lib/libc.so.6
#1  0x00000000004004da in main ()
(gdb) f 0
#0  0x00007f55c533219a in dirname () from /lib/libc.so.6
(gdb) l
1       /tmp/glibc-2.7/build-tree/amd64-libc/csu/crtn.S: No such file or
directory.
        in /tmp/glibc-2.7/build-tree/amd64-libc/csu/crtn.S

This bug make the unrelated appliaction fail (VNC for example).
Any application that use this command can fail.

the next package had been use to get debug symobls.

libc6-dev:
  Installed: 2.7-13
  Candidate: 2.7-13
  Version table:
 *** 2.7-13 0

gcc:
  Installed: 4:4.3.1-2
  Candidate: 4:4.3.1-2

This bug appers both in 32 and 64 bit

Regards ,...
  Boris Shtrasman || myrtfm.blogspot.com

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                       1:4.3.1-9  GCC support library

libc6 recommends no packages.

Versions of packages libc6 suggests:
pn  glibc-doc                     <none>     (no description available)
ii  locales                       2.7-13     GNU C Library: National
Language (

-- debconf-show failed

--- End Message ---
--- Begin Message ---
"/tmp/foo/foo/1.c" is a string literal.  The compiler can
put it in a read-only data area, which saves on memory if
multiple copies of the program are running at the same time (one
copy of the read-only code and data can be shared between all
running instances).

This causes a segfault if the program attempts to modify the data.
That's a bug in the program, rather than GCC or libc, as it's an
optimisation which C compilers are allowed to make.



I checked that this wasn't a bad minimal-test-case for a real bug;
with the following modification, dirname doesn't crash.
  char a_mutable_string[] = "/tmp/foo/foo/1.c";
  dirname(a_mutable_string);

Steve


--- End Message ---

Reply via email to