delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/04/08/04:51:18

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 902E93858CDA
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1680943840;
bh=fB/Ci9IJBPQu/Vj1WHO9UR2F8y/qfiPnWMEGai1sfPY=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=mgd4wCMOJC7GvjReHAEtnxzcaS4ccgrxeuMBwJLIj3KrwC8i4osTunJ0NIO2UA1X0
jLevMr2UgGL5Rba57Ju6PQ0l9IMWMGuJLzFqlcaYDOx2s6DwsKAfc4d33Pg+27lMQq
/H7iPYZrV6F5qrD2rU/wuESt61+hVxDbuR9jMYSI=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED1843858D1E
X-Yandex-Fwd: 1
Date: Sat, 8 Apr 2023 11:37:17 +0300
X-Mailer: The Bat! (v9.3.4) Professional
Message-ID: <829298512.20230408113717@yandex.ru>
To: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>, cygwin AT cygwin DOT com
Subject: Re: bash shell script: recently running, now failing
In-Reply-To: <6bb05948-2362-6cb8-532a-2dfd59a746d3@Shaw.ca>
References: <DB6P18901MB005559D81FD4125B0D6DAA07A4919 AT DB6P18901MB0055 DOT EURP189 DOT PROD DOT OUTLOOK DOT COM>
<44687390 DOT 20230406152114 AT yandex DOT ru>
<6bb05948-2362-6cb8-532a-2dfd59a746d3 AT Shaw DOT ca>
MIME-Version: 1.0
X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT,
NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Andrey Repin via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Andrey Repin <anrdaemon AT yandex DOT ru>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 3388p2ta020878

Greetings, Brian Inglis via Cygwin!

> On 2023-04-06 06:21, Andrey Repin via Cygwin wrote:
>>> I have a "hash bang" bash shell script i.e. first line
>>> #! /bin/sh
>>> or equivalently
>>> #! /bin/bash

>> By default, sh is bash in base Cygwin installation.

>>> Q3 - at 1/8 the size of bash and sh, I am not at all sure of the role and reach of dash.
>>> Should the edit (dash replacing bash/sh) be incorporated elsewhere or would this be a
>>> bad idea (and retained only locally in what is indeed an eccentric and one-off context)?

>> I'm replacing /bin/sh with dash as I've found that even in POSIX mode, bash
>> allows for a lot of bash'izms in scripts, which would not otherwise run under
>> (d?a)?sh.

>> See the post-install script attached.

> You should use either a hard link or copy of d/ash from/to /bin/ to allow
> it (or any shell) to be used from Windows cmd shells or Scheduled Tasks,

That depends on your setup. /usr/bin/env is a real executable and it is a VERY
good idea to handle Windows associations through it.
But on my end it is covered by CYGWIN=winsymlinks:nativestrict and a more
elaborate TCC-RT wrapper script which is again falling down to /usr/bin/env for
the purposes of actually starting the program, be it a script or binary or…

> which do not recognise Cygwin /usr mounts or symlinks, but can be run with
> elevated privileges and at sometimes more useful points than user cron jobs.
> For example, "manually" restarting Cygwin services after delayed startup,
> stopping Cygwin services and processes before upgrades, and cleaning up cron
> jobs that have not finished.

That part is handled elsewhere already.

> You should also consider changing the sh man page.

That's a good idea, thanks. I never did "man sh" so never stumbled across that
discrepancy.


-- 
With best regards,
Andrey Repin
Saturday, April 8, 2023 11:31:34

Sorry for my terrible english...

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019