delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/09/04/23:23:08

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4F5F3851C1A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1599276144;
bh=HsVeexX1VFVKIIupbj7JxIVS0cZ9DeyHZ6Q44R+oovI=;
h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=sN9n5nwiqP9mC+fL6TiVlJhZG5YRD4KTi244RX5Mbz0wZ5lx4EJUh2buwp3I5LY7l
mZbvPNficsS36ScbmcJZcPVEDyrDGQkLkAmTZ5GqdmirB/8KiqS4wHI5CiJhCx3yrL
TeaDzW3LZEzooYENiU4wNZ1ACPHdiIrGeGI8jmiQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AC0473857C5C
X-CMAE-Analysis: v=2.3 cv=ffXTNHYF c=1 sm=1 tr=0
a=rov2TMmdNa1L32Ajm2rx/g==:117 a=rov2TMmdNa1L32Ajm2rx/g==:17
a=IkcTkHD0fZMA:10 a=x7bEGLp0ZPQA:10 a=loFcDopfAy4A:10
a=YtygPl7jKoKW-k0D3gAA:9 a=QEXdDO2ut3YA:10
X-SECURESERVER-ACCT: bob AT bnlmcgowan DOT net
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: Is this a bug in bash?
Message-ID: <50fad2a4-22c3-8de8-3a0a-394c0b95048b@gmail.com>
Date: Fri, 4 Sep 2020 20:22:18 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.12.0
MIME-Version: 1.0
X-CMAE-Envelope: MS4wfCWTdLidWZhGNksOKAPUvkOHCDueHBcL9/81WqpPSjz+4be7b/tb7MMeIMa39g8GryoMCaRcl9oUBtTUmVyXMZkNKrt+j40OwvnvbMsEIsEyQe7SfVAU
5FWHxKBJKH3CWW3NBr7Ty15l4S0blXHdVDeHk6Sd1t/3zShc3AX3emnB
X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,
FORGED_GMAIL_RCVD, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KAM_DMARC_NONE,
KAM_DMARC_STATUS, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_SOFTFAIL, SPOOFED_FREEMAIL,
TXREP autolearn=no autolearn_force=no version=3.4.2
X-Spam-Level: **
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-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: Bob McGowan via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Bob McGowan <ramjr0915 AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 0853Mq7Y028689

I am trying to set things up so the Bash profile detects if bash is 
running from the Windows "XWin Server" startup link or not. The startup 
link has the following as the command:

C:\cygwin64\bin\run.exe --quote /usr/bin/bash.exe -l -c "cd; exec 
/usr/bin/startxwin"

So I thought I'd try adding the env command to set an environment variable:

C:\cygwin64\bin\run.exe --quote /usr/bin/env startxwin=yes 
/usr/bin/bash.exe -l -c "cd; exec /usr/bin/startxwin"

This works (if there's a better way, I'd be happy to learn of it) but in 
the process of testing I had a problem when echo'ing the variable.

For purposes of describing the bug, I simplified the command as follows:

     env startup=yes bash -l -c 'echo "cmd:  $startup"'

I also added an "echo profile: $startup" to the .bash_profile file.

When I run the above in a Cygwin shell, the output is:

$ env startup=yes bash -l -c "echo cmd: $startup"
profile: yes
$

When I run it in a Linux shell, the output is:

$ env startup=yes bash -l -c 'echo "cmd:  $startup"'
profile: yes
cmd:  yes
$

As you can see, the Cygwin side fails to generate any output from the -c 
echo command but on the Linux system there is output.

Normally I'd call this a bug but since this is running under Windows it 
may be some weirdness of the implementation required to create the Linux 
like environment.

The Bash version in Cygwin is  4.4.12(3)-release and for my Debian Linux 
system, it is 5.0.3(1)-release.  So it could also be that it existed in 
Linux 4.x series and has been fixed in the 5.x series.

Bob

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