[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make CVS (Win32) improperly leaves batch files with -n

From: Eli Zaretskii
Subject: Re: Make CVS (Win32) improperly leaves batch files with -n
Date: Thu, 16 Feb 2006 22:43:56 +0200

> From: "J. David Bryan" <address@hidden>
> Date: Thu, 16 Feb 2006 11:23:45 -0500
> CC: address@hidden
> >Quoting in cmd.exe is still very different from a Unixy shell, so
> >construct_command_argv_internal will still need lots of cmd-specific
> >code fragments, I think.
> I've thought about this, and I'm not sure that I understand why quoting 
> matters.  I accept that quoting in "cmd" and "sh" differ.  But isn't the 
> issue whether "make" can pass commands to "cmd" directly or must pass them 
> via batch files?
> In other words, are there commands that cannot be passed to "cmd" as 
> arguments but that will work if the identical strings are placed in batch 
> files?  If you have an example, that would help me to grasp the issue.

Here's why I think quoting matters: it's because, with batch files,
you separate the command that is to be run from the command with which
we invoke CMD.  By contrast, with "cmd /c <command>", they are both
together, so their quoting get intermixed.  (The same problem happens
on Unix, btw.)

Here's an example.  Let's assume that the rule's command says this:

        cd "c:\\foo bar" && frobnicate baz

(The double \\ is because Make requires that.)  Now, to run this
directly through "cmd /c", we need to quote the command, i.e. invoke
CMD like so:

         cmd /c "cd "c:\\foo bar" && frobnicate baz"

But this will not work unless we quote or escape the inner quotes and
the special character &.  One way is this:

         cmd /c "cd ^"c:\\foo bar^" && frobnicate baz"

Another way is this:

         cmd /c "cd ""c:\\foo bar"" && frobnicate baz"

You can probably come up with a few more ways of doing this, but note
that most of them will be quite different from what Make does on Unix.

By contrast, invoking this command via a batch file boils down to
writing the rule's command verbatim to the batch files, and then
invoking a simple command like this:


That's it! no weird quoting problems.

Did I succeed to explain the problem?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]