This is the mail archive of the cygwin-patches 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: [PATCH] Fix stat.st_blocks for files compressed with CompactOS method


On Apr 22 16:34, Christian Franke wrote:
> Corinna Vinschen wrote:
> > Hi Christian,
> > 
> > On Apr 22 14:50, Christian Franke wrote:
> > > Cygwin 2.8.0 returns stat.st_blocks = 0 if a file is compressed with
> > > CompactOS method (at least on Win10 1607):
> > > [...]
> > > This is because StandardInformation.AllocationSize is always 0 for theses
> > > files. CompressedFileSize returns the correct value.
> > > 
> > > This is likely related to the interesting method how these files are encoded
> > > in the MFT:
> > > The default $DATA stream is a sparse stream with original size but no
> > > allocated blocks.
> > > An alternate $DATA stream WofCompressedData contains the compressed data.
> > > An additional $REPARSE_POINT possibly marks this file a special and lets
> > > accesses fail on older Windows releases (and on Linux, most current forensic
> > > tools, ...).
> > > 
> > > With the attached patch, stat.st_blocks work as expected:
> > > [...]
> > > -  else if (::has_attribute (attributes, FILE_ATTRIBUTE_COMPRESSED
> > > -					| FILE_ATTRIBUTE_SPARSE_FILE)
> > > +  else if ((pfai->StandardInformation.AllocationSize.QuadPart == 0LL
> > > +	    || ::has_attribute (attributes, FILE_ATTRIBUTE_COMPRESSED
> > > +					  | FILE_ATTRIBUTE_SPARSE_FILE))
> > Are you saying these files actually have no FILE_ATTRIBUTE_COMPRESSED
> > bit set???
> > 
> 
> Yes. The only evidence is the CompressedSize.
> There is also no visual emphasis in explorer listings.

Weird.  Patch pushed.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

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]