bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm patch suggestion


From: Oystein Viggen
Subject: Re: rm patch suggestion
Date: Wed, 08 May 2002 23:13:08 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.1 (Capitol Reef, i386-debian-linux)

* [Roland McGrath] 

> You'll have to tell me specifically what Hurd details you are talking
> about, not refer to what someone else speculated earlier.  You seem to be
> confused, and I cannot help if you do not spell out what you think is going
> on.

As to what is going on behind the scenes, I really don't have much of a
clue.  I think I can explain quite well what I'm seeing, though:

I have a program that does the following (uninteresting parts omitted):


        i = open(dir, O_RDONLY|O_NOTRANS);

        if (fstat(i, &s) != 0){
                perror("fatal error");
                exit(7);
        }

        if (s.st_mode & S_ITRANS) {
                printf("%s is a translator\n", dir);
        } else {
                printf("%s is not a translator\n", dir);
        }
        sleep(5);
        fchdir(i);

        d = opendir(".");
        while (de = readdir(d)) {
                printf("found %s\n", de->d_name);
        }

I have done basically three test cases for this:

1. Run it on a untranslated directory.  Works nicely, and prints out the
   contents.

2. Run it on a node with a translator attached. (/hurd/firmink /tmp).
   This warns me that the node has a translator attached to it, and
   makes the while loop print to me the contents of /tmp.

3. Start it on a node with no translator attached, wait for the "is not
   a translator message", and then attach the same translator as in
   example 2 during the 5 second sleep. (ie. force a race condition to
   occur).  This also makes the program print the contents of /tmp.

The node/directory in question is owned by user oysteivi.  The same user
also sets the translator.  The test program is run by root.

When I open(dir, O_NOTRANS) in example 2, I figure this would give me a
file handle, and thus a port, to the underlying node.  In example 3
there is not even a translator present.  For this reason, I would expect
fchdir(i) to change my current working directory to the underlying node,
which is the one I open()ed in the first place, and not the translated
one.  According to opendir() and readdir() I'm put inside the translator
no matter what I do.

Please ask again if I'm still missing something or you need more info.

Oystein
-- 
When in doubt: Recompile.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]