public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Exclude System entries with "ls" or "find"
Date: Wed, 19 Dec 2018 12:20:00 -0000	[thread overview]
Message-ID: <20181219100622.GF28727@calimero.vinschen.de> (raw)
In-Reply-To: <7831498f-3c06-5810-354e-87c452d3a0e7@SystematicSw.ab.ca>

[-- Attachment #1: Type: text/plain, Size: 2652 bytes --]

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=hidefileswithattributes:[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=newlib-cygwin.git;a=commitdiff;h=7ae73be14194
https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=8b6804b8a881

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 = cygwin_create_path (CCP_POSIX_TO_WIN_W, posix_path);
   attrs = 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

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-12-19 10:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18  8:13 Steven Penny
2018-12-18 12:58 ` Corinna Vinschen
2018-12-18 15:51   ` Eliot Moss
2018-12-18 16:19     ` cyg Simple
2018-12-19  1:10       ` Eliot Moss
2018-12-19 10:06   ` Brian Inglis
2018-12-19 12:20     ` Corinna Vinschen [this message]
2018-12-19 12:53       ` Andrey Repin
2018-12-19 13:37         ` Eliot Moss
2018-12-19 14:50           ` Corinna Vinschen
2018-12-19 15:19             ` Andrey Repin
2018-12-19 18:25               ` Corinna Vinschen
2018-12-19 20:57               ` Brian Inglis

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=20181219100622.GF28727@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --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).