[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DogCows or Polymorphism in the Hurd
From: |
Marcus Brinkmann |
Subject: |
Re: DogCows or Polymorphism in the Hurd |
Date: |
Mon, 06 Feb 2006 23:31:50 +0100 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (Sanjō) APEL/10.6 Emacs/21.4 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI) |
At Mon, 06 Feb 2006 14:03:28 +0100,
address@hidden (Ludovic Courtès) wrote:
> On GNU/Linux with, say, an ext[23] filesystem, a directory does not
> implement the file interface, only the directory interface. Thus, for
> instance, `cat DIR' returns `EISDIR'.
>
> On some other systems (e.g., Tru64 with AdvFS IIRC), directories do
> implement both interfaces. So there, one can `cat' the contents of a
> directory and it just shows its ``binary content''.
>
> This difference doesn't preclude good behavior of `grep', `find' and
> friends. This is because those programs call `stat ()' before actually
> accessing the node, and look at the value of `S_ISDIR ()' _before_
> looking at the value of `S_ISREG ()'. In OO terms: they check for the
> most specialized type first.
>
> IOW, the `st_mode' field can be viewed as a poor man's type system. ;-)
Unfortunately, the actual behaviour of these utilities seems to be
much more complex than you describe.
For example, "rm -fR foo" first may try to simply unlink() foo,
without a stat. Then, when it recurses, it may look at the directory
entry's "d_type" field. As it happens, on the Hurd, d_type contains
the type of the _underlying_ node, not of the translated node, d'oh!
In the presence of hybrid or translated nodes, these tools can behave
in a difficult to predict way.
Thanks,
Marcus
- Re: Perils of Config Files (was DogCows or Polymorphism in the Hurd), (continued)
- Re: Perils of Config Files (was DogCows or Polymorphism in the Hurd), Marcus Brinkmann, 2006/02/09
- Re: Perils of Config Files (was DogCows or Polymorphism in the Hurd), Jonathan S. Shapiro, 2006/02/09
- Re: Perils of Config Files (was DogCows or Polymorphism in the Hurd), Jonathan S. Shapiro, 2006/02/09
- Re: DogCows or Polymorphism in the Hurd, Jonathan S. Shapiro, 2006/02/07
- Re: DogCows or Polymorphism in the Hurd, Marcus Brinkmann, 2006/02/07
Re: DogCows or Polymorphism in the Hurd, Ludovic Courtès, 2006/02/06
Re: DogCows or Polymorphism in the Hurd, Patrick Negre, 2006/02/06