ntea & chmod

Pierre A. Humblet Pierre.Humblet@ieee.org
Sun Aug 29 03:43:00 GMT 2004

As far as I understand the code (I am on WinME),
ntea doesn't work properly in 1.5.10

For example in ::fchmod, the line
      if (!set_file_attribute (pc.has_acls (), get_io_handle (), pc,
                               ILLEGAL_UID, ILLEGAL_GID, mode)
          && allow_ntsec)
        res = 0;
guarantees a -1 return when ntea is on and allow_ntsec is off.
When both are on, it should work OK on FAT, but not on FAT32,
which does not support extended attributes. 

I think the right logic on NT would be to modify set_file_attribute
as follows:

set_file_attribute (path_conv & pc ....   <=== new arg type
  int ret = 0;

  if (allow_ntsec && pc.has_acls ())
    ret = set_nt_attribute (handle, file, uid, gid, attribute);
  else if (allow_ntea && pc.fs_has_ea ())
      SetFileAttributes (pc, (DWORD) pc & ~FILE_ATTRIBUTE_READONLY)
      bool res = NTWriteEA (file, ".UNIXATTR", (char *) &attribute,
                                     sizeof (attribute)))
pc.fs_has_ea () should be set properly as well in path.cc.
Currently it's set to make sense for symlink (that's obsolete),
not for ntea.

More information about the Cygwin-developers mailing list