Subject: bug#6500: rm 8.1

From: Jim Meyering <[email-masked]>
Date: Wed, 23 Jun 2010 23:13:06 +0200

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.