delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/08/08:46:59

Date: Wed, 8 Mar 2000 12:17:13 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "nimrod a. abing" <synflood AT eudoramail DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: rm -d and mangled fat entries
In-Reply-To: <MIFKPJBDGBMAAAAA@shared1-mail.whowhere.com>
Message-ID: <Pine.SUN.3.91.1000308121656.6599P-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 8 Mar 2000, nimrod a. abing wrote:

> BTW: I read in the rm info page that rm -d will:
> 
> Remove directories with `unlink' instead of
> `rmdir', and don't require a directory to be 
> empty before trying to unlink it.  Only
> works if you have appropriate privileges.  
> Because unlinking a directory causes any files 
> in the deleted directory to become 
> unreferenced, it is wise to `fsck' the 
> filesystem after doing this.
> 
> This is why I am pretty sure that my misuse of
> rm caused all this.

I don't see how this could happen.  When you pass the -d switch, rm
simply calls the `unlink' function, which in the DJGPP incarnation is
the same as `remove'.  This eventually causes the program to call
function 3Ah or 713Ah of Interrupt 21h, which tries to remove the
directory.  DOS and Windows don't allow to remove a non-empty
directory, so all you should get is an error message.

I just tried "rm -d foo" (where `foo' is a non-empty directory) on my
Windows 95 system, and all I get is this:

  rm: foo: Permission denied (EACCES)

which is what I'd expect.  So I think your unmovable blocks are not
caused by rm.

The fragment from the manual which you cited above has no bearing on
the DJGPP port, since you cannot unlink a non-empty directory on
systems supported by DJGPP.  In other words, the system calls used by
`rmdir' and `unlink' functions are identical in the DJGPP library.  So
the -d switch is largely a no-op in the DJGPP port.

> If anyone out there knows of an fsck workalike, plz let me know.

It's called SCANDISK on Windows.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019