public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
To: cygwin@cygwin.com, Andrey Repin <anrdaemon@yandex.ru>
Subject: Re: portable use of dos2unix WAS: Re: textmode for stdout, what is "correct" now?
Date: Fri, 15 Feb 2019 19:43:00 -0000	[thread overview]
Message-ID: <997bbfcf-62a9-386e-ee3e-b32b5a08cc59@ssi-schaefer.com> (raw)
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

  reply	other threads:[~2019-02-15 19:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 16:05 Michael Haubenwallner
2019-02-14 18:51 ` Corinna Vinschen
2019-02-15  9:31   ` Michael Haubenwallner
2019-02-15 10:28     ` Corinna Vinschen
2019-02-15 12:48       ` Michael Haubenwallner
2019-02-15 12:49         ` Corinna Vinschen
2019-02-15 18:25           ` Michael Haubenwallner
2019-02-15 20:35             ` Corinna Vinschen
2019-02-16  9:39               ` Michael Haubenwallner
2019-02-16  9:40                 ` Corinna Vinschen
2019-02-16 17:40                   ` Michael Haubenwallner
2019-02-17  0:11                     ` Corinna Vinschen
2019-02-18 10:01                       ` Michael Haubenwallner
2019-02-18 10:43                         ` Corinna Vinschen
2019-02-18 12:15                           ` Michael Haubenwallner
2019-02-18 13:39                             ` Corinna Vinschen
2019-02-18 15:13                               ` Michael Haubenwallner
2019-02-18 16:04                                 ` Corinna Vinschen
2019-02-15 14:20         ` Andrey Repin
2019-02-15 18:50           ` portable use of dos2unix WAS: " Michael Haubenwallner
2019-02-15 19:14             ` Andrey Repin
2019-02-15 19:43               ` Michael Haubenwallner [this message]
2019-02-15 20:50                 ` Andrey Repin
2019-02-15 21:21                 ` Corinna Vinschen
2019-02-18 10:09                   ` Michael Haubenwallner
2019-02-18 10:26                     ` Corinna Vinschen
2019-02-18 13:07                     ` Jeffrey Walton
2019-02-15 21:32                 ` Brian Inglis
2019-02-16  6:09 ` Jeffrey Walton
2019-02-16  9:45   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=997bbfcf-62a9-386e-ee3e-b32b5a08cc59@ssi-schaefer.com \
    --to=michael.haubenwallner@ssi-schaefer.com \
    --cc=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).