delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/02/20/09:41:32

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:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type; q=dns; s=default; b=hHauqeW
gfuS+qN0DTuCurFUXvMXde7dhP6BHBwbvqqqGaBoVv5Qzr4nH5laeKOaX6t1CjVy
7fwGE5skr7gbtMz3HE7calEbWNG8y/17cR53mCO23QgKLDs1wj/KMwmKk1/7nNm+
ozLNIjLVL6qYHlkfbSW2DL4Na1dqIiXsKqrE=
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:mime-version:references:in-reply-to:from:date
:message-id:subject:to:content-type; s=default; bh=aGyg7c2SROI2J
7v/06oeO3DWB3I=; b=JQJKAuUn8xXKTXemPBRrWtjS3V7tB2QjEOD+1XOjVO8u6
UH12hLr2PfE0O56lM9fuePWTg643QeY3TPTinaB4q2bjJ63ObMCvARpTzDL8tzKb
WHtPYztftf8awXmLLcKYxSor1sx3AMpfsLza6wU/ELxIu5PJMPWIb9DHUwSFMU=
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=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=unusual, rwr, rw-r, rwxr-xr-x
X-HELO: mail-qk1-f182.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=lN1wKwz1ZNDv9z/k6eiVarTNYMRhzOP8B7XRaJNASIo=; b=FgwX1O2NewrkUlkZR+Z2qXWpcbqOgqdt6wnLM4D5L73LHCu/ygQkJAHvcwxcjyfsta JPNewEOoUnUDXWAV06rlemaVs7dzctdhSsKl5XmlnGmKoS+acdi2qOSDlg+/I3lRKp+B 1kBsXGIF4sTXK7xJKqapbIPqKglbBK5k+k1Guipu38mSOIKJme2u3p0dab6xQB+pWpK6 K75GVlUwqNDQ8leNYm3UEFcAq42eiLEZSbVqk2SdmxSZMAD0jGgn2SN0Y62Jr+43uAfS TbpzWYuEekV5ynY+6wBJqwFmGPi5QdXkBCv1tUn2UJHoVu4o908jVFj5WHaOtylislcI n0EA==
MIME-Version: 1.0
References: <CACac1F_8+6mDAarSawsKCVea7FuUDsWc3XseLLpH3zdZTbLC_Q AT mail DOT gmail DOT com>
In-Reply-To: <CACac1F_8+6mDAarSawsKCVea7FuUDsWc3XseLLpH3zdZTbLC_Q@mail.gmail.com>
From: Paul Moore <p DOT f DOT moore AT gmail DOT com>
Date: Thu, 20 Feb 2020 14:40:26 +0000
Message-ID: <CACac1F-HpAfetyi-=A4=fEg1WPNM8ipU7TYEi6OdHKE0vBG+Og@mail.gmail.com>
Subject: Re: CYGWIN env variable - glob option
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

Some further investigations.

1. I missed the comment "default is set". So setting CYGWIN=glob is
irrelevant. I may still want to set CYGWIN=glob:ignorecase, but that's
a separate matter.
2. With forward slashes, globbing works as expected:

E:\Utils\Cygwin64\bin\echo E:/Work/Scratch/m*.py
E:/Work/Scratch/markov_pmf.py E:/Work/Scratch/monopoly.py

However, with backslashes it does not:

>E:\Utils\Cygwin64\bin\echo E:\Work\Scratch\*.py
E:\Work\Scratch\*.py

I can understand that the conflict between Windows using backslash as
a directory separator and Unix using it as an escape character makes
for a difficult problem, but nevertheless, the current behaviour is
problematic for me (I won't say "wrong", because clearly plenty of
people are fine with it, but it doesn't suit my use case, and I don't
know if there's any setting I can use to improve things).

Basically my issue is that I want to use cygwin from a Windows shell
(powershell). I do *not* run cygwin commands from the cygwin shell - I
am very familiar with, and comfortable in, powershell, but I do need
Unix-like commands like grep, diff, etc, and cygwin provides the most
reliable forms of those commands (good Unicode support, no weird bugs
or porting glitches...) I routinely tab-complete directory names, with
things like "grep so<TAB>*.py" which autocompletes on tab to "grep
.\sources\" and then I add "*.py". So it's fairly important for me
that backslash-separated pathnames work. I don't know how unusual this
is - I hear many people talking about using cygwin tools to get
Unix-like utilities on Windows, but I don't know if the common use is
via a cygwin shell (with a full Unix experience) or mixing Cygwin into
a Windows shell like I do.

If cygwin isn't intended to fit seamlessly into this use case, then
that's fine - I'll just need to find an alternative way of getting
Unix-like commands (maybe go back to mingw-compiled versions, and
accept their limitations). But if there *is* a way to get things to
work for my situation, I'd be disappointed if I missed it :-)

If there *isn't* an option like that, is it something that could be
added to the existing globbing code? I've never contributed to cygwin,
but how easy would such a change be?

Paul



On Wed, 19 Feb 2020 at 16:46, Paul Moore <p DOT f DOT moore AT gmail DOT com> wrote:
>
> I'm not sure if I'm misunderstanding the documentation of the "glob"
> option in the CYGWIN environment variable. I have (this is under
> Powershell Core 7.0.0-rc2):
>
> $env:CYGWIN="glob:ignorecase winsymlinks:native"
>
> if I then try to grep in a file that exists, using wildcards to
> specify it, I get
>
> > C:\Utils\Cygwin64\bin\grep.exe . C:\Work\Scratch\mkpip*.ps1
> /usr/bin/grep: C:\Work\Scratch\mkpip*.ps1: No such file or directory
>
> Using echo as a (presumably) simpler test case:
>
> >C:\Utils\Cygwin64\bin\echo.exe C:\Work\Scratch\*.ps1
> C:\Work\Scratch\*.ps1
>
> >C:\Utils\Cygwin64\bin\ls.exe -l C:\Work\Scratch\
> total 1121
> -rwxr-xr-x 1 Gustav Gustav 1144832 Feb 17 15:15 DigraphMgr.exe
> -rw-r--r-- 1 Gustav Gustav     172 Jan 23 10:37 mkpipclone.ps1
>
> I thought that the glob option resulted in glob expansion being done
> before the args are passed to the grep command, so my expectation was
> that this would work.
>
> This is with the very latest cygwin DLL - 3.1.4-1. I tried downgrading
> to 3.1.2 (the earliest the installer offered) but that was no
> different. The odd thing is that I thought I'd tested this on anther
> machine, but now I can't get it to work as I expect :-(
>
> Am I doing something wrong? Or are my expectations incorrect? I need
> to work with "native" backslash-delimited path names, because that's
> how my shell autocompletes directory names, and patching them up with
> forward slashes isn't really an option for me.
>
> Paul

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