delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/13/09:42:33

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.1 required=5.0 tests=AWL,BAYES_50,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <20110513154205.91734baccmw9fygd@messagerie.si.c-s.fr>
Date: Fri, 13 May 2011 15:42:05 +0200
From: EXCOFFIER Denis <denis DOT excoffier AT c-s DOT fr>
To: cygwin AT cygwin DOT com
Subject: Re: CMD.EXE able to create files in directories on a shared drive, but bash in cygwin is unable to
MIME-Version: 1.0
User-Agent: Internet Messaging Program (IMP) H3 (4.3.9)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hello,

This one is a follow-up for http://cygwin.com/ml/cygwin/2011-05/msg00183.html

On 2011-05-12 09:47:15 -0600 Keith Christian wrote:
> This permissions problem has existed for awhile, and I'd like to find
a solution.
Same for me.

> CMD.EXE is able to create files inside directories on a standard
> Windows share, but from a Bash shell on Cygwin, a permission denied
> message occurs, and this is in most if not all directories:
Same for me. I use tcsh.

jupiter% uname -a
CYGWIN_NT-5.1 TOLX300043890 1.7.10s(0.244/5/3) 20110510 19:08:34 i686 Cygwin
jupiter%

(I use the last snapshot)


=======CMD.EXE=======
S:\historic>cacls S:\historic
S:\historic DT\AMNO:(OI)(CI)F
             <Account Domain not found>(OI)(CI)R
             <Account Domain not found>(OI)(CI)C

S:\historic>echo foo > foo

S:\historic>cacls foo
S:\historic\foo DT\AMNO:F
                 <Account Domain not found>R
                 <Account Domain not found>C

S:\historic>dir foo
  Volume in drive S is Data
  Volume Serial Number is 84E6-0A33

  Directory of S:\historic

2011-05-13  14:55                 6 foo
                1 File(s)              6 bytes
                0 Dir(s)     449 445 888 bytes free


=======TCSH/CYGWIN=======
jupiter% pwd
/cygdrive/s/historic
jupiter% ls -dl .
d--------- 1 denis59 Domain Users 0 May 13 14:54 ./
jupiter% ls -dl foo
---------- 1 denis59 Domain Users 6 May 13 14:54 foo
jupiter% echo foo2 > foo2
foo2: Permission denied.


My disk has exactly the same properties as in the original message (except
for Device Type 6 instead of 7):

jupiter% /usr/lib/csih/getVolInfo /cygdrive/s
Device Type        : 6
Characteristics    : 10
Volume Name        : <Data>
Serial Number      : 2229668403
Max Filenamelength : 255
Filesystemname     : <NTFS>
Flags              : 700ff
   FILE_CASE_SENSITIVE_SEARCH  : TRUE
   FILE_CASE_PRESERVED_NAMES   : TRUE
   FILE_UNICODE_ON_DISK        : TRUE
   FILE_PERSISTENT_ACLS        : TRUE
   FILE_FILE_COMPRESSION       : TRUE
   FILE_VOLUME_QUOTAS          : TRUE
   FILE_SUPPORTS_SPARSE_FILES  : TRUE
   FILE_SUPPORTS_REPARSE_POINTS: TRUE
   FILE_SUPPORTS_REMOTE_STORAGE: FALSE
   FILE_VOLUME_IS_COMPRESSED   : FALSE
   FILE_SUPPORTS_OBJECT_IDS    : TRUE
   FILE_SUPPORTS_ENCRYPTION    : TRUE
   FILE_NAMED_STREAMS          : TRUE
   FILE_READ_ONLY_VOLUME       : FALSE
   FILE_SEQUENTIAL_WRITE_ONCE  : FALSE
   FILE_SUPPORTS_TRANSACTIONS  : FALSE

And the strace is similar, with the same requested access bits.

jupiter% strace -o /tmp/bash.trace bash -c 'echo foo2 > foo2'
jupiter% grep 'open: C0000022' /tmp/bash.trace
    65  126396 [main] bash 5412 fhandler_base::open: C0000022 =  
NtCreateFile (0x0, 40160080, \??\S:\historic\foo2, io, NULL, 80, 7, 5,  
4020, NULL, 0)


My Windows is XP SP3. I'm a normal user. I've installed Cygwin "Just Me".

Now, if i only touch the foo, or if i write inside it, or if i replace it,
it works:

jupiter% ls -dl foo
---------- 1 denis59 Domain Users 6 May 13 14:54 foo
jupiter% touch foo
jupiter% ls -dl foo
---------- 1 denis59 Domain Users 6 May 13 15:12 foo
jupiter% echo foo >> foo
jupiter% ls -dl foo
---------- 1 denis59 Domain Users 10 May 13 15:15 foo
jupiter% od -c foo
0000000   f   o   o      \r  \n   f   o   o  \n
0000012
jupiter% echo foo >! foo                    <- remember, i'm under tcsh
jupiter% ls -dl foo
---------- 1 denis59 Domain Users 4 May 13 15:29 foo
jupiter%

jupiter% strace -o /tmp/bash.trace2 bash -c 'echo foo >> foo'
jupiter% strace -o /tmp/bash.trace3 bash -c 'echo foo > foo'

With the corresponding line in bash.trace2 is:
51  128428 [main] bash 4300 fhandler_base::open: 0 = NtCreateFile  
(0x650, 40120080, \??\S:\historic\foo, io, NULL, 80, 7, 3, 4020, NULL,  
0)
and in bash.trace3:
49  150149 [main] bash 4948 fhandler_base::open: 0 = NtCreateFile  
(0x650, 40120080, \??\S:\historic\foo, io, NULL, 80, 7, 5, 4020, NULL,  
0)

The flag WRITE_DAC has disappeared in these cases.

So it seems we have to dig into WRITE_DAC.


Best regards.

Denis Excoffier.



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019