[Top][All Lists]

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

Re: Caret escaping

From: Alessandro Vesely
Subject: Re: Caret escaping
Date: Wed, 04 Jan 2006 10:31:53 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Paul D. Smith wrote:
%% Alessandro Vesely <address@hidden> writes:

  av> Thus, in case the "slow path" is taken, the LINE command should be 
replaced with
  av>   SHELL may be either a unixy_shell, cmd.exe or the old,
  av>   FLAG should be -c for unixy_shell or /C otherwise, and
  av>   ESCAPED-LINE should be escaped using backslashes for unixy_shell,
  av>     carets for cmd.exe, or
  av>     no escape at all for the old command.exe.
  av> Then there is a batch_mode_shell flag, which is usually set for cmd.exe
  av> and causes a NOT-SO-ESCAPED-LINE to be written to a temporary batch file.
  av> Should we revise those specs in order to make a smarter use of cmd.exe?

  av> Althought that patch also allowed -jN to be specified w/o
  av> unixy_shell, after Paul's clarifications it seems the "-j"-change
  av> does not depend on escaping.

  av> Typically, smarter escaping might be required if the command is, say,

  av>     egrep ^foo $^ | something

  av> In that case, cmd.exe eats the caret unless it is escaped as ^^foo;
  av> does not. As a workaround one can escape the command in
  av> the makefile, which then cannot be ported to windows 98.

It may be that the DOS/Windows port does more with this than the UNIX
port; I'm pretty sure there's no need to escape anything in UNIX since
the string is passed directly to the shell with exec().

It looks as if the code in job.c is executed in normal Unix mode,
I mean w/o -j. I include a tentative call graph (the generated gif is in for those who don't have dot at hands).

Escaping takes place while constructing command argv. It is a difficult piece
of code, because of recursion with many preprocessing #if's. It has been
modified recently to keep backslashes/newline according to POSIX. And it is
where patch #3678 was meant to be applied.

 partial call graph of job.c functions
 (except execute_file_commands that lives in commands.c)
 usage: dot -Tgif -ojob_graph.gif job_graph.txt

digraph G {
        execute_file_commands -> new_job;
        new_job -> start_waiting_jobs;
        new_job -> start_waiting_job;
        new_job -> reap_children;
        start_waiting_jobs -> start_waiting_job;
        start_waiting_jobs -> reap_children;
        start_waiting_job -> start_job_command;
        reap_children -> start_job_command;
        start_job_command -> start_job_command;
        start_job_command -> construct_command_argv;
        construct_command_argv -> construct_command_argv_internal;
        construct_command_argv_internal -> construct_command_argv_internal;

reply via email to

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