delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/15/14:34:19

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:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=q87h6mVfDXHFrJcn
9QwPhxcsS1J46mTmjblqaQbImkP5N5Ovdx/Oz20i10cFdXJFX7xJApVUJGg5L13V
HZLF7JOTRmTWlf0Q8BLe2zjZbFpk/q8P3PeMuET95mKsQjgLdpQttyn86s2IQpzr
bn+p1+6+KHDn6QwtYWYId1KDY0k=
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:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=1nZuamKtDQWxEDJtSDrZQg
56inw=; b=HK3ky4YruuUeDldc0i7i+YRag4qZ975nFPEtei986imI8SMORtVfXF
um3cNDjKyexnCPT8iS3RSPVKx4Px8NOnyj4LdnxAgi6T7n7Y/rDACUVhGm13T8r0
+r+PF9qcLPiPU8IGNRhq7wbBarV6CD8Br/MX6ELvjR8bRIt8+yQqE=
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-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=PATH, foreign
X-HELO: atfriesa01.ssi-schaefer.com
Subject: Re: portable use of dos2unix WAS: Re: textmode for stdout, what is "correct" now?
To: cygwin AT cygwin DOT com, Andrey Repin <anrdaemon AT yandex DOT ru>
References: <739ed5ce-6902-d702-e152-65dc2c1da667 AT ssi-schaefer DOT com> <20190214162002 DOT GA4950 AT calimero DOT vinschen DOT de> <6aa280c2-4769-0772-91d9-c73a3a3d9680 AT ssi-schaefer DOT com> <20190215102251 DOT GA2702 AT calimero DOT vinschen DOT de> <f7345109-5b22-a342-df1e-940e236c2397 AT ssi-schaefer DOT com> <1282767785 DOT 20190215154502 AT yandex DOT ru> <d59689ee-4bf3-d66f-ca0b-f9cec8dda035 AT ssi-schaefer DOT com> <1787080198 DOT 20190215213542 AT yandex DOT ru>
From: Michael Haubenwallner <michael DOT haubenwallner AT ssi-schaefer DOT com>
Message-ID: <997bbfcf-62a9-386e-ee3e-b32b5a08cc59@ssi-schaefer.com>
Date: Fri, 15 Feb 2019 20:33:52 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
In-Reply-To: <1787080198.20190215213542@yandex.ru>

Hi Andrey,

On 2/15/19 7:35 PM, Andrey Repin wrote:
> Greetings, Michael Haubenwallner!
> 
>> On 2/15/19 1:45 PM, Andrey Repin wrote:
>>> Greetings, Michael Haubenwallner!
>>>
>>>>>
>>>>> For scripting, d2u should help.
>>>
>>>> Plus, to be portable: type d2u >/dev/null 2>&1 || d2u() { cat; }
>>>
>>> _d2u="$( which d2u 2> /dev/null || echo cat )"
> 
>> To be honest, this is less portable for some reasons:
> 
>> * "$(...)" is not Bourne Shell (/bin/sh) but POSIX Shell (ksh, bash, ...)
> 
> And /bin/sh is a POSIX shell. I don't know what you are trying to say here.
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html#tag_20_117
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03

Well, /bin/sh *shall* be a POSIX shell. But the reality is not there yet:
https://www.gnu.org/software/autoconf/manual/autoconf.html#Portable-Shell

>> * "which" is C Shell and has it's own troubles (may load ~/.cshrc first)
> 
> $ which which
> /bin/which
> 
> It's a separate executable, unless shell provides an override.
> How it could possible load foreign RC file is beyond me.

On AIX for example, /usr/bin/which is a csh script by itself:

$ type which
which is /usr/bin/which

$ file /usr/bin/which
/usr/bin/which: shell script  - csh (C shell)

$ head -n5 /usr/bin/which
#!/usr/bin/csh -f
set prompt = "% "
if ( -f ~/.cshrc) then
        source ~/.cshrc
endif

Now imagine what happens when ~/.cshrc does mess with PATH.

Anyway: To find something along PATH, I do prefer some shell builtin rather
than something to be found along PATH.

> 
> ----
> 
> I have a different question though. The commands you presented in the OP
> look like you aren't using Cygwin-suppied OpenSSL binary.

This is true: The Cygwin distro does provide openssl-1.0.2p, but I'm building
the *portable* Gentoo Prefix distro on Cygwin, with openssl-1.1.1a already.
But whenever the Cygwin distro would bump to openssl-1.1, the same problem
would arise there as well, just becomes noticed much later probably.

/haubi/

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