From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 23 15:58:42 2010 Received: (at submit) by debbugs.gnu.org; 23 Jun 2010 19:58:42 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORW5p-00041p-O8 for submit@debbugs.gnu.org; Wed, 23 Jun 2010 15:58:41 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORW5k-00041j-2v for submit@debbugs.gnu.org; Wed, 23 Jun 2010 15:58:39 -0400 Received: from lists.gnu.org ([199.232.76.165]:53486) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORW5d-00050X-46 for submit@debbugs.gnu.org; Wed, 23 Jun 2010 15:58:29 -0400 Received: from [140.186.70.92] (port=42669 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORW5b-0000WJ-7Q for bug-coreutils@gnu.org; Wed, 23 Jun 2010 15:58:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORW5a-00058z-1K for bug-coreutils@gnu.org; Wed, 23 Jun 2010 15:58:27 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:49587) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORW5Z-000587-GV for bug-coreutils@gnu.org; Wed, 23 Jun 2010 15:58:26 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 78935940041 for ; Wed, 23 Jun 2010 21:58:16 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 3B53BE82; Wed, 23 Jun 2010 21:58:14 +0200 (CEST) From: Jim Meyering To: Brad Subject: Re: rm 8.1 In-Reply-To: <4C223B1A.8020307@outwild.net> (Brad's message of "Wed, 23 Jun 2010 09:49:30 -0700") References: <4C223B1A.8020307@outwild.net> Date: Wed, 23 Jun 2010 21:58:14 +0200 Message-ID: <87eifx34ix.fsf@meyering.net> Lines: 93 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.3 (-----) Brad wrote: > Hi Jim: Hi Brad, I've Cc'd the bug-reporting address. It's better to report problems to that address than to my personal one. > Are you sure this is fixed? How could I be sure it is fixed, considering that this is the first I've heard of this failure? > I get these errors: > rm: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion > (*__errno_location ()) != 22' failed. > Aborted > > chmod: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion > (*__errno_location ()) != 22' failed. > Aborted > > du: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion > (*__errno_location ()) != 22' failed. > Aborted > > It appears that the call to fts_open is failing but I do not > understand the reason. All of the other utilities that don't use this > function are still working fine. > > The system is running kernel 2.6.34 and the binaries are linked to > glibc-2.11.2. I had to use slackware binaries for rm and chmod in > order to get the system to boot. Clearly this is not right. > > If you have any ideas what might be wrong I would be glad to help fix > this. I look forward to your input. You seem to be hitting this assertion: FTS * xfts_open (char * const *argv, int options, int (*compar) (const FTSENT **, const FTSENT **)) { FTS *fts = fts_open (argv, options | FTS_CWDFD, compar); if (fts == NULL) { /* This can fail in two ways: out of memory or with errno==EINVAL, which indicates it was called with invalid bit_flags. */ assert (errno != EINVAL); xalloc_die (); } return fts; } Did you build the failing rm yourself? >From unmodified sources? If so, please provide the precise ./configure and "make" commands you used and tell us more about your system. As far as I know, this is the first report of such a problem, so I suspect something about your environment is at least "unusual". There are only a few ways fts_open can return with errno set to EINVAL, and none should be possible from coreutils programs: FTS * fts_open (char * const *argv, register int options, int (*compar) (FTSENT const **, FTSENT const **)) { register FTS *sp; register FTSENT *p, *root; register size_t nitems; FTSENT *parent = NULL; FTSENT *tmp = NULL; /* pacify gcc */ bool defer_stat; /* Options check. */ if (options & ~FTS_OPTIONMASK) { __set_errno (EINVAL); return (NULL); } if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) { __set_errno (EINVAL); return (NULL); } if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) { __set_errno (EINVAL); return (NULL); } Can you debug it and tell us which one it is? From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 23 16:57:25 2010 Received: (at submit) by debbugs.gnu.org; 23 Jun 2010 20:57:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORX0e-0004R2-I9 for submit@debbugs.gnu.org; Wed, 23 Jun 2010 16:57:25 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORWvj-0004Or-DK for submit@debbugs.gnu.org; Wed, 23 Jun 2010 16:52:20 -0400 Received: from lists.gnu.org ([199.232.76.165]:35497) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORWvf-0005rG-2k for submit@debbugs.gnu.org; Wed, 23 Jun 2010 16:52:15 -0400 Received: from [140.186.70.92] (port=39917 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORWvd-0007PY-4o for bug-coreutils@gnu.org; Wed, 23 Jun 2010 16:52:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORWvb-0003RO-95 for bug-coreutils@gnu.org; Wed, 23 Jun 2010 16:52:12 -0400 Received: from albert.xmlsockets.net ([216.218.196.66]:55713) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORWva-0003R1-OK for bug-coreutils@gnu.org; Wed, 23 Jun 2010 16:52:11 -0400 Received: from brads-powerbook58.local (c-24-130-94-194.hsd1.ca.comcast.net [24.130.94.194]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by albert.xmlsockets.net (Postfix) with ESMTPSA id C9EB71B38FB; Wed, 23 Jun 2010 13:35:24 -0700 (PDT) Message-ID: <4C227423.90105@outwild.net> Date: Wed, 23 Jun 2010 13:52:51 -0700 From: Brad User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Jim Meyering Subject: Re: rm 8.1 References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> In-Reply-To: <87eifx34ix.fsf@meyering.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 23 Jun 2010 16:57:23 -0400 Cc: bug-coreutils@gnu.org, Brad X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Thanks for your help Jim. I tried to debug the program by running gdb. I'm not sure if the backtrace has the information you need. GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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-unknown-linux-gnu". For bug reporting instructions, please see: . (gdb) file src/rm Reading symbols from /home/brad/tools/core_boot/src/rm...(no debugging symbols found)...done. (gdb) set args test (gdb) run Starting program: /home/brad/tools/core_boot/src/rm test rm: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion `(*__errno_location ()) != 22' failed. Program received signal SIGABRT, Aborted. 0x00007ffff7abb035 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); (gdb) bt #0 0x00007ffff7abb035 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff7abc460 in *__GI_abort () at abort.c:92 #2 0x00007ffff7ab4171 in *__GI___assert_fail (assertion=0x407def "(*__errno_location ()) != 22", file=, line=41, function=0x407e0c "xfts_open") at assert.c:81 #3 0x0000000000406179 in xfts_open () #4 0x00000000004031dc in rm () #5 0x00000000004022d2 in main () I am not an expert at using gdb. Please let me know if you have any suggestions to get more information. My environment is somewhat unusual. I am compiling a new system in /bootstrap against the updated glibc. The new system boots up with glibc-2.11.2. The development environment uses the older glibc-2.10.1. So I need to adjust the compiler spec file to ensure that the right linkage is done. The sources were not modified. Everything compiles fine but the xfts_open is not working. Here are the options to configure: ../coreutils-8.5/configure --prefix=/bootstrap --without-gmp CFLAGS='-specs=/bootstrap/gcc.specs' LDFLAGS=-Wl,-rpath,/bootstrap/lib,-lc Here is how I adjusted the specs: diff built-in.specs /bootstrap/gcc.specs 51c51 < %{!static:--eh-frame-hdr} %{!m32:-m elf_x86_64} %{m32:-m elf_i386} --hash-style=both %{shared:-shared} %{!shared: %{!static: %{rdynamic:-export-dynamic} %{m32:%{!dynamic-linker:-dynamic-linker %{muclibc:%{mglibc:%e-mglibc and -muclibc used together}/lib/ld-uClibc.so.0;:/lib32/ld-linux.so.2}}} %{!m32:%{!dynamic-linker:-dynamic-linker %{muclibc:%{mglibc:%e-mglibc and -muclibc used together}/lib/ld64-uClibc.so.0;:/lib/ld-linux-x86-64.so.2}}}} %{static:-static}} --- > %{!static:--eh-frame-hdr} %{!m32:-m elf_x86_64} %{m32:-m elf_i386} --hash-style=both %{shared:-shared} %{!shared: %{!static: %{rdynamic:-export-dynamic} %{m32:%{!dynamic-linker:-dynamic-linker %{muclibc:%{mglibc:%e-mglibc and -muclibc used together}/lib/ld-uClibc.so.0;:/lib32/ld-linux.so.2}}} %{!m32:%{!dynamic-linker:-dynamic-linker %{muclibc:%{mglibc:%e-mglibc and -muclibc used together}/lib/ld64-uClibc.so.0;:/bootstrap/lib/ld-linux-x86-64.so.2}}}} %{static:-static}} 54c54 < %{pthread:-lpthread} %{shared:-lc} %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}} --- > %{pthread:-lpthread} %{shared:-L/bootstrap/lib -lc} %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}} Please let me know if you need more information. I can always modify the sources to gain useful debugging data. Hopefully you have a better idea. Jim Meyering wrote: > Brad wrote: >> Hi Jim: > > Hi Brad, > > I've Cc'd the bug-reporting address. > It's better to report problems to that address than to my personal one. > >> Are you sure this is fixed? > > How could I be sure it is fixed, considering > that this is the first I've heard of this failure? > >> I get these errors: >> rm: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion >> (*__errno_location ()) != 22' failed. >> Aborted >> >> chmod: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion >> (*__errno_location ()) != 22' failed. >> Aborted >> >> du: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion >> (*__errno_location ()) != 22' failed. >> Aborted >> >> It appears that the call to fts_open is failing but I do not >> understand the reason. All of the other utilities that don't use this >> function are still working fine. >> >> The system is running kernel 2.6.34 and the binaries are linked to >> glibc-2.11.2. I had to use slackware binaries for rm and chmod in >> order to get the system to boot. Clearly this is not right. >> >> If you have any ideas what might be wrong I would be glad to help fix >> this. I look forward to your input. > > You seem to be hitting this assertion: > > FTS * > xfts_open (char * const *argv, int options, > int (*compar) (const FTSENT **, const FTSENT **)) > { > FTS *fts = fts_open (argv, options | FTS_CWDFD, compar); > if (fts == NULL) > { > /* This can fail in two ways: out of memory or with errno==EINVAL, > which indicates it was called with invalid bit_flags. */ > assert (errno != EINVAL); > xalloc_die (); > } > > return fts; > } > > Did you build the failing rm yourself? >>>From unmodified sources? > If so, please provide the precise ./configure and "make" > commands you used and tell us more about your system. > > As far as I know, this is the first report of such a problem, > so I suspect something about your environment is at least "unusual". > > There are only a few ways fts_open can return with errno > set to EINVAL, and none should be possible from coreutils programs: > > FTS * > fts_open (char * const *argv, > register int options, > int (*compar) (FTSENT const **, FTSENT const **)) > { > register FTS *sp; > register FTSENT *p, *root; > register size_t nitems; > FTSENT *parent = NULL; > FTSENT *tmp = NULL; /* pacify gcc */ > bool defer_stat; > > /* Options check. */ > if (options & ~FTS_OPTIONMASK) { > __set_errno (EINVAL); > return (NULL); > } > if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) { > __set_errno (EINVAL); > return (NULL); > } > if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) { > __set_errno (EINVAL); > return (NULL); > } > > Can you debug it and tell us which one it is? > -- Brad Mells Quantum Harmonics 889 Mowry Ave #86 Fremont CA 94536 619.808.2359 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 23 17:21:27 2010 Received: (at submit) by debbugs.gnu.org; 23 Jun 2010 21:21:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORXNv-0004bJ-57 for submit@debbugs.gnu.org; Wed, 23 Jun 2010 17:21:27 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORXNt-0004bA-1S for submit@debbugs.gnu.org; Wed, 23 Jun 2010 17:21:26 -0400 Received: from lists.gnu.org ([199.232.76.165]:51879) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORXNo-00068u-Jy for submit@debbugs.gnu.org; Wed, 23 Jun 2010 17:21:20 -0400 Received: from [140.186.70.92] (port=36317 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORXNk-0007NR-W1 for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:21:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORXFz-00064l-W1 for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:13:17 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:39956) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORXFz-00063t-9d for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:13:15 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 80277940109 for ; Wed, 23 Jun 2010 23:13:09 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 9A688999; Wed, 23 Jun 2010 23:13:06 +0200 (CEST) From: Jim Meyering To: Brad Subject: Re: rm 8.1 In-Reply-To: <4C227423.90105@outwild.net> (Brad's message of "Wed, 23 Jun 2010 13:52:51 -0700") References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> Date: Wed, 23 Jun 2010 23:13:06 +0200 Message-ID: <8739wd3125.fsf@meyering.net> Lines: 55 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Brad wrote: > Thanks for your help Jim. I tried to debug the program by running > gdb. I'm not sure if the backtrace has the information you need. ... > Please let me know if you have any > suggestions to get more information. Thanks for the details. Here's how to get more: First, recompile at least lib/fts.c using with -g added to CFLAGS, and relink say rm. Create a tiny tree in src/ that we'll remove: cd src # if you weren't there already mkdir -p a/b/c/d Then run gdb on rm: gdb rm set a breakpoint in fts_open (not xfts_open): b fts_open run rm on that tree: run -rf a/b/c/d Now, you'll see that gdb has stopped in fts_open. gdb's output will show the values of the function parameters, including the "options" variable. That's probably all I need, but just to be sure, continue a little further, and single step through it using "n" (for "next") until it returns: One of the following three return statements should trigger: if (options & ~FTS_OPTIONMASK) { __set_errno (EINVAL); return (NULL); } if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) { __set_errno (EINVAL); return (NULL); } if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) { __set_errno (EINVAL); return (NULL); } Then show us the output of the above commands. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 23 19:37:38 2010 Received: (at submit) by debbugs.gnu.org; 23 Jun 2010 23:37:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORZVi-0005Rk-5Y for submit@debbugs.gnu.org; Wed, 23 Jun 2010 19:37:38 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORXZn-0004fy-Bd for submit@debbugs.gnu.org; Wed, 23 Jun 2010 17:33:44 -0400 Received: from lists.gnu.org ([199.232.76.165]:43949) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORXZj-0006SK-6a for submit@debbugs.gnu.org; Wed, 23 Jun 2010 17:33:39 -0400 Received: from [140.186.70.92] (port=36328 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORXZg-0001nl-PF for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:33:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORXZf-0000Sp-5G for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:33:36 -0400 Received: from albert.xmlsockets.net ([216.218.196.66]:50927) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORXZe-0000SU-Tu for bug-coreutils@gnu.org; Wed, 23 Jun 2010 17:33:35 -0400 Received: from brads-powerbook58.local (c-24-130-94-194.hsd1.ca.comcast.net [24.130.94.194]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by albert.xmlsockets.net (Postfix) with ESMTPSA id 66E021B38FB; Wed, 23 Jun 2010 14:16:49 -0700 (PDT) Message-ID: <4C227DD7.2060602@harmonicskintones.com> Date: Wed, 23 Jun 2010 14:34:15 -0700 From: Brad User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Jim Meyering Subject: Re: rm 8.1 References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> <8739wd3125.fsf@meyering.net> In-Reply-To: <8739wd3125.fsf@meyering.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 23 Jun 2010 19:37:38 -0400 Cc: bug-coreutils@gnu.org, Brad X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) Thanks Jim! I knew you would know what to do. Please tell me what this all means. Here is the output you need: GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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-unknown-linux-gnu". For bug reporting instructions, please see: . (gdb) file rm Reading symbols from /home/brad/tools/core_debug/src/rm...done. (gdb) b fts_open Breakpoint 1 at 0x4015c8 (gdb) run -rf a/b/c/d Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at fts.c:92 92 { (gdb) n 100 if (options & ~FTS_OPTIONMASK) { (gdb) n 101 __set_errno (EINVAL); (gdb) n 201 } (gdb) n xfts_open (argv=0x7fffffffed08, options=536, compar=0) at ../../coreutils-8.5/lib/xfts.c:37 37 if (fts == NULL) (gdb) n 41 assert (errno != EINVAL); (gdb) n rm: ../../coreutils-8.5/lib/xfts.c:41: xfts_open: Assertion `(*__errno_location ()) != 22' failed. Program received signal SIGABRT, Aborted. 0x00007ffff7abb035 in *__GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 64 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); (gdb) n Program terminated with signal SIGABRT, Aborted. The program no longer exists. Jim Meyering wrote: > Brad wrote: >> Thanks for your help Jim. I tried to debug the program by running >> gdb. I'm not sure if the backtrace has the information you need. > ... >> Please let me know if you have any >> suggestions to get more information. > > Thanks for the details. > Here's how to get more: > > First, recompile at least lib/fts.c using with -g added to CFLAGS, > and relink say rm. > > Create a tiny tree in src/ that we'll remove: > > cd src # if you weren't there already > mkdir -p a/b/c/d > > Then run gdb on rm: > > gdb rm > > set a breakpoint in fts_open (not xfts_open): > > b fts_open > > run rm on that tree: > > run -rf a/b/c/d > > Now, you'll see that gdb has stopped in fts_open. > gdb's output will show the values of the function parameters, > including the "options" variable. > That's probably all I need, but just to be sure, continue > a little further, and single step through it using "n" (for "next") > until it returns: > > One of the following three return statements should trigger: > > if (options & ~FTS_OPTIONMASK) { > __set_errno (EINVAL); > return (NULL); > } > if ((options & FTS_NOCHDIR) && (options & FTS_CWDFD)) { > __set_errno (EINVAL); > return (NULL); > } > if ( ! (options & (FTS_LOGICAL | FTS_PHYSICAL))) { > __set_errno (EINVAL); > return (NULL); > } > > Then show us the output of the above commands. > > Thanks. > -- Brad Mells Quantum Harmonics 889 Mowry Ave #86 Fremont CA 94536 619.808.2359 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 24 01:19:30 2010 Received: (at submit) by debbugs.gnu.org; 24 Jun 2010 05:19:30 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OReqY-0007bg-5y for submit@debbugs.gnu.org; Thu, 24 Jun 2010 01:19:30 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OReqW-0007ba-B3 for submit@debbugs.gnu.org; Thu, 24 Jun 2010 01:19:29 -0400 Received: from lists.gnu.org ([199.232.76.165]:47079) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OReqT-0003wV-47 for submit@debbugs.gnu.org; Thu, 24 Jun 2010 01:19:25 -0400 Received: from [140.186.70.92] (port=42636 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OReqR-00067x-9U for bug-coreutils@gnu.org; Thu, 24 Jun 2010 01:19:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OReoS-0005Qb-NW for bug-coreutils@gnu.org; Thu, 24 Jun 2010 01:17:21 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:56324) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OReoS-0005Py-46 for bug-coreutils@gnu.org; Thu, 24 Jun 2010 01:17:20 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id 4AB029400EB for ; Thu, 24 Jun 2010 07:17:14 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 16023AE2; Thu, 24 Jun 2010 07:17:13 +0200 (CEST) From: Jim Meyering To: Brad Subject: Re: rm 8.1 In-Reply-To: <4C227DD7.2060602@harmonicskintones.com> (Brad's message of "Wed, 23 Jun 2010 14:34:15 -0700") References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> <8739wd3125.fsf@meyering.net> <4C227DD7.2060602@harmonicskintones.com> Date: Thu, 24 Jun 2010 07:17:13 +0200 Message-ID: <87r5jx102u.fsf@meyering.net> Lines: 60 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, Brad X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Brad wrote: ... > (gdb) run -rf a/b/c/d > Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d > > Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at > fts.c:92 > 92 { > (gdb) n > 100 if (options & ~FTS_OPTIONMASK) { > (gdb) n > 101 __set_errno (EINVAL); > (gdb) n > 201 } > (gdb) n > xfts_open (argv=0x7fffffffed08, options=536, compar=0) at > ../../coreutils-8.5/lib/xfts.c:37 Thanks. that "options" value is 0x218, which makes sense: # define FTS_NOSTAT 0x0008 /* don't get stat info */ # define FTS_PHYSICAL 0x0010 /* physical walk */ # define FTS_CWDFD 0x0200 int bit_flags = (FTS_CWDFD | FTS_NOSTAT | FTS_PHYSICAL); ... FTS *fts = xfts_open (file, bit_flags, NULL); The other value in that comparison should come from fts_.h: # define FTS_OPTIONMASK 0x07ff /* valid user option mask */ But is that actually the value used on your system? To find out, do this: cd lib rm fts.o make AM_CFLAGS='-E -dD' fts.o That is a hack to obtain C-preprocessed sources. Rename the file to have a sensible suffix, and so it doesn't interfere with a subsequent build: mv fts.o fts.i In my copy, I see this: if (options & ~0x07ff) { (*__errno_location ()) = (22); return (((void *)0)); } If you see the same thing, then suspect that your compiler is at fault. In that case, there's one more thing you can do: Repeat the steps you performed above, then run this command right after hitting the breakpoint, and tell us what it prints: print options & ~0x07ff From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 24 13:16:19 2010 Received: (at submit) by debbugs.gnu.org; 24 Jun 2010 17:16:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORq2F-0004WQ-6C for submit@debbugs.gnu.org; Thu, 24 Jun 2010 13:16:19 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORq2D-0004WJ-LP for submit@debbugs.gnu.org; Thu, 24 Jun 2010 13:16:18 -0400 Received: from lists.gnu.org ([199.232.76.165]:50154) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORq28-0008JS-VH for submit@debbugs.gnu.org; Thu, 24 Jun 2010 13:16:13 -0400 Received: from [140.186.70.92] (port=41903 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORq27-0002kG-6R for bug-coreutils@gnu.org; Thu, 24 Jun 2010 13:16:12 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORq25-0003g3-Ph for bug-coreutils@gnu.org; Thu, 24 Jun 2010 13:16:11 -0400 Received: from albert.xmlsockets.net ([216.218.196.66]:64217) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORq25-0003fP-LI for bug-coreutils@gnu.org; Thu, 24 Jun 2010 13:16:09 -0400 Received: from brads-powerbook58.local (c-24-130-94-194.hsd1.ca.comcast.net [24.130.94.194]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by albert.xmlsockets.net (Postfix) with ESMTPSA id 8E95C1B38FB; Thu, 24 Jun 2010 09:59:22 -0700 (PDT) Message-ID: <4C239305.10003@outwild.net> Date: Thu, 24 Jun 2010 10:16:53 -0700 From: Brad User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Jim Meyering Subject: Re: rm 8.1 References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> <8739wd3125.fsf@meyering.net> <4C227DD7.2060602@harmonicskintones.com> <87r5jx102u.fsf@meyering.net> In-Reply-To: <87r5jx102u.fsf@meyering.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, Brad X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) Hi Jim, my copy of fts.i looks the same as yours. Here is the additional gdb output: ### begin gdb ### Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at fts.c:92 92 { (gdb) print options & ~0x07ff $1 = 0 ### end gdb ### Please tell me what this means. I knew the bit flags from function rm in src/remove.c: int bit_flags = (FTS_CWDFD | FTS_NOSTAT | FTS_PHYSICAL); if (x->one_file_system) bit_flags |= FTS_XDEV; FTS *fts = xfts_open (file, bit_flags, NULL); and of course the option mask from lib/fts_.h: # define FTS_OPTIONMASK 0x07ff /* valid user option mask */ But how do you read this from the gdb output? Thanks for your help. I really appreciate your prompt attention to this matter. Please let me know if there is anything else you need me to do. Jim Meyering wrote: > Brad wrote: > ... >> (gdb) run -rf a/b/c/d >> Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d >> >> Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at >> fts.c:92 >> 92 { >> (gdb) n >> 100 if (options & ~FTS_OPTIONMASK) { >> (gdb) n >> 101 __set_errno (EINVAL); >> (gdb) n >> 201 } >> (gdb) n >> xfts_open (argv=0x7fffffffed08, options=536, compar=0) at >> ../../coreutils-8.5/lib/xfts.c:37 > > Thanks. that "options" value is 0x218, which makes sense: > > # define FTS_NOSTAT 0x0008 /* don't get stat info */ > # define FTS_PHYSICAL 0x0010 /* physical walk */ > # define FTS_CWDFD 0x0200 > > int bit_flags = (FTS_CWDFD | FTS_NOSTAT | FTS_PHYSICAL); > ... > FTS *fts = xfts_open (file, bit_flags, NULL); > > The other value in that comparison should come from fts_.h: > > # define FTS_OPTIONMASK 0x07ff /* valid user option mask */ > > But is that actually the value used on your system? > > To find out, do this: > > cd lib > rm fts.o > make AM_CFLAGS='-E -dD' fts.o > > That is a hack to obtain C-preprocessed sources. > Rename the file to have a sensible suffix, and so it > doesn't interfere with a subsequent build: > > mv fts.o fts.i > > In my copy, I see this: > > if (options & ~0x07ff) { > (*__errno_location ()) = (22); > return (((void *)0)); > } > > If you see the same thing, then suspect that your compiler is at fault. > In that case, there's one more thing you can do: > > Repeat the steps you performed above, then run this command right after > hitting the breakpoint, and tell us what it prints: > > print options & ~0x07ff > -- Brad Mells Quantum Harmonics 889 Mowry Ave #86 Fremont CA 94536 619.808.2359 From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 24 17:55:45 2010 Received: (at submit) by debbugs.gnu.org; 24 Jun 2010 21:55:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORuOf-0008TW-4c for submit@debbugs.gnu.org; Thu, 24 Jun 2010 17:55:45 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORuOd-0008TQ-PL for submit@debbugs.gnu.org; Thu, 24 Jun 2010 17:55:44 -0400 Received: from lists.gnu.org ([199.232.76.165]:52448) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1ORuOZ-0006dL-NQ for submit@debbugs.gnu.org; Thu, 24 Jun 2010 17:55:39 -0400 Received: from [140.186.70.92] (port=33228 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORuOX-0000Uq-TA for bug-coreutils@gnu.org; Thu, 24 Jun 2010 17:55:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORuOV-0004RX-Tg for bug-coreutils@gnu.org; Thu, 24 Jun 2010 17:55:37 -0400 Received: from albert.xmlsockets.net ([216.218.196.66]:62894) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORuOV-0004RL-Lm for bug-coreutils@gnu.org; Thu, 24 Jun 2010 17:55:35 -0400 Received: from brads-powerbook58.local (c-24-130-94-194.hsd1.ca.comcast.net [24.130.94.194]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by albert.xmlsockets.net (Postfix) with ESMTPSA id CB0441B38FB; Thu, 24 Jun 2010 14:38:46 -0700 (PDT) Message-ID: <4C23D483.7080401@outwild.net> Date: Thu, 24 Jun 2010 14:56:19 -0700 From: Brad User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: Brad Subject: Re: rm 8.1 References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> <8739wd3125.fsf@meyering.net> <4C227DD7.2060602@harmonicskintones.com> <87r5jx102u.fsf@meyering.net> <4C239305.10003@outwild.net> In-Reply-To: <4C239305.10003@outwild.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org, Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Hi Jim: After learning a little more about the debugger I was able to solve the problem. It is clear that the option test is not failing. However only one of three tests are being run because the code is linking to the new glibc. Therefore the program is calling the fts_open function defined in glibc-2.11.2/io/fts.c rather than lib/fts.c (which does three options checks). /* Options check. */ if (options & ~FTS_OPTIONMASK) { __set_errno (EINVAL); return (NULL); } /* Allocate/initialize the stream */ if ((sp = malloc((u_int)sizeof(FTS))) == NULL) return (NULL); So the code is failing at the subsequent call to malloc. A segmentation fault is occurring because the glibc version of fts_open is incompatible with the new coreutils. I fixed this on my system by redefining fts_open() as _fts_open(). That way there is no pollution of the namespace. Here are the diffs: diff fts_.h ../../core_source/lib/fts_.h 254c254 < FTS *_fts_open (char * const *, int, --- > FTS *fts_open (char * const *, int, diff fts.c ../../core_source/lib/fts.c 362c362 < _fts_open (char * const *argv, --- > fts_open (char * const *argv, diff xfts.c ../../core_source/lib/xfts.c 36c36 < FTS *fts = _fts_open (argv, options | FTS_CWDFD, compar); --- > FTS *fts = fts_open (argv, options | FTS_CWDFD, compar); I think that's it. It's probably not a good idea to redefine a function that's already defined in a linked library. The behavior is undefined in C because it depends upon the linkage order that is determined by the compiler. I hope this helps. Thank you for all of your savvy guidance. Best wishes, Brad Brad wrote: > Hi Jim, my copy of fts.i looks the same as yours. Here is the additional > gdb output: > > ### begin gdb ### > Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d > > Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at > fts.c:92 > 92 { > (gdb) print options & ~0x07ff > $1 = 0 > > ### end gdb ### > > Please tell me what this means. I knew the bit flags from function rm in > src/remove.c: > > int bit_flags = (FTS_CWDFD > | FTS_NOSTAT > | FTS_PHYSICAL); > > if (x->one_file_system) > bit_flags |= FTS_XDEV; > > FTS *fts = xfts_open (file, bit_flags, NULL); > > > and of course the option mask from lib/fts_.h: > > # define FTS_OPTIONMASK 0x07ff /* valid user option mask */ > > But how do you read this from the gdb output? > > Thanks for your help. I really appreciate your prompt attention to this > matter. Please let me know if there is anything else you need me to do. > > > Jim Meyering wrote: >> Brad wrote: >> ... >>> (gdb) run -rf a/b/c/d >>> Starting program: /home/brad/tools/core_debug/src/rm -rf a/b/c/d >>> >>> Breakpoint 1, fts_open (argv=0x7fffffffed08, options=536, compar=0) at >>> fts.c:92 >>> 92 { >>> (gdb) n >>> 100 if (options & ~FTS_OPTIONMASK) { >>> (gdb) n >>> 101 __set_errno (EINVAL); >>> (gdb) n >>> 201 } >>> (gdb) n >>> xfts_open (argv=0x7fffffffed08, options=536, compar=0) at >>> ../../coreutils-8.5/lib/xfts.c:37 >> >> Thanks. that "options" value is 0x218, which makes sense: >> >> # define FTS_NOSTAT 0x0008 /* don't get stat info */ >> # define FTS_PHYSICAL 0x0010 /* physical walk */ >> # define FTS_CWDFD 0x0200 >> >> int bit_flags = (FTS_CWDFD | FTS_NOSTAT | FTS_PHYSICAL); >> ... >> FTS *fts = xfts_open (file, bit_flags, NULL); >> >> The other value in that comparison should come from fts_.h: >> >> # define FTS_OPTIONMASK 0x07ff /* valid user option mask */ >> >> But is that actually the value used on your system? >> >> To find out, do this: >> >> cd lib >> rm fts.o >> make AM_CFLAGS='-E -dD' fts.o >> >> That is a hack to obtain C-preprocessed sources. >> Rename the file to have a sensible suffix, and so it >> doesn't interfere with a subsequent build: >> >> mv fts.o fts.i >> >> In my copy, I see this: >> >> if (options & ~0x07ff) { >> (*__errno_location ()) = (22); >> return (((void *)0)); >> } >> >> If you see the same thing, then suspect that your compiler is at fault. >> In that case, there's one more thing you can do: >> >> Repeat the steps you performed above, then run this command right after >> hitting the breakpoint, and tell us what it prints: >> >> print options & ~0x07ff >> > -- Brad Mells Quantum Harmonics 889 Mowry Ave #86 Fremont CA 94536 619.808.2359 From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 25 01:17:32 2010 Received: (at submit) by debbugs.gnu.org; 25 Jun 2010 05:17:32 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OS1IB-0004Gr-Pn for submit@debbugs.gnu.org; Fri, 25 Jun 2010 01:17:31 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OS1IA-0004Gc-DL for submit@debbugs.gnu.org; Fri, 25 Jun 2010 01:17:31 -0400 Received: from lists.gnu.org ([199.232.76.165]:43921) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OS1I7-0003UB-2I for submit@debbugs.gnu.org; Fri, 25 Jun 2010 01:17:27 -0400 Received: from [140.186.70.92] (port=34051 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OS1I5-0003Sw-Fp for bug-coreutils@gnu.org; Fri, 25 Jun 2010 01:17:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OS1I4-0006e4-Bz for bug-coreutils@gnu.org; Fri, 25 Jun 2010 01:17:25 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:45504) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OS1I3-0006dl-OE for bug-coreutils@gnu.org; Fri, 25 Jun 2010 01:17:24 -0400 Received: from mx.meyering.net (unknown [82.230.74.64]) by smtp1-g21.free.fr (Postfix) with ESMTP id EB8CC940060; Fri, 25 Jun 2010 07:17:16 +0200 (CEST) Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 9941AEA0; Fri, 25 Jun 2010 07:17:15 +0200 (CEST) From: Jim Meyering To: Brad Subject: Re: rm 8.1 In-Reply-To: <4C23D483.7080401@outwild.net> (Brad's message of "Thu, 24 Jun 2010 14:56:19 -0700") References: <4C223B1A.8020307@outwild.net> <87eifx34ix.fsf@meyering.net> <4C227423.90105@outwild.net> <8739wd3125.fsf@meyering.net> <4C227DD7.2060602@harmonicskintones.com> <87r5jx102u.fsf@meyering.net> <4C239305.10003@outwild.net> <4C23D483.7080401@outwild.net> Date: Fri, 25 Jun 2010 07:17:15 +0200 Message-ID: <876317u1wk.fsf@meyering.net> Lines: 54 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: submit Cc: 6500-done@debbugs.gnu.org, bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.4 (-----) Brad wrote: > Hi Jim: > > After learning a little more about the debugger I was able to solve > the problem. Good. > It is clear that the option test is not failing. However only one of > three tests are being run because the code is linking to the new > glibc. Therefore the program is calling the fts_open function defined Think of this as a warning about your compiler and linker options. > in glibc-2.11.2/io/fts.c rather than lib/fts.c (which does three > options checks). > > /* Options check. */ > if (options & ~FTS_OPTIONMASK) { > __set_errno (EINVAL); > return (NULL); > } > > /* Allocate/initialize the stream */ > if ((sp = malloc((u_int)sizeof(FTS))) == NULL) > return (NULL); > > So the code is failing at the subsequent call to malloc. A > segmentation fault is occurring because the glibc version of fts_open > is incompatible with the new coreutils. > > I fixed this on my system by redefining fts_open() as > _fts_open(). That way there is no pollution of the namespace. Be careful. That may well be insufficient, in merely papering over the most apparent problem. > Here are the diffs: ... > I think that's it. It's probably not a good idea to redefine a > function that's already defined in a linked library. Actually, that's fine. > The behavior is > undefined in C because it depends upon the linkage order that is > determined by the compiler. This is the problem. Don't link the C library (-lc) before a projects' own library (lib/libcoreutils.a). I'm marking this bug as resolved, but you're welcome to reply if you have anything to add. From unknown Sun Jun 15 08:33:21 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 23 Jul 2010 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator