Re: `rmdir .` doesn't work in 2.4

2001-01-12 Thread Pavel Machek
Hi! > The bottom line: rmdir(".") is gone. Replace it with portable equivalent, > namely > p = getcwd(pwd, sizeof(pwd)); > if (!p) > /* handle error - ERANGE or ENOENT */ > rmdir(p); > Shell equivalent is rmdir `pwd`. Also portable. ...when you are lucky and all d

Re: `rmdir .` doesn't work in 2.4

2001-01-11 Thread Bernhard Rosenkraenzer
On Mon, 8 Jan 2001, Benson Chow wrote: > Not very portable at all... > > hpux = HP/UX 10.2 > > hpux:~/foo$ rmdir . > rmdir: cannot remove .. or . Same on FreeBSD, by the way bash-2.04# uname -a FreeBSD freebsd.redhat.de 5.0-20001112-CURRENT FreeBSD 5.0-20001112-CURRENT #0: Sun Nov 12 14:04:55 G

Re: `rmdir .` doesn't work in 2.4

2001-01-10 Thread Matthias Andree
On Mon, 08 Jan 2001, Andrea Arcangeli wrote: > On Mon, Jan 08, 2001 at 09:56:18PM +0100, [EMAIL PROTECTED] wrote: > Hardlinks have nothing to do with `rmdir .`. See rmdir . as the equivalent > pointed out by Alexander: "rmdir `pwd`". `pwd` returns the same thing You can't delete immutable direc

Re: `rmdir .` doesn't work in 2.4

2001-01-10 Thread Andrea Arcangeli
On Wed, Jan 10, 2001 at 12:28:38PM -0500, Alexander Viro wrote: > That's precisely what I've already done. grep for IS_DEADDIR() and notice Fine ;) Andrea - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] Please read the FAQ a

Re: `rmdir .` doesn't work in 2.4

2001-01-10 Thread Alexander Viro
On Wed, 10 Jan 2001, Andrea Arcangeli wrote: > > Do we have enough protection to ensure this for other filesystems? > > Note that this has nothing to do with `rmdir .`. You will run into the > mentioned issue just now with '''rmdir "`pwd`"'''. I've not checked > the other fses but I would put

Re: `rmdir .` doesn't work in 2.4

2001-01-10 Thread Andrea Arcangeli
On Wed, Jan 10, 2001 at 02:47:35PM +, Stephen C. Tweedie wrote: > Hi, > > On Tue, Jan 09, 2001 at 03:06:35PM +0100, Andrea Arcangeli wrote: > > On Tue, Jan 09, 2001 at 07:41:21AM -0600, Jesse Pollard wrote: > > > Not exactly valid, since a file could be created in that "pinned" directory > >

Re: `rmdir .` doesn't work in 2.4

2001-01-10 Thread Stephen C. Tweedie
Hi, On Tue, Jan 09, 2001 at 03:06:35PM +0100, Andrea Arcangeli wrote: > On Tue, Jan 09, 2001 at 07:41:21AM -0600, Jesse Pollard wrote: > > Not exactly valid, since a file could be created in that "pinned" directory > > after the rmdir... > > In 2.2.x no file can be created in the pinned director

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Alexander Viro
On Tue, 9 Jan 2001, Albert D. Cahalan wrote: > As long as nobody tried to remove ".", nothing is serialized. > You can do your lookups in parallel since they can all grab > the read lock at once. Bzzzert. At which point do you take that lock for rmdir("foo/bar/barf/.")? > Linux can tell where

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Albert D. Cahalan
Alexander Viro writes: > On Tue, 9 Jan 2001, Albert D. Cahalan wrote: >> Alexander Viro writes: >> >>> [...] If you really need to destroy the directory >>> that happens to be your pwd - sorry, no reliable way to do that without >>> interesting locking. On _any_ UNIX out there. 2.2 included. It wi

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Kurt Roeckx
On Mon, Jan 08, 2001 at 11:50:44PM +0100, [EMAIL PROTECTED] wrote: > From: Andrea Arcangeli <[EMAIL PROTECTED]> > > > But in fact it fails with EINVAL, and > > > > [EINVAL]: The path argument contains a last component that is dot. > > I can't confirm. The specs I'm checking

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Alexander Viro
On Tue, 9 Jan 2001, Albert D. Cahalan wrote: > Alexander Viro writes: > > > [...] If you really need to destroy the directory > > that happens to be your pwd - sorry, no reliable way to do that without > > interesting locking. On _any_ UNIX out there. 2.2 included. It will > > happily give you

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Jesse Pollard
> On Tue, 9 Jan 2001, Jesse Pollard wrote: > > > Not exactly valid, since a file could be created in that "pinned" directory > > after the rmdir... > > No, it couldn't (if you can show a testcase when it would - please do, you've > found a bug). Moreover, busy directories can be removed in 2.4

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Alexander Viro
On Tue, 9 Jan 2001, Jesse Pollard wrote: > Not exactly valid, since a file could be created in that "pinned" directory > after the rmdir... No, it couldn't (if you can show a testcase when it would - please do, you've found a bug). Moreover, busy directories can be removed in 2.4 quite fine -

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Andrea Arcangeli
On Tue, Jan 09, 2001 at 07:41:21AM -0600, Jesse Pollard wrote: > Not exactly valid, since a file could be created in that "pinned" directory > after the rmdir... In 2.2.x no file can be created in the pinned directory after the rmdir. Andrea - To unsubscribe from this list: send the line "unsubs

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Albert D. Cahalan
Alexander Viro writes: > [...] If you really need to destroy the directory > that happens to be your pwd - sorry, no reliable way to do that without > interesting locking. On _any_ UNIX out there. 2.2 included. It will > happily give you -ENOENT and refuse to perform the action above in > case if

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Stephen C. Tweedie
Hi, On Mon, Jan 08, 2001 at 09:28:33PM +0100, Andrea Arcangeli wrote: > On Mon, Jan 08, 2001 at 12:58:20PM -0500, Alexander Viro wrote: > > It's a hell of a pain wrt locking. You need to lock the parent, but it can > > This is a no-brainer and bad implementation, but shows it's obviously right >

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Stephen C. Tweedie
Hi, On Tue, Jan 09, 2001 at 01:01:25AM +0100, Andrea Arcangeli wrote: > On Mon, Jan 08, 2001 at 03:27:21PM -0800, Linus Torvalds wrote: > > However, it is against all UNIX standards, and Linux-2.4 will explicitly > > I may be missing something but apparently SuSv2 allows it, you can check here:

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Jesse Pollard
- Received message begins Here - > > Hello Al, > > why `rmdir .` is been deprecated in 2.4.x? I wrote software that depends on > `rmdir .` to work (it's local software only for myself so I don't care that it > may not work on unix) and I'm getting flooded by failing cronjobs

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Alexander Viro
On Mon, 8 Jan 2001, Stefan Traby wrote: > On Mon, Jan 08, 2001 at 12:58:20PM -0500, Alexander Viro wrote: > > > Shell equivalent is rmdir `pwd`. Also portable. > > Very portable - not. > > rmdir "`pwd`" !!! OK, got me on that. Yes, you'll need quoting here. Sorry. Notice that there

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Andries . Brouwer
> I trust your specs said so, however I'm not sure which are the specs > we should follow for Linux. > At least for LFS 2.2.x fixage I always followed the SuSv2 specs We are Linux, and free to do whatever we want. However, following POSIX makes a large body of software available. It would be ver

Re: `rmdir .` doesn't work in 2.4

2001-01-09 Thread Eric Lammerts
On Tue, 9 Jan 2001, Stefan Traby wrote: > "rmdir `pwd`" is required to fail (at least under csh, bash, ksh) if the > path component contains a white space and thereof it can't be a valid > replacement for Andreas "rmdir ." which was what Al initially suggested. > > Yes, I'm very pickey about that

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Stefan Traby
On Mon, Jan 08, 2001 at 03:28:29PM -0800, Linus Torvalds wrote: > But at least "rmdir `pwd`" is not _required_ to fail, like rmdir("."/".."). "rmdir `pwd`" is required to fail (at least under csh, bash, ksh) if the path component contains a white space and thereof it can't be a valid replacement

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Marc Lehmann
On Tue, Jan 09, 2001 at 02:55:15AM +0100, Andrea Arcangeli <[EMAIL PROTECTED]> wrote: > > [wakko@:/home/wakko/test] rmdir "`pwd`" > > rmdir: /home/wakko/test: Invalid argument > > Some other OS with a yet different retval? :) It can be much worse (irix-6.5.4): bash# mkdir x; cd x; rmdir "`pw

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 08:37:22PM -0500, Wakko Warner wrote: > [wakko@:/home/wakko/test] rmdir "`pwd`" > rmdir: /home/wakko/test: Invalid argument Some other OS with a yet different retval? :) Andrea - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a mess

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Wakko Warner
> Not very portable at all... > > hpux = HP/UX 10.2 > > hpux:~$ mkdir foo > hpux:~$ cd foo > hpux:~/foo$ rmdir "`pwd`" > rmdir: /home/blc/foo: Cannot remove mountable directory > hpux:~/foo$ rmdir . > rmdir: cannot remove .. or . > hpux:~/foo$ rmdir /home/blc/foo > rmdir: /home/blc/foo: Cannot r

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 03:27:21PM -0800, Linus Torvalds wrote: > However, it is against all UNIX standards, and Linux-2.4 will explicitly I may be missing something but apparently SuSv2 allows it, you can check here: http://www.opengroup.org/onlinepubs/007908799/xsh/rmdir.html Infact S

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Linus Torvalds
In article <[EMAIL PROTECTED]>, Andrea Arcangeli <[EMAIL PROTECTED]> wrote: >On Mon, Jan 08, 2001 at 04:08:58PM -0500, Alexander Viro wrote: >> Andrea, fix your code. Linux-only stuff is OK when there is no > >BTW, "rmdir `pwd`" is not portable either. Indeed. Avoid it if you can. But at l

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Linus Torvalds
In article <[EMAIL PROTECTED]>, Andrea Arcangeli <[EMAIL PROTECTED]> wrote: >On Mon, Jan 08, 2001 at 01:04:24PM -0500, Alexander Viro wrote: >> Racy. Nonportable. Has portable and simple equivalent. Again, don't >> bother with chdir at all - if you know the name of directory even >> ../name will

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 11:50:44PM +0100, [EMAIL PROTECTED] wrote: > From: Andrea Arcangeli <[EMAIL PROTECTED]> > > > But in fact it fails with EINVAL, and > > > > [EINVAL]: The path argument contains a last component that is dot. > > I can't confirm. The specs I'm checking

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andries . Brouwer
From: Andrea Arcangeli <[EMAIL PROTECTED]> > But in fact it fails with EINVAL, and > > [EINVAL]: The path argument contains a last component that is dot. I can't confirm. The specs I'm checking are here: http://www.opengroup.org/onlinepubs/007908799/xsh/rmdir.html

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 03:11:08PM -0700, Benson Chow wrote: > Not very portable at all... > > hpux = HP/UX 10.2 > > hpux:~$ mkdir foo > hpux:~$ cd foo > hpux:~/foo$ rmdir "`pwd`" > rmdir: /home/blc/foo: Cannot remove mountable directory > hpux:~/foo$ rmdir . > rmdir: cannot remove .. or . > hpu

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Benson Chow
of it till it's done with it... -bc On Mon, 8 Jan 2001, Stefan Traby wrote: > Date: Mon, 8 Jan 2001 22:54:51 +0100 > From: Stefan Traby <[EMAIL PROTECTED]> > To: Alexander Viro <[EMAIL PROTECTED]> > Cc: Andrea Arcangeli <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 04:08:58PM -0500, Alexander Viro wrote: > Andrea, fix your code. Linux-only stuff is OK when there is no BTW, "rmdir `pwd`" is not portable either. > portable way to achieve the same result. In your situation such way indeed > exists and is prefectly doable in userl

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Stefan Traby
On Mon, Jan 08, 2001 at 12:58:20PM -0500, Alexander Viro wrote: > Shell equivalent is rmdir `pwd`. Also portable. Very portable - not. rmdir "`pwd`" !!! -- ciao - Stefan " ( cd /lib ; ln -s libBrokenLocale-2.2.so libNiedersachsen.so ) " Stefan TrabyLinux/

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 09:56:18PM +0100, [EMAIL PROTECTED] wrote: > You think that it fails with EBUSY. That would be allowed but not required: > > [EBUSY]: The directory to be removed is currently in use by > the system or some process and the implementation > considers this t

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Alexander Viro
On Mon, 8 Jan 2001, Andrea Arcangeli wrote: > On Mon, Jan 08, 2001 at 01:04:24PM -0500, Alexander Viro wrote: > > Racy. Nonportable. Has portable and simple equivalent. Again, don't > > bother with chdir at all - if you know the name of directory even > > ../name will work. It's not about the c

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andries . Brouwer
> why `rmdir .` is been deprecated in 2.4.x? > `rmdir .` makes perfect sense, the cwd dentry remains pinned You think that it fails with EBUSY. That would be allowed but not required: [EBUSY]: The directory to be removed is currently in use by the system or some process and the impleme

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 01:04:24PM -0500, Alexander Viro wrote: > Racy. Nonportable. Has portable and simple equivalent. Again, don't > bother with chdir at all - if you know the name of directory even > ../name will work. It's not about the current directory. It's about > the invalid last compone

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 12:58:20PM -0500, Alexander Viro wrote: > It's a hell of a pain wrt locking. You need to lock the parent, but it can This is a no-brainer and bad implementation, but shows it's obviously right wrt locking. (pseudocode, I ignored the uaccess details and all the other not re

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Alexander Viro
On Mon, 8 Jan 2001, Andrea Arcangeli wrote: > in userspace, but I think the old behaviour was more flexible (it was also > showing how much our dcache is powerful) and I still don't see why it's been > removed. Maybe it was to remove a branch from a fast path? (if so I don't > think it was a g

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Alexander Viro
On Mon, 8 Jan 2001, Andrea Arcangeli wrote: > Hello Al, > > why `rmdir .` is been deprecated in 2.4.x? I wrote software that depends on > `rmdir .` to work (it's local software only for myself so I don't care that it > may not work on unix) and I'm getting flooded by failing cronjobs since I

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
On Mon, Jan 08, 2001 at 12:31:29PM -0500, Mohammad A. Haque wrote: > I fail to see why this is useful. you can't do anything in the directory > afterwards. > > bash# mkdir foobar > bash# cd foobar/ > bash# ls > bash# rmdir . > bash# touch foo > touch: foo: Operation not permitted > bash#

Re: `rmdir .` doesn't work in 2.4

2001-01-08 Thread Mohammad A. Haque
I fail to see why this is useful. you can't do anything in the directory afterwards. bash# mkdir foobar bash# cd foobar/ bash# ls bash# rmdir . bash# touch foo touch: foo: Operation not permitted bash# ls Whats the point of it? On Mon, 8 Jan 2001, Andrea Arcangeli wrote: > Hello Al, >

`rmdir .` doesn't work in 2.4

2001-01-08 Thread Andrea Arcangeli
Hello Al, why `rmdir .` is been deprecated in 2.4.x? I wrote software that depends on `rmdir .` to work (it's local software only for myself so I don't care that it may not work on unix) and I'm getting flooded by failing cronjobs since I put 2.4.0 on such machine. `rmdir .` makes perfect sense