X-Recipient: archive-cygwin@delorie.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:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=hvXFBRlsR8zIsyfVED+62t1cVluwEJYo79rdJvl/ScFhylNVnyaR2
	pZp7wHw1Nig9pjsiWUV0W1n3sxPyl/3z5BAav62BhJsAB9dD3A48eYCF1oKIdcPl
	0GZZhrqabvw8DgTEVcwOrXdJcW1/A5qhSHQCDiVvYJ32ELFGWZDshM=
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:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=CPu0nHvrh/Z5DVkLLiQgkx1apm8=; b=vDZ7Um/x3AyO3yqwIwfw5epU3F8h
	vl1g+oclFRe1K2Rhx6DrWk9v2z8Wu2ej8CUXbMYxSaPjxf3L9VKviNgsT76sCoXq
	KMS2/p0QkIKBHM1NtU2QFu+E+i7RzBvimepEBjHY047+LjUnyHM8AwvaWe65cRNr
	PEr4KzoZBTJ3hbw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=bright, listings, Prompt, brian
X-HELO: mout.kundenserver.de
Date: Wed, 19 Dec 2018 11:06:22 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Exclude System entries with "ls" or "find"
Message-ID: <20181219100622.GF28727@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <5c184377.1c69fb81.7df8f.9525@mx.google.com> <20181218081347.GD28727@calimero.vinschen.de> <7831498f-3c06-5810-354e-87c452d3a0e7@SystematicSw.ab.ca>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="1Sa0i77dkqaUxqYg"
Content-Disposition: inline
In-Reply-To: <7831498f-3c06-5810-354e-87c452d3a0e7@SystematicSw.ab.ca>
User-Agent: Mutt/1.9.2 (2017-12-15)

--1Sa0i77dkqaUxqYg
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Dec 18 22:00, Brian Inglis wrote:
> On 2018-12-18 01:13, Corinna Vinschen wrote:
> > On Dec 17 16:46, Steven Penny wrote:
> >> Compare Cygwin:
> >>    $ ls -1 -N /cygdrive/c
> >>    $Recycle.Bin
> >>    cygwin64
> >>    Documents and Settings
> >>    pagefile.sys
> >>    PerfLogs
> >>    Program Files
> >>    Program Files (x86)
> >>    ProgramData
> >>    Recovery
> >>    System Volume Information
> >>    Users
> >>    Windows
> >> With Command Prompt:
> >>    > dir /A:-S C:
> >>    2018-12-08  10:14 AM    <DIR>          cygwin64
> >>    2009-07-13  09:20 PM    <DIR>          PerfLogs
> >>    2018-12-15  06:05 PM    <DIR>          Program Files
> >>    2018-12-15  05:21 PM    <DIR>          Program Files (x86)
> >>    2018-10-31  06:07 PM    <DIR>          ProgramData
> >>    2018-11-18  01:10 AM    <DIR>          Users
> >>    2018-11-09  08:18 AM    <DIR>          Windows
> >> as can be seen, Command Prompt has a way to exclude System items. Does=
 Cygwin
> >> have some way to do this, perhaps with "ls" or "find"?
> > You're asking POSIX tools to recognize DOS attributes...
> Could perhaps be supported as an env option
> 	CYGWIN=3Dhidefileswithattributes:[SH]...
> with a possibility of overriding that and seeing the files (as with . and=
 ..)
> when ls -a is specified, if SWTDI? Meanwhile CyNWin (no more than CyNUX).

YA logic with questionable gain in the file resolution?  I'm not
exactly looking forward to that.

Just this year, when implementing O_TMPFILE, I had this brilliant idea
to hide temporary files from directory listings, which turned out to be
not such a bright idea, after all:

https://sourceware.org/git/?p=3Dnewlib-cygwin.git;a=3Dcommitdiff;h=3D7ae73b=
e14194
https://sourceware.org/git/?p=3Dnewlib-cygwin.git;a=3Dcommitdiff;h=3D8b6804=
b8a881

Cygwin symlinks have the System attribute set, too.  Do you want to see
them or not when setting this option?

Bottom line is, if you want to handle DOS attributes in a special way
not covered by our POSIX emulation, user space has to do it.  Either you
use sth. like

   w32_path =3D cygwin_create_path (CCP_POSIX_TO_WIN_W, posix_path);
   attrs =3D GetFileAttributesW (w32_path);
   free (w32_path);

Or we could implement an API for that.  As far as I can see Linux has one
already, an ioctl supported by the vfat driver:

  uint32_t attrs;
  ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attrs);
  ioctl(fd, FAT_IOCTL_SET_ATTRIBUTES, &attrs);

Of course, this doesn't help you a lot using standard tools like ls or
find but then WIndows' attrib command is your friend.


Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--1Sa0i77dkqaUxqYg
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlwaGB4ACgkQ9TYGna5E
T6BR5g//X+9mdMMej9j0YrqArKGEwzKqJk/LRA/GN1UFSAfbFODFUlsGBH5D7W1e
ZBDw67NxHCajCAtInNPfc5T+4PwCUm2oCfy/Z7dsxX0+Fx+OFRlgh+nQRjqTB4Dc
6yo1TxKjAweqfkeZhuWfdhM2AgUH/qVvb+qxikvEo4KnP4TQ+pEAd2Cn8XsNXa5c
mO1So2vDwkTba1q4kwo9UO6BFhOlP9Qr6igRsmkTIzntQ2CC869F0MOH3K1fstav
a6o2WClOwwFW85fjStvilvO950VouAL0zGnvCvvQkSc7S08piFCaQS8dmERdWIIe
Yza8Cbj2ICznIwC8QWc0euJySXWJvuktTjWy7B5hN6qq0zIpGa3/aSfbwuFovs3t
5hVPbyd0zwuP/OwahY4jAzUFK+ELfZQynQ7ZvuZ5XdzuGuO6OtLSRYSrdQlgj6DF
OBZyNLcUBoFywtcrrNlkwm1R/GNJ9oNX05aG9slVQdCg8CuIK9iFkwn1rGSJGdPW
QBVTCAXFzr6FUPN8sB3kFVtfFvd4qjgqq/oCrJK5ywB7YoGIKfz6pgfWdm5HjJ19
SyLFI4Wya76/CZqqNcIZD0OiwOFqrXzm4urFNNInNGQ4Xs/BADw3DM6bH522lKaV
eAebeRgaXPeEwn+DwtdvcZV5zp9d2DpExsJAHxH9OrV4sB0IVl0=
=ksT/
-----END PGP SIGNATURE-----

--1Sa0i77dkqaUxqYg--
