Subject: loop on touch (fdutimens)
From: C de-Avillez <[email-masked]>
To: Bug Coreutils <[email-masked]>
Date: Fri, 17 Sep 2010 19:49:45 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

I just built & ran a quick test on coreutils GIT. I received a SEGV on
touch, and ran it under GDB.

Looks like a loop.

Cheers,

cerdea@xango2:/build/buildd/coreutils$ gdb --args src/touch test
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /src/buildd/coreutils/src/touch...done.
(gdb) set pagination off
(gdb) r
Starting program: /src/buildd/coreutils/src/touch test
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00000000004073dc in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:193
193           if (dup2 (fd, fd) != fd)
(gdb) bt 3 full
#0  0x00000000004073dc in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:193
        adjusted_timespec = {{tv_sec = 0, tv_nsec = 0}, {tv_sec = 0, tv_nsec = 0}}
        ts = 0x0
        adjustment_needed = 0
        st = <error reading variable st (Cannot access memory at address 0x7fffff5fef70)>
#1  0x00000000004072aa in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:269
        result = <value optimized out>
        adjusted_timespec = {{tv_sec = 0, tv_nsec = 0}, {tv_sec = 0, tv_nsec = 0}}
        ts = 0x0
        adjustment_needed = <value optimized out>
        st = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __unused = {0, 0, 0}}
#2  0x00000000004072aa in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:269
        result = <value optimized out>
        adjusted_timespec = {{tv_sec = 0, tv_nsec = 0}, {tv_sec = 0, tv_nsec = 0}}
        ts = 0x0
        adjustment_needed = <value optimized out>
        st = {st_dev = 0, st_ino = 0, st_nlink = 0, st_mode = 0, st_uid = 0, st_gid = 0, __pad0 = 0, st_rdev = 0, st_size = 0, st_blksize = 0, st_blocks = 0, st_atim = {tv_sec = 0, tv_nsec = 0}, st_mtim = {tv_sec = 0, tv_nsec = 0}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __unused = {0, 0, 0}}
(More stack frames follow...)
(gdb) bt -5 full
#38527 0x00000000004072aa in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:269
        result = <value optimized out>
        adjusted_timespec = {{tv_sec = 8589924528, tv_nsec = 0}, {tv_sec = 0, tv_nsec = 4197073}}
        ts = 0x0
        adjustment_needed = <value optimized out>
        st = {st_dev = 4197129, st_ino = 140737354130624, st_nlink = 140737488345056, st_mode = 4160562656, st_uid = 32767, st_gid = 4294957064, __pad0 = 32767, st_rdev = 140737354129768, st_size = 255564379, st_blksize = 140737351936210, st_blocks = 0, st_atim = {tv_sec = 140737353950688, tv_nsec = 140733193388033}, st_mtim = {tv_sec = 0, tv_nsec = 1}, st_ctim = {tv_sec = 140737354129768, tv_nsec = 0}, __unused = {140737353950688, 1, 0}}
#38528 0x00000000004072aa in fdutimens (fd=0, file=0x0, timespec=0x0) at utimens.c:269
        result = <value optimized out>
        adjusted_timespec = {{tv_sec = 5, tv_nsec = 0}, {tv_sec = 0, tv_nsec = 140737351981093}}
        ts = 0x0
        adjustment_needed = <value optimized out>
        st = {st_dev = 29848917, st_ino = 2, st_nlink = 140737349750208, st_mode = 0, st_uid = 0, st_gid = 4152746968, __pad0 = 32767, st_rdev = 140737354115432, st_size = 0, st_blksize = 4294967295, st_blocks = 24, st_atim = {tv_sec = 1, tv_nsec = 6336552}, st_mtim = {tv_sec = 0, tv_nsec = 1}, st_ctim = {tv_sec = 0, tv_nsec = 0}, __unused = {140737351953297, 1, 0}}
#38529 0x00000000004024e2 in fdutimensat (fd=0, dir=-100, file=0x7fffffffde74 "test", ts=0x0, atflag=0) at fdutimensat.c:48
        result = 1
#38530 0x0000000000401f21 in touch (argc=2, argv=0x7fffffffdad8) at touch.c:166
        ok = <value optimized out>
        fd = 0
        open_errno = 0
        t = 0x7ffff7929f97
#38531 main (argc=2, argv=0x7fffffffdad8) at touch.c:432
        c = <value optimized out>
        date_set = <value optimized out>
        ok = true
        flex_date = <value optimized out>
(gdb) list
188           if (fd < 0)
189             {
190               errno = EBADF;
191               return -1;
192             }
193           if (dup2 (fd, fd) != fd)
194             return -1;
195         }
196
197       /* Some Linux-based NFS clients are buggy, and mishandle time stamps
(gdb) 

cerdea@xango2:/build/buildd/coreutils$ src/touch --version
touch (GNU coreutils) 8.5.154-2dd21
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <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.

Written by Paul Rubin, Arnold Robbins, Jim Kingdon,
David MacKenzie, and Randy Smith.
cerdea@xango2:/build/buildd/coreutils$ 

-- 
C de-Avillez
IRC: hggdh

This email (and any attachments) is digitally signed using GNUpg
(http://gnupg.org). The public key is available at http://pgp.mit.edu.
The key Id is 0xD3133E56.