delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/04/09:56:01

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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=KQzDmq9VRHjoGtdgSXXdgBvHeW6eF
tXtxJfpX0eI3lgpf/zy7eOqh1dkH4dpF0S38YlYJF7C3qHg6giV7co/grh6zRlGA
3al0wQA7i8VuYPV+shlDoDS9jboXJud4dlv02TTjm7BdK6QSyBYiZ+9PNCd31zJX
jvxwhjjB9zjCy4=
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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=q07qn+xbTuuicHBOzr2R+ZdgbVc=; b=D2a
bN9xazMRESkn/Cb4jeJuG8vxdTqOA0sKBZ4rtEBiOTqx9qc06le4IWnjziMAYslS
5r43xd/rhqze9iDx/82g7WJ9uEYuE+BWZUMGG1NJdBw9gI5C+QGlmbmMWFwSpumA
LHFI2aannV+hKHoxa3tzb2s3eqdf3DvXxdJ2/kio=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=1.9 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*rogers.com, carriage, desire, notable
X-HELO: mail1.bemta8.messagelabs.com
X-Env-Sender: bsmith AT progress DOT com
X-Msg-Ref: server-11.tower-95.messagelabs.com!1470318940!44834156!1
X-StarScan-Received:
X-StarScan-Version: 8.77; banners=-,-,-
X-VirusChecked: Checked
From: Bill Smith <bsmith AT progress DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>,
Michel LaBarre <michel DOT labarre AT rogers DOT com>
Subject: RE: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN
Date: Thu, 4 Aug 2016 13:55:28 +0000
Message-ID: <4a78e97f38e14e9bab340f9d5119df19@ntmaexbe04.bedford.progress.com>
References: <001001d1edf1$a4e1ae90$eea50bb0$@rogers.com> <1198248887 DOT 20160804151307 AT yandex DOT ru>
In-Reply-To: <1198248887.20160804151307@yandex.ru>
x-ms-exchange-transport-fromentityheader: Hosted
MIME-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u74Dtv1d024437


> > Problem 1:  Cygwin does not support PATHEXT and really should.
> 
> No, it should not. Cygwin is a POSIX environment, and it uses POSIX
> conventions to determine if a file is executable somehow.
> 
> > PATHEXT is as fundamental component of Windows program execution as
> PATH.
> 
> PATHEXT is a shell (CMD) extension. Some programs do make use of it,
> notable file managers and CMD replacements do, but overall, this is a
> mechanism of finding the file to execute, not of executing it per se.
> You can write your own extension to bash-completion "file-not-found"
> handler, if you so desire.
[Bill Smith] 

A couple of years ago I was involved with porting a very large code base of makefiles
& shell scripts to work with Cygwin.  In our environment, the main issue was shell scripts calling 
*.bat files without the .bat suffix because of the $PATHEXT.  The fix was to change 

somescript

To
somescript${BAT}

where ${BAT} would be set to .bat on Windows.

Another option available was to create wrapper shell script.  So I would create a script named "somescript"
that is only in $PATH on Windows and it would look something like this:

#!/bin/sh
adaptman.bat "$@"

Granted our *.bat files are simple and don't have to worry about arguments with spaces.

> > Problem 2:  Cygwin does not support CR-LF delimiters.
> 
> Cygwin, in this case, is a library (newlib), and it doesn't care about delimiters.
> This is an application's choice and right to support various EOL's or not.
> 
> > For the same reason, it is unfortunate that CYGWIN/bash does not cope

[Bill Smith] 

You can tell bash to ignore carriage returns in scripts by doing the following:

set -o igncr
export SHELLOPTS

> > I have been using and developing system software within Unix since
> > 1974 and Windows since the mid-80's.  in more recent years (since the
> > mid-90's) I have developed extensive sets of tools (sh/awk/etc..) for
> > corporate and public sector clients - on the order of 100,000 lines of
> > code for representative projects.  Most had to run under both Solaris
> > and Windows environments for which I used the MKS toolkit.
> 
> And they do run fine, as long as you are not making stupid mistakes, like
> using bogus EOL terminators and expecting the program to work equally on
> different systems.
[Bill Smith] 
Agreed.  If you need advice on porting scripts to work both in Cygwin and MKS, feel free
to send me email.   

--
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