This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] TEST: Cygwin 3.0.0-0.1


On Jan 29 16:45, Steven Penny wrote:
> On Tue, 29 Jan 2019 20:59:59, Corinna Vinschen wrote:
> > - New file ioctls's FS_IOC_GETFLAGS and FS_IOC_SETFLAGS.  The actual
> >   inode flags are Cygwin-specific.  This allows to set or reset
> >   DOS attributes, file sparseness, FS level encryption and compression,
> >   as well as directory case sensitivity programatically.
> > 
> > - New tools chattr(1) and lsattr(1) to utilize setting and viewing the
> >   aforementioned new ioctl's on the command line.
> 
> these are very much appreciated. going back to my previous post:
> 
> https://cygwin.com/ml/cygwin/2018-12/msg00163.html
> 
> i re-ran with the new tool, however i am getting unexpected result:
> 
> $ lsattr /cygdrive/c
> -hs--------- /cygdrive/c/$Recycle.Bin
> -hs--------- /cygdrive/c/Config.Msi
> ------------ /cygdrive/c/cygwin64
> lsattr: Device or resource busy while trying to open /cygdrive/c/pagefile.sys
> ------------ /cygdrive/c/PerfLogs
> r----------- /cygdrive/c/Program Files
> r----------- /cygdrive/c/Program Files (x86)
> -h-------n-- /cygdrive/c/ProgramData
> -hs------n-- /cygdrive/c/Recovery
> -hs--------- /cygdrive/c/System Volume Information
> r----------- /cygdrive/c/Users
> ------------ /cygdrive/c/Windows
> 
> compare with cmd.exe:
> 
> > dir /A C:\
> 2018-10-08  11:20 AM    <DIR>          $Recycle.Bin
> 2019-01-10  05:20 PM    <DIR>          Config.Msi
> 2019-01-29  06:33 PM    <DIR>          cygwin64
> 2009-07-13  11:08 PM    <JUNCTION>     Documents and Settings [C:\Users]
> 2018-10-08  07:48 PM    <DIR>          NVIDIA
> 2018-12-23  09:57 AM    17,138,294,784 pagefile.sys
> 2009-07-13  09:20 PM    <DIR>          PerfLogs
> 2019-01-01  02:10 PM    <DIR>          Program Files
> 2018-12-19  01:19 PM    <DIR>          Program Files (x86)
> 2018-10-31  06:07 PM    <DIR>          ProgramData
> 2018-10-08  11:14 AM    <DIR>          Recovery
> 2019-01-29  03:36 PM    <DIR>          System Volume Information
> 2018-11-18  01:10 AM    <DIR>          Users
> 2018-11-09  08:18 AM    <DIR>          Windows
> 
> or attrib:
> 
> > attrib C:\pagefile.sys
> A  SH        C:\pagefile.sys

Ah, that's easily explained.  lsattr has to open the file with read
perms to be allowed to call ioctl on the file descriptor:

  fd = open (filename, O_RDONLY);
  ioctl (fd, FS_IOC_GETFLAGS, &flags);
  close (fd);

But that's disallowed for certain files.  pagefile.sys, for instance,
always results in a sharing violation when trying to open it.

cmd's dir as well as attrib don't even try to open the file.  Both
open the directory and print the attributes from the directory
information.

Nothing I can do about for now.  We could add another ioctl at
one point which operates on the parent dir, kind of like:

  fd_dir = open (parent_dir, O_RDONLY);
  ioctl (fd_dir, FS_IOC_GETFLAGS_FILE, filename, &flags);
  close (fd_dir)

Patches welcome.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]