Project

General

Profile

Actions

Bug #22201

open

ruby.exe reads `"AA\ " BB` as a single argument

Bug #22201: ruby.exe reads `"AA\ " BB` as a single argument

Added by mame (Yusuke Endoh) 9 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:126106]

Description

A backslash escapes a double quote that sits beyond a whitespace character.

C:\> ruby -e "p ARGV" "AA\ " BB
["AA\\  BB"]     # <- actual
["AA\\ ", "BB"]  # <- expected

This is not intentional, right? The escape is cancelled when almost any other character appears, but I think whitespace seems to have been simply forgotten.

The fix is so simple:

--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1739,6 +1739,15 @@ w32_cmdvector(const WCHAR *cmd, char ***vec, UINT cp, rb_encoding *enc)
                     *ptr = 0;
                     done = 1;
                 }
+                slashes = 0;
                 break;

               case L'*':

https://github.com/ruby/ruby/pull/17943

No data to display

Actions

Also available in: PDF Atom