www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/19/01:49:41

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Starnge rm behavour
Date: Tue, 18 Feb 1997 23:40:27 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 44
Message-ID: <330AAE6B.537A@cs.com>
References: <189BCEB38C6 AT csd DOT inp DOT nsk DOT su> <330A4A9A DOT 2BE1 AT cs DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp227.cs.com
Mime-Version: 1.0
CC: DJGPP Workers Mailing List <djgpp-workers AT delorie DOT com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

(I'm CC'ing this to djgpp-workers as a bug report.)

> Vyacheslav O. Myskin wrote:
> >
> > redir -e err. rm *
> >
> > it says:
> >
> > c:/djgpp/bin/rm: *: No such file or directory (ENOENT)
> >
> > What's wrong with it? I use DJGPP 2.01, make 3.75 and rm from fil313b.zip.

Okay, I think I've figured out what the problem is, and oddly enough
it's one of those things that was originally intended as a "feature". 
:)  If you take a look at the new v2.01 docs you'll see something called
the Knowledge Base.  Among other things, this contains a description of
what is new from v2.00 to v2.01.  Note the following item:

[...]
Command line arguments are not wildcard-expanded if they were passed
through `spawn*()' or `exec*()'
[...]

The problem seems to be occurring because 'redir' doesn't perform
wildcard expansion on the command line it gets passed, yet it uses
spawnvp() to invoke the indicated program with the remaining arguments. 
Obviously, this breaks any program which gets passed a wildcard,
including 'rm'.

I _think_ the problem can be solved by making redir call system()
instead of spawnvp().  This would however require it to essentially
rebuild the command line from its components.  It's not hard to do, but
would make redir take up slightly more memory at runtime.

Is there anything that might break as a result of such a modification? 
If not, then I see no reason not to do it...

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I      |   mailto:fighteer AT cs DOT com   |
| God's final message to His Creation: | http://www.cs.com/fighteer |
| "We apologize for the inconvenience."| Fight against proprietary  |
|                      - Douglas Adams | software - support the FSF!|
---------------------------------------------------------------------

- Raw text -


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