From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8DF557FFE1 for ; Thu, 6 Oct 2016 19:45:46 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout3.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mxout3.mail.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout3.mail.janestreet.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AdrgDmRCzXr3cAhIeuYL1UyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP7zrsbcNUDSrc9gkEXOFd2CrakV0ayN6eu5ADVIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBy?= =?us-ascii?q?brysXNWD1YLsjavrosSbSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45ihjh7O?= =?us-ascii?q?QheV4WNYGkAXmRpBDgyPpEX/X5zxuyb+8PF61SaGJ8ruZbEyRTmmqaxsTUm7pj?= =?us-ascii?q?0AMmsb/Xvaj819xI5apROnoFQrwYLVZYCTM9J8d6XQZs8ASGddGM1WUnoSUcuH?= =?us-ascii?q?c4ITAr9Zbq5jpI7nqg5L9EPmCA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BFAADzjPZXfeXIaSZcGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFQEBAQECAQEBAQgBAQEBgxIBAQEBAXV8B40rlwCULIILIoV+AoFtBzg?= =?us-ascii?q?UAQEBAQEBAQEBAQESAQEJFglIgjIEARUBBIIRAQEEEhEdAQEHMAEPCwsNAgImA?= =?us-ascii?q?gIiEgEFAQ4BDQYTCAwHB4gsAwukJoEyPjKKW2eESQEBBYgcAQEBAQEBAQMBAQE?= =?us-ascii?q?BAQEBAQEBFQkQd4U1hFWER4MEgluOP4tFhiiJU490jHeCPRMegREedQUHglyBf?= =?us-ascii?q?3GGf4FBAQEB?= X-IPAS-Result: =?us-ascii?q?A0BFAADzjPZXfeXIaSZcGgEBAQECAQEBAQgBAQEBFQEBAQE?= =?us-ascii?q?CAQEBAQgBAQEBgxIBAQEBAXV8B40rlwCULIILIoV+AoFtBzgUAQEBAQEBAQEBA?= =?us-ascii?q?QESAQEJFglIgjIEARUBBIIRAQEEEhEdAQEHMAEPCwsNAgImAgIiEgEFAQ4BDQY?= =?us-ascii?q?TCAwHB4gsAwukJoEyPjKKW2eESQEBBYgcAQEBAQEBAQMBAQEBAQEBAQEBFQkQd?= =?us-ascii?q?4U1hFWER4MEgluOP4tFhiiJU490jHeCPRMegREedQUHglyBf3GGf4FBAQEB?= X-IronPort-AV: E=Sophos;i="5.31,454,1473112800"; d="scan'208";a="195889868" Received: from mxout3.mail.janestreet.com ([38.105.200.229]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Oct 2016 19:45:45 +0200 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout3.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1bsCjn-0007RQ-5p for caml-list@inria.fr; Thu, 06 Oct 2016 13:45:43 -0400 X-JS-Flow: external X-JS-Scanner-attachment: (ok) No attachments Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BX9o3H-AAAGiX-Eb; 2016-10-06 13:45:43.143150-04:00 Received: from mail-it0-f72.google.com ([209.85.214.72]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1bsCjn-0008Bw-2M for caml-list@inria.fr; Thu, 06 Oct 2016 13:45:43 -0400 Received: by mail-it0-f72.google.com with SMTP id m10so9921546ith.7 for ; Thu, 06 Oct 2016 10:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=T4C3kC7pbiet//56Wh0mRUj5ldKP5dQvCIbnsCnUvuI=; b=jr9J/SU0t3ZfInyEA1vpc540xAR/XtYpJKb9KWj5MviL9mTpPY7ls8+oatl0E5IqsG 7OYSY6iRgHJ7TIKWUUM/uofFgR7eGlMOzkZFNxsq/n7HTxJlePdYmsAm2H4JR0xoLorR wR3VY6kDaQZCIJNouRbl8CkSR9IZkhAYmwwOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=T4C3kC7pbiet//56Wh0mRUj5ldKP5dQvCIbnsCnUvuI=; b=IwbbxwPEKjG7mQTTzLcSTBDiYmQa4T6Da8p6zX9gT9MwJfagybSB4NyAfljp7WtSO2 XJ8o3POvzGnY+WUcBaEp1xpVsZ1jHUot1tUrd9oyCztYAFPujx5bqW7Ccq3sf3J4OtaL 4MVSkrY+WKX21f2hjy8Z0giRAPRSQIwcF1iX5w5qcYzgQV/4nX19gqC3Skd81KGWXdZ3 8ELZYZkXk00vm176YLL4wvZ3LUtW+ivsQ2fJdZ8Xnk6U4qT/gFwIBFd8OP0GGHHupwhu keRpzK+GEgWyY8QnRrY1vqHoRkvUO6JnmGvdnDDxx1f5+vBw1GT3ZmSAKcLWAyOp0bx4 7FhA== X-Gm-Message-State: AA6/9Rl1XyBB6A7vU9fp+sUQa8FePzyp0Mu5dgQT/+S4vaGVcCq9cM3ViUMnxz8kfBeO0er+q8fklt2XZjOwLP+PN6QBdOCAB3/G+qtUcHLKKZBZSnDnO/VUYqTSkcQd9+a9GcuG9Fw29oOwT+9L X-Received: by 10.107.28.148 with SMTP id c142mr15448529ioc.45.1475775942639; Thu, 06 Oct 2016 10:45:42 -0700 (PDT) X-Received: by 10.107.28.148 with SMTP id c142mr15448513ioc.45.1475775942448; Thu, 06 Oct 2016 10:45:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.30.3 with HTTP; Thu, 6 Oct 2016 10:45:41 -0700 (PDT) In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BA@IRSMSX102.ger.corp.intel.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BA@IRSMSX102.ger.corp.intel.com> From:Jeremie Dimino Date: Thu, 6 Oct 2016 18:45:41 +0100 Message-ID: To:"Soegtrop, Michael" Cc:"caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-JS-Processed-by: mailcore Subject: Re: [Caml-list] ocamlbuild on Windows and bash vs. cmd I don't have an opinion on using cmd in ocamlbuild, but I have been looking at similar things for jenga recently. With jenga the actions generated by the rules are of the form (prog, args) and when one wants to to do something more complicated, they have to manually build a shell command. In the Jane Street rules we are using bash. Going through bash is often frustrating, even on Unix. Moreover for the public release of Jane Street packages I'd like to avoid relying too much on bash as it has often been a source of problems in the past. The solution I'm aimed at is to have the jenga rules produce actions using a small DSL allowing pipes and other things and interpret this DSL without the use of a third-party shell, i.e. just using system calls and threads. It's still a work in progress but I already have the backend part working [1]. It's aimed at being portable on Windows. The code for Windows is written but not yet tested, I plan to do it at some point. I imagine that it shouldn't be too use this in ocamlbuild if the [Sh] constructor was removed and replaced by a few other constructors to express pipes, redirections, etc... [1] https://github.com/janestreet/shexp On Thu, Oct 6, 2016 at 2:38 PM, Soegtrop, Michael wrote: > Dear OCaml users and developers, > > > > I looked into the fact that ocamlbuild requires bash/cygwin to run. Actua= lly > it does very little use of bash and I think cmd + ln + rm would work quite > well. > > > > From comments in various list I understood that people had issues with > escaping for cmd. I agree that this is a bit nasty, but not rocket science > either. I guess the main issue is that for cmd not only space and tab are > command argument separators, but also equal (=3D), comma (,) and semicolon > (;). So for cmd a=3Db,c;d is the same as a b c d which is the same as a ,= =3D , > b =3D;=3D c=3D=3Dd. Essentially cmd treats unquoted pieces as sed =E2=80= =98s/[\t =3D,;]+/ /g=E2=80=99. > If a name contains any of these characters, one has to quote it for cmd, = but > not for bash. Since =3D and , are not that uncommon in file names, I guess > this resulted in issues. > > > > BUT cmd splits the command line only into command names, complete argument > lists and file names for redirection. That is if you call e.g. ocamlc, cmd > just replaces shell variables and extracts the executable name, but does = not > split up the argument list into individual pieces. bash on Windows does t= his > neither, because (afaik) Windows has at the lowest level no mechanism to > pass individual arguments to an executable. The command gets a string and > splitting this string and even globing is the business of the executable.= So > it is rather odd that this behaves substantially different for bash and f= or > cmd. The only thing which needs to be quoted properly are command names a= nd > file names of redirections. > > > > There might be issue with shell special characters. There are those which > are not allowed in file names =E2=80=9C\/:*?<>| and those allowed in file= names &(). > I guess those not allowed in filenames don=E2=80=99t need any special tre= atment, > since one can=E2=80=99t do that much with them except their special shell= use. The > other 3 one should be escape with ^. There is no way to quote shell speci= al > characters with cmd =E2=80=93 they must be escaped with ^. > > > > The only real issue is that some people seem to use build rules with =E2= =80=9Creal=E2=80=9D > bash stuff in it =E2=80=93 well if you do this I guess you anyway have a = cygwin > around. > > > > So I wonder if it would be appreciated by the community to have an > ocamlbuild (e.g. as a configure option) which uses cmd instead of bash. I > think if one does the escaping properly, this should be good for the large > majority of projects out there. > > > > Ocamlc seems to run fine without cygwin, but I didn=E2=80=99t test other = tools like > ocamllex or menhir as yet. Are there known issues? > > > > Best regards, > > > > Michael > > > > > > Intel Deutschland GmbH > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Christian Lamprechter > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928 --=20 Jeremie