public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes
@ 2020-06-11  1:05 Mingye Wang
  2020-06-11  4:46 ` Marco Atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: Mingye Wang @ 2020-06-11  1:05 UTC (permalink / raw)
  To: cygwin

Hi,

The following test case script fails under cygwin64:

```
out32=$(/cygdrive/c/cygwin/bin/echo.exe 'a\\ b')
out64=$(/cygdrive/c/cygwin64/bin/echo.exe 'a\ b')
test "$out32" = "$out64"
```

In other words, while the correct (by-argv-memory) result is `a\\ b`,
cygwin32 gives `a\ b` as output instead. The test case works fine when
CYGWIN=noglob is set, but then `echo.exe 'a\" b'` fails miserably.

The problem is that a cygwin32 program, when run from cygwin64, takes
the code path of normal (non-cygwin) programs. The argv is translated
according to MSVCRT rules in linebuf::fromargv(), but on the receiving
side cygwin's build_argv() is incompatible with MSVCRT rules.

The question mark on the [bug] is due to the apparent old age of this
very unique parsing code and some features it implies. The whole
`winshell` name is pretty bad to start with, since it's really more
relevant to the configurable glob setting as a cygwin parent would
have filled in a `cygheap_exec_info` structure anyways. The link
between globify and quoted is also pretty wild to go through. I mean,
there's nothing sane about cmdline globbing under windows, but a good
place to start is trying to do MSVCRT quoting. The glob rewriting in
globify() should probably go into quoted() for reader's sanity too.

Regards,
Mingye Wang (Artoria2e5)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes
  2020-06-11  1:05 [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes Mingye Wang
@ 2020-06-11  4:46 ` Marco Atzeri
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Atzeri @ 2020-06-11  4:46 UTC (permalink / raw)
  To: cygwin

On 11.06.2020 03:05, Mingye Wang via Cygwin wrote:
> Hi,
> 
> The following test case script fails under cygwin64:
> 
> ```
> out32=$(/cygdrive/c/cygwin/bin/echo.exe 'a\\ b')
> out64=$(/cygdrive/c/cygwin64/bin/echo.exe 'a\ b')
> test "$out32" = "$out64"
> ```
> 
> In other words, while the correct (by-argv-memory) result is `a\\ b`,
> cygwin32 gives `a\ b` as output instead. The test case works fine when
> CYGWIN=noglob is set, but then `echo.exe 'a\" b'` fails miserably.
> 

I miss to see why running a 32bit Cygwin from a 64 bit instance
makes any sense and it will be worth to spend any time on handling
this borderline case .

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-11  4:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11  1:05 [bug?] Spawning cygwin32 program from cygwin64 messes up backslashes Mingye Wang
2020-06-11  4:46 ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).