delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/10/25/17:14:31

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:subject:references:to:reply-to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=ggmOQAx4bGiaJRvS
fTRihWM5fRoqDqTvL00f8pb2X7VqjtG1YpZ3TVm5KUnOSWdgEFY5TyxIYfAV1QY1
jMldxGkVvK48W7Z+24e8x9sRJQ2eGvJ6QN2h7IJNLqnW6G4GcuT/WAQ8wM1Mpj4w
4PHWB3fbpERzO8zgAV0/IgcHtwY=
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:subject:references:to:reply-to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=FsVr1SjulNlxBU/0cPnp/g
KhBWQ=; b=pfNBT9tE6VBNX/Q5JTetKd3qj67S9R7sWH5kBzIG59oAtuhmADfRaf
V1HMO1ya7rjQYEX3GNjnDNYBai6gXu4PbPTbtYO+XYYbQAptJt6/3ZdX24pKKhOJ
7ao5lk1Lf9t6OZ6/H4dKIoEa+eSfcZpnCGqy64CicQaE/HUwaW/Fw=
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=0.4 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Hx-spam-relays-external:64.59.134.9, H*RU:64.59.134.9, calgary, newlines
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=dtuZMBo4 c=1 sm=1 tr=0 a=WqCeCkldcEjBO3QZneQsCg==:117 a=WqCeCkldcEjBO3QZneQsCg==:17 a=IkcTkHD0fZMA:10 a=NEAV23lmAAAA:8 a=roLtwmwd95tgmVLCTOAA:9 a=QEXdDO2ut3YA:10 a=Bn2pgwyD2vrAyMmN8A2t:22
Subject: Re: bc version has issue with \r when run from cmd
References: <CAKBM6-OEErLcF+2DEbvqHE6Ov-ohwLWZzi6vZVz232cgJBYiJQ AT mail DOT gmail DOT com> <fbur0c1suma1ia2kvldfa01iavd4rnb8lb AT 4ax DOT com> <580E9CA6 DOT 6030606 AT tlinx DOT org>
To: cygwin AT cygwin DOT com
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Message-ID: <2dc2f062-8433-42ae-425c-1ef9ee575946@SystematicSw.ab.ca>
Date: Tue, 25 Oct 2016 15:13:57 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
MIME-Version: 1.0
In-Reply-To: <580E9CA6.6030606@tlinx.org>
X-CMAE-Envelope: MS4wfDLAqqB1iMOGmlHzYyELk0ov2GMqSNod3IVpmARC/8BwVYjirZ5CqxiZ2CXhhT0r2rDyPpVpg0iNFGwEXQiKQQSU6olLEnXTnVttX2/xHsc9bd+I4ChH DKiCSHJY3KFy/w11WdLGznNR0DWzn0cxUiNGCyZ0fALWktjIr+7lFjN8ctl6Y7cm2n35nfZRYytQCw==
X-IsSubscribed: yes

On 2016-10-24 17:43, L. A. Walsh wrote:
> Andrew Schulman wrote:
>>> Does whoever made the windows port e.g. for the gow one or for the
>>> cygwin one, make their windows ports open source, and  if so, then
>>> does anybody have a link to those?
>>
>> The Cygwin bc package uses the bc 1.06.95 source that I linked to, plus some
>> patches. You can download them all by checking the "Src" box for bc in setup,
>> then looking in /usr/src/bc-1.06.95-2.src/.
>>
>> I doubt that anyone here knows about the Gow bc package.
> ---
>     I was going to ask: what is 'gow'?
>     It seems like it is a program compiled to run
> in the windows subsystem?  If that's the case, they likely
> created a version of 'bc' to run under the windows subsystem.

Github import of some GNU utilities 2006 sources:
https://github.com/bmatzelle/gow/releases
a few updated as recently as early 2014.

>     As may be obvious now, you need to use a command
> shell that is compatible with whatever subsystem you compile
> 'bc' under.
>     What line ending 'bc' uses is dependent on what
> subsystem it was compiled for.  The one in cygwin is designed
> for use in cygwin and apparently the one included with 'gow'
> (whatever that is), is compiled for use from windows.  "bc",
> and most utilities ported from *nix or open-source systems,
> don't care and don't look at line endings -- they expect
> "\n" to be the "end-of-line" indicator.  On *unix* and *mac*
> systems it is 1 character long, but on windows, it's 2 characters
> (<CR>+<LF>).  The utilities would get alot more confused if they
> had to accommodate both, so in general they only look at "\n" and
> rely on however they were built to indicate what that translates
> to in the surrounding environment.

The problem here, as with most Cygwin utilities and cmd, is that
utilities work fine interactively or with command line arguments,
but when cmd does redirection or piping, it gets to open the files,
and Cygwin does not know how the content is going to be used,
so just passes the data along from the source or to the sink.

To improve things for the cmd shell environment, utilities dealing
with text from stdin or to stdout and stderr, would have to freopen
stdin with mode "r" and stdout and stderr with mode "a" to tell
Cygwin to treat the content appropriately as text.

Ths may solve some input issues under cmd, but may cause others
under either cmd or bash, and may only affect output to files on
Cygwin text mounts, if that still outputs carriage returns before
newlines.

Cygwin interoperability with Windows is pretty extensive and DTRT
when it has a hope of figuring out what you're trying to do: in
some cases you *have* to use a decent shell to give it a chance.

For consistent results, you sometimes need to run commands or
scripts using "bash -c command", "bash script", or bash under
mintty.
And use editors that default to Unix line endings, and those and
other GUIs that are somewhat agnostic about paths, slash
directions, and other Windows idiosyncra^H^H^H^H^H^Hcies ;^>

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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