fstat weirdness

Corinna Vinschen vinschen@redhat.com
Tue Jun 3 16:03:00 GMT 2003


On Tue, Jun 03, 2003 at 11:43:30AM -0400, Pierre A. Humblet wrote:
> Around line 182 of fhandler-disk_file.cc there is this strange
> comment:
>   /* Check a special case here. If ntsec is ON it happens
>      that a process creates a file using mode 000 to disallow
>      other processes access. In contrast to UNIX, this results
>      in a failing open call in the same process. Check that
>      case. */
> I have looked up cvs and the ChangeLogs to find its origin,
> without success.

Tue Feb  6 15:04:00 2001  Corinna Vinschen <corinna@vinschen.de>

        * syscalls.cc (stat_worker): Add a check for the special case when
	a process creates a file using mode 000 using ntsec.

I found the reason for the change in my mail archive. A snippet from
a PM to Chris:

=== SNIP ===
> I've found a serious problem in tar-1.13.18-2 in latest which didn't
> occur in tar-1.13-2. Symlinks aren't correctly created if a ".." is
> part of the link.
[...]
I've found the reason for that. The file which is created as a
placeholder for the symlink is created with mode 000. The later
lstat is no problem when running UNIX but it's a problem on
Cygwin. lstat tries to open the file to do a GetFileInformationByHandle
call. This open fails when running ntsec.[...]
=== SNAP ===

> The comment is strange because this section runs after a query_open
> has failed for access reasons. Such failure ONLY happens if there is
> no access_allowed ACE (even without any rights) for the current user
> nor one of his/her groups. Thus it can't happen when the file was
> created by Cygwin (as implied in the comment), because Cygwin
> always adds ACEs for the owner and for everyone (even with mode 000).

Since the original problem occured more than two years ago, it's not
obvious if we still need it.  Checking the above situation with tar
might help.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.



More information about the Cygwin-developers mailing list