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]

Strange fstatat / stat behavour on directories causing tar "file changed as we read it" error

Just been debugging a very strange issue where tar was
reporting "file changed as we read it" for directories
which aren't actually seeing any changes.

It turns out that the value of st_size returned by a call
to fstatat on a directory can change even though there
have been no changes at all to said directory or its

It seems that purely looking in a directory will change
the "size" value reported by fstatat and likely stat.

For a directory which hasn't been traversed / looked in
its size is 0 where as after its been looked in it tends
to report 8192.

The result is that tar which checks for consistency of
the data its archiving errors (although soft error) when
archiving a directory as on initial access its size is
0 but after compressing all the files in said dir and
hence looking in that directory its size is 8192.

The attached patch fixes this strange behaviour by ignoring
size changes for directories as well as correcting the file
size check to also detect file shrinks as well as growths,
which seemed very odd.

Is there some "meta data" caching going on in cygwin or
Windows which causes this very strange behaviour?


Attachment: tar-src-create.c.patch
Description: Binary data

Problem reports:
Unsubscribe info:

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