Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2000 02:28:51 -0400
From:      "Thimble Smith" <tim@mysql.com>
To:        freebsd-stable@freebsd.org
Subject:   weirdness w/ gdb (and others) and home directory
Message-ID:  <20000410022851.B8117@threads.polyesthetic.msg>

next in thread | raw e-mail | index | archive | help
Hi.  I'm seeing some "weird" stuff with my 4.0-STABLE box.  The
symptom is:

    tim:/tmp$ gdb /bin/pwd
    GNU gdb 4.18

    [License]

    This GDB was configured as "i386-unknown-freebsd"...
    (no debugging symbols found)...
    (gdb) run
    Starting program: /bin/pwd 
    warning: shared library handler failed to enable breakpoint
    /usr/home/tim

    Program exited normally.
    (gdb) 


It prints "/usr/home/tim", even though I was in "/tmp" when I ran
it.

It's not gdb, I'm quite sure.  A 3.4-STABLE box doesn't do this.  I
started trying to figure this out because I was trying to use cook
(/usr/ports/devel/cook), and any recipe that redirected output to
a file would put that file in my home directory, no matter where I
ran cook from.

For example, when I run the following script I get:

    tim:/usr/tmp/junk$ sh thetest.sh 
    /* Howto.list, /tmp/cook-test, Mon Apr 10 02:03 2000 */
    cook: pwd > junk
    cook: ln -s /tmp/cook-test not-junk
    1c1
    < total 8
    ---
    > total 9
    6a7
    > -rw-r--r--   1 tim  tim    10 Apr 10 02:03 junk
    /home/tim
    lrwxr-xr-x  1 tim  wheel  14 Apr 10 02:03 /tmp/cook-test/not-junk -> /tmp/cook-test


Here's the script:

    #! /bin/sh

    test -e /tmp/cook-test && rm -rf /tmp/cook-test
    mkdir /tmp/cook-test || exit 2
    cd /tmp/cook-test || exit 2
    cat <<EOF > Howto.cook
    all: junk not-junk ;

    /* this will create a file in my home directory! */
    junk:
    {
            pwd > junk;
    }

    /* this does what I want it to - put a symlink in the current dir */
    not-junk:
    {
            ln -s `pwd` not-junk;
    }
    EOF

    /bin/ls -l $HOME > before

    cook

    /bin/ls -l $HOME > after

    diff before after

    cat $HOME/junk
    ls -l /tmp/cook-test/not-junk

    exit 0


I don't know what these two things have in common.  Make can redirect
output just fine.  The shell does just fine, too.  I'm trying to run
through the source code for cook to see exactly what it does, but I
haven't traced the problem yet.  I don't even know where to start with
looking at gdb's code.

tim:/home/tim$ uname -a
FreeBSD threads.polyesthetic.msg 4.0-STABLE FreeBSD 4.0-STABLE #3: Tue Mar 21 02:31:14 EST 2000     root@threads.polyesthetic.msg:/usr/src/sys/compile/THREADS  i386

I'm wondering, is anyone else seeing this?  Can anyone give me a hint
about where I should be looking to track this down?  I haven't seen
any mention of it in -stable, -current or -bugs.

If you're not seeing this, I'd appreciate your letting me know that,
too, so I can narrow down the number of things I have to look at.

Thanks a lot,

Tim


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000410022851.B8117>