Opened 9 years ago

Closed 9 years ago

#60 closed defect (wontfix)

ash: double quotes are always escaped with backslash

Reported by: dmik Owned by:
Priority: major Milestone:
Component: shell Version:
Severity: Keywords:
Cc:

Description

It seems that sh.exe always escapes double quotes with backslashes in arguments passed to an external program. Let's have this t.sh file:

t.cmd -DFIREFOX_ICO='"../../dist/branding/firefox-os2.ico"'

and this 't.cmd` file:

/**/
say '['arg(1)']'

The output of running sh.exe with the first script will be:

D:>sh t.sh
[-DFIREFOX_ICO=\"../../dist/branding/firefox-os2.ico\"]

That's wrong as it confuses some applications that are unable to deal with such escaping (like the Watcom Resource compiler, WRC.EXE).

Change History (2)

comment:1 Changed 9 years ago by Silvan Scherrer

Component: shell

comment:2 Changed 9 years ago by dmik

Resolution: wontfix
Status: newclosed

It turns out that the problem has nothing to do with ash but it's rather a kLIBC problem. It looks like kLIBC deliberately escapes " with \ somewhere inside the exec implementation. If the target executable is a kLIBC-based binary, they are unescaped back somewhere in the main startup code (so that the application doesn't even notice that). But it's apparently not the case for non-kLIBC binaries (like REXX.EXE or WRC.EXE).

I created a kLIBC ticket for that: http://trac.netlabs.org/libc/ticket/343.

Closing this one.

Note: See TracTickets for help on using tickets.