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 D16167FFE2 for ; Thu, 6 Oct 2016 15:39:02 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=michael.soegtrop@intel.com; spf=Pass smtp.mailfrom=michael.soegtrop@intel.com; spf=None smtp.helo=postmaster@mga14.intel.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of michael.soegtrop@intel.com) identity=pra; client-ip=192.55.52.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of michael.soegtrop@intel.com designates 192.55.52.115 as permitted sender) identity=mailfrom; client-ip=192.55.52.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.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@mga14.intel.com) identity=helo; client-ip=192.55.52.115; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="postmaster@mga14.intel.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AhfHS0xX/PlCWtBSApBy5wnUnWabV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhKAt8tkgFKBZ4jH8fUM07OQ6PG6Hzdaqsjd+Fk5M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJP?= =?us-ascii?q?K/jvHcaK1oLshrr0oMeYPVkArQH+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf?= =?us-ascii?q?9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBO/xdqE8CLhZFygOMmYv5cStuwOJ?= =?us-ascii?q?BV+E734YF2EXiQZgAg7f7Ri8UI2n4QXgse8okhKdMMLqV7csHXyH7qxrQRLswm?= =?us-ascii?q?9TMj8y8Gjajopri69UvAimvzR+xZLZZMeeM/8oLfCVRs8TWWcUBpUZbCdGGI7p?= =?us-ascii?q?N4Y=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CkAABZU/ZXh3M0N8BdHQEFAQsBGBgHg?= =?us-ascii?q?lA2AQEBAQF1fAeNK5dLk1+CCx6GAgKCADgUAQEBAQEBAQEBAQESAQEBCA0JCRk?= =?us-ascii?q?kC4IyGIIeLRxCASpWFwEOAQQbDIg5AaIanFwyhj2JHYJKC1mCLwWOOos/BgGfb?= =?us-ascii?q?pB2HoN9gV5yh0ABfwEBAQ?= X-IPAS-Result: =?us-ascii?q?A0CkAABZU/ZXh3M0N8BdHQEFAQsBGBgHglA2AQEBAQF1fAe?= =?us-ascii?q?NK5dLk1+CCx6GAgKCADgUAQEBAQEBAQEBAQESAQEBCA0JCRkkC4IyGIIeLRxCA?= =?us-ascii?q?SpWFwEOAQQbDIg5AaIanFwyhj2JHYJKC1mCLwWOOos/BgGfbpB2HoN9gV5yh0A?= =?us-ascii?q?BfwEBAQ?= X-IronPort-AV: E=Sophos;i="5.31,454,1473112800"; d="scan'208,217";a="195854646" Received: from mga14.intel.com ([192.55.52.115]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 06 Oct 2016 15:39:00 +0200 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 06 Oct 2016 06:38:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,454,1473145200"; d="scan'208,217";a="1041155668" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga001.jf.intel.com with ESMTP; 06 Oct 2016 06:38:58 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.198]) by IRSMSX154.ger.corp.intel.com ([169.254.12.149]) with mapi id 14.03.0248.002; Thu, 6 Oct 2016 14:38:56 +0100 From: "Soegtrop, Michael" To: "caml-list@inria.fr" Thread-Topic: ocamlbuild on Windows and bash vs. cmd Thread-Index: AdIf1vqh2ltLjS4ZRTSlpAoLdZvQfg== Date: Thu, 6 Oct 2016 13:38:55 +0000 Message-ID: <0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BA@IRSMSX102.ger.corp.intel.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: multipart/alternative; boundary="_000_0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BAIRSMSX102gercor_" MIME-Version: 1.0 Subject: [Caml-list] ocamlbuild on Windows and bash vs. cmd --_000_0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BAIRSMSX102gercor_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Dear OCaml users and developers, I looked into the fact that ocamlbuild requires bash/cygwin to run. Actuall= y it does very little use of bash and I think cmd + ln + rm would work quit= e well. >From comments in various list I understood that people had issues with esca= ping for cmd. I agree that this is a bit nasty, but not rocket science eith= er. I guess the main issue is that for cmd not only space and tab are comma= nd 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 's/[\t = =3D,;]+/ /g'. 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 no= t 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 t= o 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 = for cmd. The only thing which needs to be quoted properly are command names= and file names of redirections. There might be issue with shell special characters. There are those which a= re not allowed in file names "\/:*?<>| and those allowed in filenames &(). = I guess those not allowed in filenames don't need any special treatment, si= nce one can't do that much with them except their special shell use. The ot= her 3 one should be escape with ^. There is no way to quote shell special c= haracters with cmd - they must be escaped with ^. The only real issue is that some people seem to use build rules with "real"= bash stuff in it - well if you do this I guess you anyway have a cygwin ar= ound. So I wonder if it would be appreciated by the community to have an ocamlbui= ld (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't 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 --_000_0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BAIRSMSX102gercor_ Content-Type: text/html; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable

Dear OCaml users and developers,

 

I looked into the fact that ocamlbuild requires bash= /cygwin to run. Actually it does very little use of bash and I think cmd &#= 43; ln + rm would work quite well.

 

From comments in various list I understood that peop= le 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 ‘s/[\t =3D,;]&= #43;/ /g’. 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 un= common in file names, I guess this resulted in issues.

 

BUT cmd splits the command line only into command na= mes, complete argument lists and file names for redirection. That is if you= call e.g. ocamlc, cmd just replaces shell variables and extracts the execu= table name, but does not split up the argument list into individual pieces. bash on Windows does this neithe= r, because (afaik) Windows has at the lowest level no mechanism to pass ind= ividual 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 subs= tantially different for bash and for cmd. The only thing which needs to be = quoted properly are command names and file names of redirections.

 

There might be issue with shell special characters. = There are those which are not allowed in file names “\/:*?<>| a= nd those allowed in filenames &(). I guess those not allowed in filenam= es don’t need any special treatment, since one can’t do that much with them except their special shell use. The other 3 one sho= uld be escape with ^. There is no way to quote shell special characters wit= h cmd – they must be escaped with ^.

 

The only real issue is that some people seem to use = build rules with “real” bash stuff in it – well if you do= this I guess you anyway have a cygwin around.

 

So I wonder if it would be appreciated by the commun= ity to have an ocamlbuild (e.g. as a configure option) which uses cmd inste= ad 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&= #8217;t test other tools like ocamllex or menhir as yet. Are there known is= sues?

 

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

--_000_0F7D3B1B3C4B894D824F5B822E3E5A172CF8E1BAIRSMSX102gercor_--