From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A12A9BBAF for ; Tue, 5 May 2009 11:44:44 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AscBALin/0nRVdzemGdsb2JhbACWLT8BAQEBAQgJDAcRqAqPXAEDAQOCPYE9BYZT X-IronPort-AV: E=Sophos;i="4.40,296,1238968800"; d="scan'208";a="39467429" Received: from mail-fx0-f222.google.com ([209.85.220.222]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 May 2009 11:44:44 +0200 Received: by mail-fx0-f222.google.com with SMTP id 22so4380594fxm.9 for ; Tue, 05 May 2009 02:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Yp1B4A7ekQUPNThv/hcHCpo/ZaSmB9D7WfmtWzoFbQY=; b=AQ6xwbGN3WeFDCCH3qVtbVD6lnOWoLiWIoWnQGH7UwPSZsIwuLslDOYwOPi5gCrZ9e /f2YbTGdHMPDjvFeYORHrIbE1YDbgMiT7c5zyM88SweAh5/oyO+vsuMgm5QHfA/0rQ24 Q4yydPWiIzdjjnc5XxU8o2UUZkCIVq+D8nnpA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=GSxoK6l3UtVZQ3uIu6yK3LwlmYu/KnTm1l557T/4u1GfNHnmqEWB6OztLKHSONkheL 6nCyK22RENS3yyaua9xAvOSjervDWyIX1noCxTLDQ5QIppFaPCfgDSq9g7gLhHLJHxVU DNVKswBlI2OOIG1NYTBeVZzAzOt7rDdjsv5eI= MIME-Version: 1.0 Sender: oandrieu@gmail.com Received: by 10.239.135.129 with SMTP id d1mr378835hbd.137.1241516683794; Tue, 05 May 2009 02:44:43 -0700 (PDT) In-Reply-To: <49FFFFB5.1090403@gmail.com> References: <49FFFFB5.1090403@gmail.com> Date: Tue, 5 May 2009 11:44:43 +0200 X-Google-Sender-Auth: 7837ad68a3c9d828 Message-ID: <95513600905050244q3a83696cs3a5fe02d322a1a80@mail.gmail.com> Subject: Re: [Caml-list] Sys.command and quotes From: Olivier Andrieu To: Matthieu Dubuget Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; andrieu:01 oandrieu:01 matthieu:01 dubuget:01 matthieu:01 dubuget:01 mingw:01 ocaml:01 bug:01 elided:01 iirc:01 2009:98 white-space:98 wrote:01 caml-list:01 On Tue, May 5, 2009 at 10:58, Matthieu Dubuget wrote: > Hello, > > I have a problem with mingw version of ocaml (compiled by hand, or with > godi). > > 1- Is the following reproducible? > > 2- If yes, do you consider this as a bug? > > It seems that in "Sys.command s", if the first and the last characters of= s > are '"', they are elided? that's probably just the Windows command interpreter behaviour. Sys.command calls the C library system() function which ends up calling CMD.EXE. This one has an utterly byzantine behavior concerning quotations marks. cf. http://technet.microsoft.com/en-us/library/bb490880.aspx =AB Processing quotation marks If you specify /c or /k, cmd processes the remainder of string and quotation marks are preserved only if all of the following conditions are met: * You do not use /s. * You use exactly one set of quotation marks. * You do not use any special characters within the quotation marks (for example: &<>( ) @ ^ |). * You use one or more white-space characters within the quotation marks= . * The string within quotation marks is the name of an executable file. If the previous conditions are not met, string is processed by examining the first character to verify whether or not it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved. =BB IIRC a sort of workaround is to always add extra " in your command line: go ["\"" ; .... ; "\""] good luck --=20 Olivier