delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/10/08/05:06:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=u4Z/v7vExiyBIx5vB2gfTGH/Esyrs
92fhTrs4+j3BNN4kUaBF9kvkyoQl9IhW+hVOhsUXjCZsngP/KSibUPreP0xmNVL6
MMRA8n78aerfYhTniritT3ztVKzCTAmyJoprrq0IQ1h5bd4ggvxOWV8T3Huivui/
UO9fKHIfJjfiJE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=eoEEtjo4wCOBY1oVfAsK3xpXIPg=; b=AZd
dyikF0EZUk7dDbYFzmLE2KPRIQLMnEY7L530xcz5NQJQScGaOtHwohrhUsG2cdfe
IDye2k7tHNnq9QiEdNYN6gK/UyTsAs64mBzv+eIa1IDqYnK4Gm0AxjJ65LznWUrc
N6oaBiQfNUjpAy2bfatoB9Cmzi/8Y3hUWyPF+vmY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=quotes, HX-HELO:sk:mail-ed, H*r:sk:mail-ed, HX-Received:906
X-HELO: mail-ed1-f48.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=oIKHH8Qb1l/8z1YaYu7vx6LSFPYuFmtP0f6yd+uwEiU=; b=iN4kOzfosUacH/Si5qhd/B5czsJB8fc2gZL3EkvCuPTcgw7Kip2LlM3LtCPP9RgEBg ASkaxDL4IvhkBdFOeMWbBLX4XimI+0T/WF9vHHUzLApKWxHxuZYm/W0vFjNimE2MZfmY bdvBM3tQW1XQxcIQNgRjkMRjfc2cRtyXHafp92SVud3o++UhvVMnOklKyc4fUl1VRTg+ bzY3RNsZwvoA8+NqDlBrfr2HLOfKyySFOtg6J2kWgcGFN3DXb9hMGV6VDQSCACaLmHGm igga6cGy6EL/hQ94E+7JCwMAOI+am0DAwt3Plmw5dXAHez9DTG+Nr2EbngeXFJ6RCOu7 rmMw==
MIME-Version: 1.0
From: Mingye Wang <arthur200126 AT gmail DOT com>
Date: Tue, 8 Oct 2019 17:05:16 +0800
Message-ID: <CAD66C+b4uBtV=DUZ1n7Nk+KEoac0G9rkGYLVE7eEeKEuCKZmVA@mail.gmail.com>
Subject: [bug] globify dospath reacts poorly with escaped double quotes
To: cygwin AT cygwin DOT com

Hi,

This bug is inherited from early versions of Cygwin. It's so old that
MSYS2 has this problem too.

There is no way of conveying a double quote in an argument once
globify() decides it has seen a dospath. Neither the `\"` nor `""`
work, because they are both unified to `\"` in quoted() and turned
into a `\\` pattern in globify().

This is problematic for programmers trying to write a routine to
reliably escape an argument for the Cygwin command-line.

A way to patch the problem is with a lookahead in globify():

if (dos_spec && *s == '\\') {
/**/p++ = '\\';
/**/if (s[1] == '"' && s[2]) {
/****/*p = *++s;
/****/continue;
/**/}
}
*p = *s;

[Apologies for the formatting; the gmail web editor hates leading spaces.]

(Note: The backslash thing has always been different from the MSCRT
handling, which only transforms backslashes followed by a double
quote. But this is fine as long as we are internally consistent.
Well... is it documented anywhere?)

--
Regards,
Mingye Wang

--
Mingye Wang (Artoria2e5)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019