public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cp creates unreadable file on Windows 7
@ 2013-10-09 21:30 Frank, Matthew I
  2013-10-09 22:27 ` Larry Hall (Cygwin)
  2013-10-10  3:05 ` Andrey Repin
  0 siblings, 2 replies; 5+ messages in thread
From: Frank, Matthew I @ 2013-10-09 21:30 UTC (permalink / raw)
  To: cygwin

I believe my problem is identical to the one reported in:
http://cygwin.com/ml/cygwin/2012-02/msg00456.html, but that message chain ended with
"mount your file system noacl" which isn't an option for me, so I'm looking for
other alternatives.

I create a file using cmd.exe in a directory created by cmd.exe.  Then in Cygwin bash I
mkdir a directory (two levels deep) and cp the file into the new directory.  The resulting
file is not readable by any Windows or Cygwin executable.  I can't say whether this is
correct or not, but it surprised me.

I am on a corporate network (logged in using network credentials).  The filesystem is NTFS,
the machine is Windows 7.  I am an Administrator on the machine.  I am using the new 64-bit
Cygwin installed in c:\users\mifrank\cygwin64, but the problem was originally reported by
several of my users, and they are using slightly older 32-bit versions of Cygwin installed
in c:\cygwin.

Reproducer.  Step 1 (must be done in a cmd.exe shell.)

	C:\>md dos-level1
	C:\>echo foo > dos-level1\bar
	C:\>cat dos-level1\bar
	foo
	C:\>icacls.exe dos-level1\
	dos-level1\ BUILTIN\Administrators:(I)(F)
            BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
            NT AUTHORITY\SYSTEM:(I)(F)
            NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
            BUILTIN\Users:(I)(OI)(CI)(RX)
            NT AUTHORITY\Authenticated Users:(I)(M)
            NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

	Successfully processed 1 files; Failed processing 0 files
	C:\>icacls.exe dos-level1\bar
	dos-level1\bar BUILTIN\Administrators:(I)(F)
               NT AUTHORITY\SYSTEM:(I)(F)
           	   BUILTIN\Users:(I)(RX)
               NT AUTHORITY\Authenticated Users:(I)(M)

	Successfully processed 1 files; Failed processing 0 files

Step 2 (from Cygwin bash shell)

	$ cygcheck -V
	cygcheck (cygwin) 1.7.25
	$ cd /cygdrive/c/
	$ groups
	Domain Users Users
	$ umask
	0022
	$ mkdir --parents cyg-level1/cyg-level2
	$ cat dos-level1/bar
	foo
	$ cp dos-level1/bar cyg-level1/cyg-level2/
	$ cat cyg-level1/cyg-level2/bar
	cat: cyg-level1/cyg-level2/bar: Permission denied

	$ icacls.exe cyg-level1/cyg-level2/
	cyg-level1/cyg-level2/ AMR\mifrank:(F)
                       AMR\Domain Users:(RX)
                       Everyone:(RX)
                       BUILTIN\Administrators:(F)
                       NT AUTHORITY\SYSTEM:(F)
                       BUILTIN\Users:(RX)
                       NT AUTHORITY\Authenticated Users:(M)
                       CREATOR OWNER:(OI)(CI)(IO)(F)
                       CREATOR GROUP:(OI)(CI)(IO)(RX)
                       Everyone:(OI)(CI)(IO)(RX)

	Successfully processed 1 files; Failed processing 0 files
	$ icacls.exe cyg-level1/cyg-level2/bar
	cyg-level1/cyg-level2/bar AMR\mifrank:(D,Rc,WDAC,WO,RA,WA)
                          AMR\Domain Users:(Rc,S,RA)
                          Everyone:(Rc,S,RA)

	Successfully processed 1 files; Failed processing 0 files

On the other hand:

	$ echo fromcyg > cyg-level1/cyg-level2/baz
	$ cat cyg-level1/cyg-level2/baz
	fromcyg
	$ icacls.exe cyg-level1/cyg-level2/baz
	cyg-level1/cyg-level2/baz AMR\mifrank:(R,W,D,WDAC,WO)
                          AMR\Domain Users:(R)
                          Everyone:(R)

	Successfully processed 1 files; Failed processing 0 files

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cp creates unreadable file on Windows 7
  2013-10-09 21:30 cp creates unreadable file on Windows 7 Frank, Matthew I
@ 2013-10-09 22:27 ` Larry Hall (Cygwin)
  2013-10-10  3:05 ` Andrey Repin
  1 sibling, 0 replies; 5+ messages in thread
From: Larry Hall (Cygwin) @ 2013-10-09 22:27 UTC (permalink / raw)
  To: cygwin

On 10/9/2013 5:30 PM, Frank, Matthew I wrote:
> I believe my problem is identical to the one reported in:
> http://cygwin.com/ml/cygwin/2012-02/msg00456.html, but that message chain ended with
> "mount your file system noacl" which isn't an option for me, so I'm looking for
> other alternatives.
>
> I create a file using cmd.exe in a directory created by cmd.exe.  Then in Cygwin bash I
> mkdir a directory (two levels deep) and cp the file into the new directory.  The resulting
> file is not readable by any Windows or Cygwin executable.  I can't say whether this is
> correct or not, but it surprised me.
>
> I am on a corporate network (logged in using network credentials).  The filesystem is NTFS,
> the machine is Windows 7.  I am an Administrator on the machine.  I am using the new 64-bit
> Cygwin installed in c:\users\mifrank\cygwin64, but the problem was originally reported by
> several of my users, and they are using slightly older 32-bit versions of Cygwin installed
> in c:\cygwin.
>
> Reproducer.  Step 1 (must be done in a cmd.exe shell.)
>
> 	C:\>md dos-level1
> 	C:\>echo foo > dos-level1\bar
> 	C:\>cat dos-level1\bar
> 	foo
> 	C:\>icacls.exe dos-level1\
> 	dos-level1\ BUILTIN\Administrators:(I)(F)
>              BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
>              NT AUTHORITY\SYSTEM:(I)(F)
>              NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
>              BUILTIN\Users:(I)(OI)(CI)(RX)
>              NT AUTHORITY\Authenticated Users:(I)(M)
>              NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
>
> 	Successfully processed 1 files; Failed processing 0 files
> 	C:\>icacls.exe dos-level1\bar
> 	dos-level1\bar BUILTIN\Administrators:(I)(F)
>                 NT AUTHORITY\SYSTEM:(I)(F)
>             	   BUILTIN\Users:(I)(RX)
>                 NT AUTHORITY\Authenticated Users:(I)(M)
>
> 	Successfully processed 1 files; Failed processing 0 files
>
> Step 2 (from Cygwin bash shell)
>
> 	$ cygcheck -V
> 	cygcheck (cygwin) 1.7.25
> 	$ cd /cygdrive/c/
> 	$ groups
> 	Domain Users Users
> 	$ umask
> 	0022
> 	$ mkdir --parents cyg-level1/cyg-level2
> 	$ cat dos-level1/bar
> 	foo
> 	$ cp dos-level1/bar cyg-level1/cyg-level2/
> 	$ cat cyg-level1/cyg-level2/bar
> 	cat: cyg-level1/cyg-level2/bar: Permission denied
>
> 	$ icacls.exe cyg-level1/cyg-level2/
> 	cyg-level1/cyg-level2/ AMR\mifrank:(F)
>                         AMR\Domain Users:(RX)
>                         Everyone:(RX)
>                         BUILTIN\Administrators:(F)
>                         NT AUTHORITY\SYSTEM:(F)
>                         BUILTIN\Users:(RX)
>                         NT AUTHORITY\Authenticated Users:(M)
>                         CREATOR OWNER:(OI)(CI)(IO)(F)
>                         CREATOR GROUP:(OI)(CI)(IO)(RX)
>                         Everyone:(OI)(CI)(IO)(RX)
>
> 	Successfully processed 1 files; Failed processing 0 files
> 	$ icacls.exe cyg-level1/cyg-level2/bar
> 	cyg-level1/cyg-level2/bar AMR\mifrank:(D,Rc,WDAC,WO,RA,WA)
>                            AMR\Domain Users:(Rc,S,RA)
>                            Everyone:(Rc,S,RA)
>
> 	Successfully processed 1 files; Failed processing 0 files
>
> On the other hand:
>
> 	$ echo fromcyg > cyg-level1/cyg-level2/baz
> 	$ cat cyg-level1/cyg-level2/baz
> 	fromcyg
> 	$ icacls.exe cyg-level1/cyg-level2/baz
> 	cyg-level1/cyg-level2/baz AMR\mifrank:(R,W,D,WDAC,WO)
>                            AMR\Domain Users:(R)
>                            Everyone:(R)
>
> 	Successfully processed 1 files; Failed processing 0 files

'bar' isn't owned by mifrank, Domain Users, or Everyone in its initial 
location so the POSIX permissions for it don't include read access for
any of the POSIX attributes (-rwxrwxrwx).  Try adding read permissions
for mifrank to the file and/or directories and see if that helps.


-- 
Larry

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: cp creates unreadable file on Windows 7
  2013-10-09 21:30 cp creates unreadable file on Windows 7 Frank, Matthew I
  2013-10-09 22:27 ` Larry Hall (Cygwin)
@ 2013-10-10  3:05 ` Andrey Repin
  2013-10-10 22:13   ` Frank, Matthew I
  2013-10-10 23:04   ` Frank, Matthew I
  1 sibling, 2 replies; 5+ messages in thread
From: Andrey Repin @ 2013-10-10  3:05 UTC (permalink / raw)
  To: Frank, Matthew I, cygwin

Greetings, Frank, Matthew I!

> I believe my problem is identical to the one reported in:
> http://cygwin.com/ml/cygwin/2012-02/msg00456.html, but that message chain ended with
> "mount your file system noacl" which isn't an option for me, so I'm looking for
> other alternatives.

Please explain, how it is not an option for you?

> I create a file using cmd.exe in a directory created by cmd.exe.  Then in Cygwin bash I
> mkdir a directory (two levels deep) and cp the file into the new directory.  The resulting
> file is not readable by any Windows or Cygwin executable.  I can't say whether this is
> correct or not, but it surprised me.

> I am on a corporate network (logged in using network credentials).  The filesystem is NTFS,
> the machine is Windows 7.  I am an Administrator on the machine.  I am using the new 64-bit
> Cygwin installed in c:\users\mifrank\cygwin64, but the problem was originally reported by
> several of my users, and they are using slightly older 32-bit versions of Cygwin installed
> in c:\cygwin.

> Reproducer.  Step 1 (must be done in a cmd.exe shell.)

>         C:\>md dos-level1
>         C:\>echo foo > dos-level1\bar
>         C:\>cat dos-level1\bar
>         foo
>         C:\>icacls.exe dos-level1\
>         dos-level1\ BUILTIN\Administrators:(I)(F)
>             BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
>             NT AUTHORITY\SYSTEM:(I)(F)
>             NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
>             BUILTIN\Users:(I)(OI)(CI)(RX)
>             NT AUTHORITY\Authenticated Users:(I)(M)
>             NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

>         Successfully processed 1 files; Failed processing 0 files
>         C:\>icacls.exe dos-level1\bar
>         dos-level1\bar BUILTIN\Administrators:(I)(F)
>                NT AUTHORITY\SYSTEM:(I)(F)
>                    BUILTIN\Users:(I)(RX)
>                NT AUTHORITY\Authenticated Users:(I)(M)

>         Successfully processed 1 files; Failed processing 0 files

> Step 2 (from Cygwin bash shell)

>         $ cygcheck -V
>         cygcheck (cygwin) 1.7.25
>         $ cd /cygdrive/c/
>         $ groups
>         Domain Users Users
>         $ umask
>         0022
>         $ mkdir --parents cyg-level1/cyg-level2
>         $ cat dos-level1/bar
>         foo
>         $ cp dos-level1/bar cyg-level1/cyg-level2/
>         $ cat cyg-level1/cyg-level2/bar
>         cat: cyg-level1/cyg-level2/bar: Permission denied

>         $ icacls.exe cyg-level1/cyg-level2/
>         cyg-level1/cyg-level2/ AMR\mifrank:(F)
>                        AMR\Domain Users:(RX)
>                        Everyone:(RX)
>                        BUILTIN\Administrators:(F)
>                        NT AUTHORITY\SYSTEM:(F)
>                        BUILTIN\Users:(RX)
>                        NT AUTHORITY\Authenticated Users:(M)
>                        CREATOR OWNER:(OI)(CI)(IO)(F)
>                        CREATOR GROUP:(OI)(CI)(IO)(RX)
>                        Everyone:(OI)(CI)(IO)(RX)

>         Successfully processed 1 files; Failed processing 0 files
>         $ icacls.exe cyg-level1/cyg-level2/bar
>         cyg-level1/cyg-level2/bar AMR\mifrank:(D,Rc,WDAC,WO,RA,WA)
>                           AMR\Domain Users:(Rc,S,RA)
>                           Everyone:(Rc,S,RA)

>         Successfully processed 1 files; Failed processing 0 files

> On the other hand:

>         $ echo fromcyg > cyg-level1/cyg-level2/baz
>         $ cat cyg-level1/cyg-level2/baz
>         fromcyg
>         $ icacls.exe cyg-level1/cyg-level2/baz
>         cyg-level1/cyg-level2/baz AMR\mifrank:(R,W,D,WDAC,WO)
>                           AMR\Domain Users:(R)
>                           Everyone:(R)

>         Successfully processed 1 files; Failed processing 0 files

This sounds exactly like an issue you would run while trying to mix Cygwin ACL
and corporate environment.
TL;DR: Choose one. Either corporate-enforced ACL control, and disable Cygwin
emulation of POSIX permissions, or Cygwin ACLs and keep away from corporate
environments.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 10.10.2013, <06:44>

Sorry for my terrible english...


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: cp creates unreadable file on Windows 7
  2013-10-10  3:05 ` Andrey Repin
@ 2013-10-10 22:13   ` Frank, Matthew I
  2013-10-10 23:04   ` Frank, Matthew I
  1 sibling, 0 replies; 5+ messages in thread
From: Frank, Matthew I @ 2013-10-10 22:13 UTC (permalink / raw)
  To: cygwin

On 2013-10-09 18:27, Larry Hall (Cygwin) wrote:
>On 10/9/2013 5:30 PM, Frank, Matthew I wrote:
>> I believe my problem is identical to the one reported in:
>> http://cygwin.com/ml/cygwin/2012-02/msg00456.html, but that message chain ended with
>> "mount your file system noacl" which isn't an option for me, so I'm looking for
>> other alternatives.
>>
>> I create a file using cmd.exe in a directory created by cmd.exe.  Then in Cygwin bash I
>> mkdir a directory (two levels deep) and cp the file into the new directory.  The resulting
>> file is not readable by any Windows or Cygwin executable.  I can't say whether this is
>> correct or not, but it surprised me.
>>
>'bar' isn't owned by mifrank, Domain Users, or Everyone in its initial 
>location so the POSIX permissions for it don't include read access for
>any of the POSIX attributes (-rwxrwxrwx).  Try adding read permissions
>for mifrank to the file and/or directories and see if that helps.

'bar' is owned by amr\mifrank, but you are correct that 'bar' doesn't have
"amr\mifrank", "amr\domain users" or "Everyone" Access Control Entries.
      icacls /grant <ACE>:R dos-level1\bar
Where <ACE> is one of those three makes it so that cp produces a readable file.

But lots of things make cp produce a readable file.  For example if you repeat the
experiment starting under c:\users\<myuserid>\Documents\ instead of c:\, cp will
also produce a readable file.  Likewise if you cp into cyg-level1 instead of
cyg-level1/cyg-level2/.

It turns out that "cp --preserve=mode" does something closer to what I was expecting.
Roughly I was expecting cp to create the target file with the same ACL as
the source file, minus the umask, which is closer to the spirit of the semantics on
a non-acl filesystem ("copy the mode bits minus the umask from the source to the target"),
rather than "infer mode bits from the ACL in a very literal way and then construct an ACL
that implements the inferred mode bits."

cp --preserve=mode seems to copy the source's ACL and then also adds in the ACL produced
by inferring the mode bits.  Good enough (since the inferred mode bits are harmless.)

I'm sure that getting this right is much more complicated than it appears at first glance.
For example, while researching this reply I found:
http://michael.orlitzky.com/articles/problems_with_posix_acls_and_common_utilities.php
(And Orlitzky's blog post is about problems interacting with posix acls, which are
at least designed to be somewhat compatible with traditional unix mode bits.  Presumably
the translation from Windows ACLs is even harder.)

-Matt



--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: cp creates unreadable file on Windows 7
  2013-10-10  3:05 ` Andrey Repin
  2013-10-10 22:13   ` Frank, Matthew I
@ 2013-10-10 23:04   ` Frank, Matthew I
  1 sibling, 0 replies; 5+ messages in thread
From: Frank, Matthew I @ 2013-10-10 23:04 UTC (permalink / raw)
  To: Andrey Repin


On 2013-10-09-21:50, Andrey Repin wrote:
> Greetings, Frank, Matthew I!
> 
> > I believe my problem is identical to the one reported in:
> > http://cygwin.com/ml/cygwin/2012-02/msg00456.html, but that message
> chain ended with
> > "mount your file system noacl" which isn't an option for me, so I'm
> looking for
> > other alternatives.
> 
> Please explain, how it is not an option for you?

This problem came up in the context of a makefile which is being used by
dozens of programmers on dozens of machines, including build servers in
a machine room, and being invoked from a Windows cmd prompt, not from
Cygwin's bash shell.  I can't tell everyone to modify their /etc/fstab
or /etc/fstab.d/<username> just for my makefile.  We need to be able to
checkout the makefile and code from the repo into a standard build
environment (one with specific compilers installed, and Cygwin installed
and with Cygwin's /usr/bin on the path) and type 'make install'.

> 
[Snip...]
> 
> This sounds exactly like an issue you would run while trying to mix Cygwin
> ACL
> and corporate environment.
> TL;DR: Choose one. Either corporate-enforced ACL control, and disable
> Cygwin
> emulation of POSIX permissions, or Cygwin ACLs and keep away from
> corporate
> environments.

Even if this were true (which I don't think it is, see my discussion with
Larry Hall) it seems impolitic to say it out loud.  If we didn't need to
create at least some of our files using native Windows utilities, then
we would set up Linux machines with mingw cross compilers, not work on a
Windows machine with Cygwin.  I use Cygwin because I don't have any choice
about using Windows.

-Matt


--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-10 23:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-09 21:30 cp creates unreadable file on Windows 7 Frank, Matthew I
2013-10-09 22:27 ` Larry Hall (Cygwin)
2013-10-10  3:05 ` Andrey Repin
2013-10-10 22:13   ` Frank, Matthew I
2013-10-10 23:04   ` Frank, Matthew I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).