cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Potentially wiped disk with Makefile.b32

From: Yang Tse <yangsita_at_gmail.com>
Date: Tue, 22 Mar 2011 16:14:50 +0100

2011/3/22 Gisle Vanem wrote:

> I have a big problem with the use of "rmdir /s" in the Makefile.b32 files.
> The 'make clean' could really create mayhem for a inexperienced user or
> from a small error/typo in these makefiles. Here is a warning in this regard
> (from the 4nt shell docs):
> /S (Subdirectories) (4NT, TC) This option is included only for
> compatibility
> with Windows NT 4.0's CMD.EXE, and should be used with EXTREME CAUTION!
> It deletes all files (including hidden and system files) in the named
> directory and all of its subdirectories, then removes all subdirectories.
> It can potentially erase all files on a drive with a single command.

Yep, any command capable of removing a subdirectory and all of its
contents on any system has this behavior.

> This can happen if $(OBJDIR) becomes '\' for some reason.

Well, $(OBJDIR) is hardcoded to ".\objs" in line # 53, so I would say
it is not actually a problem of current Makefile.b32.
On the other hand, if things can be done more safely I'm all for it.

> To fix it, we should 'make clean' in 3 steps (delete the .obj, .int and the
> dir itself).

OK.

> Are you reading this Yang? I could do this myself, but you seems to know
> Borland's make much better.

Currently I have no Borland compiler installation to test any changes,
so it is better if you introduce required changes to the removal of
$(OBJDIR).

> Also there is a problem if you have e.g. 'rmdir.exe' on path (like i have
> with
> CygWin's /usr/bin/rmdir.exe). AFAICS Borland's make doesn't have 'del',
> 'rmdir' etc. internally (like wmake have). So if you have 'rmdir.exe on
> path, 'make clean' doesn't work as intended. I think it would be better to
> let the shell perform the 'del',
> 'rmdir' etc.

Hmmm, now I start to understand GŁn's words in
http://curl.haxx.se/mail/lib-2011-01/0193.html

2011/1/13 Guenter wrote:

> The macros for mkdir and rmdir let BCC-make execute my GNU binary pedants
> instead of the internal CMD commands, I think we should use the md / rd
> abbreviations here.

2011/1/13 Yang wrote:

> Do you refer here to the macro name or to the command name itself? No
> objection either way. Please, change it yourself.

Given your words, it seems that he was referring to the command
itself. There was no answer, and it seems none of us have had time yet
to make the change happen.

2011/3/22 Gisle Vanem wrote:

> I gather we could just do: RMDIR = $(COMSPEC) /c mkdir /q 2>NUL

Would it be enough to use "md" and "rd" to avoid CygWin's "rmdir.exe" ?

In any case, please, test and adjust it as you believe it should be done.

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-22