Messages in this thread | | | Date | Mon, 6 Mar 2000 12:36:54 +0100 | From | almesber@lrc ... | Subject | Re: bug: mount on an open directory succeeds |
| |
Alexander Viro wrote: > Look: step of lookup ends with the step upwards. It's 3-d structure, not > 2-d one. You are getting exactly what you ask for - "." is "do the step > with zero horizontal part". E.g. "go upwards". Which is no-op for > everything except the mountpoints. Your problem being?
According to POSIX ANSI/IEEE Std 1003.1 (2nd ed., 1996-07-12):
"If the pathname does not begin with a slash, the predecessor of the first filename of the pathname is taken to be the current working directory of the process [...]"
and
"The special filename, dot, refers to the directory specified by its predecessor."
So it seems at best questionable (1) to me if
chdir("/foo"); stat(".",&st1); mount(...,"/foo",...); stat(".",&st2);
yields different st1 and st2 (2), and quite clearly a violation of POSIX if
stat("bar",&st1); stat("./bar",&st2);
yields different st1 and st2 in any case (2). "." is _meant_ to be a no-op.
(1) "questionable", because POSIX explicitly excludes the mount operation, so by using mount(), this example is outside the scope of the standard. (2) In the absence of races with other code changing any of the objects.
- Werner
-- _________________________________________________________________________ / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch / /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |