Re: Cygwin 3.5.1: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o': 'Operation not permitted'

2024-03-11 Thread Cedric Blancher via Cygwin
On Fri, 8 Mar 2024 at 03:25, Dan Shelton via Cygwin  wrote:
>
> Hello!
>
> I've run into a problem with clang on Cygwin 3.5.1 and 3.6. My machine
> does not have much disk space left, so I switched TMPDIR to the
> network drive. But clang then failed, like this:
>
> $ cat x.c
> #include 
> int main(int ac, char *av[]) { puts("hello world"); return 0 ; }
> $ mkdir /cygdrive/t/tmpdir
> $ TMPDIR=/cygdrive/t/tmpdir clang x.c
> error: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o':
>   'Operation not permitted'
> 1 error generated.
>
> /cygdrive/t/tmpdir/ is a clean dir.
> /usr/bin/touch /cygdrive/t/tmpdir/dummy works without problems

I can confirm the bug, but only for the clang version linked to
Cygwin. clang version of MinGW does not show that error, so this looks
like a Cygwin bug.

Ced
-- 
Cedric Blancher 
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

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


Re: Cygwin 3.5.1: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o': 'Operation not permitted'

2024-03-11 Thread Roland Mainz via Cygwin
On Mon, Mar 11, 2024 at 8:01 AM Cedric Blancher via Cygwin
 wrote:
> On Fri, 8 Mar 2024 at 03:25, Dan Shelton via Cygwin  wrote:
> > I've run into a problem with clang on Cygwin 3.5.1 and 3.6. My machine
> > does not have much disk space left, so I switched TMPDIR to the
> > network drive. But clang then failed, like this:
> >
> > $ cat x.c
> > #include 
> > int main(int ac, char *av[]) { puts("hello world"); return 0 ; }
> > $ mkdir /cygdrive/t/tmpdir
> > $ TMPDIR=/cygdrive/t/tmpdir clang x.c
> > error: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o':
> >   'Operation not permitted'
> > 1 error generated.
> >
> > /cygdrive/t/tmpdir/ is a clean dir.
> > /usr/bin/touch /cygdrive/t/tmpdir/dummy works without problems
>
> I can confirm the bug, but only for the clang version linked to
> Cygwin. clang version of MinGW does not show that error, so this looks
> like a Cygwin bug.

I can reproduce the bug on Cygwin "CYGWIN_NT-10.0-19045
3.6.0-0.73.gc2310061c66a.x86_64":
 snip 
$ cat x.c
#include 
int main(int ac, char *av[]) { puts("hello world"); return 0 ; }

$ TMPDIR=/cygdrive/t/tmpdir/ strace -o clang_tmpdir_on_nfs41fs.log
"C:\cygwin64\bin\clang-8.exe" x.c
error: unable to open output file '/cygdrive/t/tmpdir/x-8cb6f7.o':
'Operation not permitted'
1 error generated.
 snip 

Full strace log is at https://nrubsig.kpaste.net/ff6248c25 (I use the
line numbers from that site below).

It seems starting with line 2949 this goes wrong:
 snip 
  505 5069822 [main] clang-8 40295 symlink_info::check: 0x0 =
NtCreateFile (\??\T:\tmpdir\x-8cb6f7.o)
 3645 5073467 [main] clang-8 40295 symlink_info::check: not a symlink
  266 5073733 [main] clang-8 40295 symlink_info::check: 0 =
symlink.check(T:\tmpdir\x-8cb6f7.o, 0x796E0) (mount_flags 0x4020,
path_flags 0x0)
  310 5074043 [main] clang-8 40295 path_conv::check:
this->path(T:\tmpdir\x-8cb6f7.o), has_acls(1)
  305 5074348 [main] clang-8 40295 build_fh_pc: fh 0x800027A30, dev 00C3
 1441 5075789 [main] clang-8 40295 __set_errno: int
check_access(security_descriptor&, GENERIC_MAPPING&, ACCESS_MASK, int,
bool):600 setting errno 13
  257 5076046 [main] clang-8 40295 check_file_access: flags 0x2, ret -1
 snip 

So |build_fh_pc()| somehow fails with error 13... but I don't understand why...

And then there is this weird ACL:
 snip -
$ ls -l /cygdrive/t/tmpdir/x-8cb6f7.o
-rw--- 1 Unix_User+197608 Unix_Group+197121 0 Mar 11 11:00
/cygdrive/t/tmpdir/x-8cb6f7.o
$ getfacl /cygdrive/t/tmpdir/x-8cb6f7.o
# file: /cygdrive/t/tmpdir/x-8cb6f7.o
# owner: Unix_User+197608
# group: Unix_Group+197121
user::---
group::---
other::---
 snip 

/usr/bin/file, echo&&/&/usr/bin/cat can read/write that file
 snip 
$ file /cygdrive/t/tmpdir/x-8cb6f7.o
/cygdrive/t/tmpdir/x-8cb6f7.o: empty
$ echo "foo" >>/cygdrive/t/tmpdir/x-8cb6f7.o
$ cat /cygdrive/t/tmpdir/x-8cb6f7.o
foo
 snip 

I have no idea why clang fails in this case... I need help with this one...



Bye,
Roland
-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)

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


Request for a rough release timeline for Cygwin 3.5.2

2024-03-11 Thread Kate Deplaix via Cygwin
Hi,

Sorry to bother you all,

Following the fixes (thank you so much again) of the two critical issues in 
cygwin 3.5.0/3.5.1 
https://cygwin.com/pipermail/cygwin/2024-February/255561.html , we were 
wondering if cygwin 3.5.2 is likely to be released soon. We would be extremely 
grateful and happy for that.

Thank you so much again for your work,
Kate (from the opam team)

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


Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ?

2024-03-11 Thread Corinna Vinschen via Cygwin
On Mar  9 16:26, Glenn Strauss via Cygwin wrote:
> On Wed, Mar 06, 2024 at 02:01:06PM +0100, Corinna Vinschen via Cygwin wrote:
> > On Mar  5 23:38, Dan Shelton via Cygwin wrote:
> > > On Sat, 24 Feb 2024 at 14:11, Corinna Vinschen via Cygwin
> > >  wrote:
> > > >
> > > > On Feb 23 22:15, Dan Shelton via Cygwin wrote:
> > > > > HOWEVER, there is another Cygwin bug:
> > > > > "getent group mywingrp1" does not list any group members, even after
> > > > > "net localgroup mywingrp1 mywinuser44 /add", which is a POSIX
> > > > > violation.
> > > >
> > > > Not a bug.  Two problems:
> > > >
> > > > - Getting members of a group can be an extremly costly operation
> > > >   in a domain or, worse, a domain forest, or even worse, if the
> > > >   domain or domain forest is remote.
> > > >
> > > > - Alonmg the same lines, getting members of a group can be extremly
> > > >   costly in big orgs with thousands of users.  Nobody want's to clutter
> > > >   up space with the list of members in the "Domain Users" group.
> > > >
> > > > - Permissions to enumerate members of a group are restricted.
> > > >   By default only admins and group members are allow to enumerate
> > > >   members and this can be restricted further by domain admins.
> > > >
> > > > Therefore we dropped even trying to populate gr_mem, considering
> > > > that even in its original form on Unix systems, it's used only
> > > > to add supplementary groups.  To do this right on Windows is even
> > > > more costly than blindly enumerating.
> > > >
> > > > It's not a bug, it's a feature :)
> > > 
> > > Could you add an option to getent so that the full lookup can be
> > > requested via command line, pls?
> > 
> > That's not possible.  getent just calls getpwent/getgrent.
> > 
> > > Always editing /etc/nsswitch.conf
> > > forth and back is not a elegant solution, aside from race conditions
> > > with other users on a system
> > 
> > So, here we go again.
> > 
> > - What exactly are you trying to accomplish by enumerating the accounts?
> >   Maybe you won't actually need it for your task at hand.
> > 
> > - Why do you have to change nsswitch.conf "back and forth"?
> >   Just change it once and you're done.
> > 
> > 
> > Corinna
> 
> Hello
> > > Dan Shelton - Cluster Specialist Win/Lin/Bsd
> 
> > > Always editing /etc/nsswitch.conf
> > > forth and back is not a elegant solution, aside from race conditions
> > > with other users on a system
> 
> Please check the man page for getent.
> 
> man getent
> getent --help
> 
> You can use -s or --service to override the service used without
> editing nsswitch.conf.  The man page on Linux provides an example
> with a bit more details than the man page for getent under cygwin.
> https://www.man7.org/linux/man-pages/man1/getent.1.html

The -s option is just available for compatibility, but otherwise a no-op
on Cygwin.  The -i option works as upstream, -w is a Cygwin-only option.

The Cygwin getent.1 man page is a bit old, given it's taken from
upstream and just slightly adapted from glibc 2.18.90, a good 10 years
ago.  The upstream man page at the time did not document the options for
some reason.  These days it documents the options, so we could fetch
this and create a new manpage from there.


Corinna

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


Re: Switching groups with newgrp - how to get the new group with |GetTokenInformation()| ?

2024-03-11 Thread Corinna Vinschen via Cygwin
On Mar 11 02:28, Dan Shelton via Cygwin wrote:
> On Wed, 6 Mar 2024 at 14:01, Corinna Vinschen via Cygwin
>  wrote:
> > On Mar  5 23:38, Dan Shelton via Cygwin wrote:
> > > Always editing /etc/nsswitch.conf
> > > forth and back is not a elegant solution, aside from race conditions
> > > with other users on a system
> >
> > So, here we go again.
> >
> > - What exactly are you trying to accomplish by enumerating the accounts?
> >   Maybe you won't actually need it for your task at hand.
> 
> We're trying to do several things, including but not limited to:
> - Finding which local groups exist. Part of our customer software
> expects that certain groups exist. Unfortunately the group names vary
> between installations, and sometimes names are prefixed with site
> names. Trying to do all permutations with just getent passwd
> $iteration means too many combinations (>= 400). So just
> enumerating all local groups with getent group would be the way to go.

Then just change /etc/nsswitch.conf to enumerate "local" as well
and be done with it.

You can even go so far as to use the Windows enumerator, i.e.,

  $ net localgroup

and than script it to use its output as input to getent group
for only the groups you really need info for.


Corinna

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


Re: Cygwin 3.5.1: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o': 'Operation not permitted'

2024-03-11 Thread Brian Inglis via Cygwin

On 2024-03-11 04:27, Roland Mainz via Cygwin wrote:

On Mon, Mar 11, 2024 at 8:01 AM Cedric Blancher via Cygwin
 wrote:

On Fri, 8 Mar 2024 at 03:25, Dan Shelton via Cygwin  wrote:

I've run into a problem with clang on Cygwin 3.5.1 and 3.6. My machine
does not have much disk space left, so I switched TMPDIR to the
network drive. But clang then failed, like this:

$ cat x.c
#include 
int main(int ac, char *av[]) { puts("hello world"); return 0 ; }
$ mkdir /cygdrive/t/tmpdir
$ TMPDIR=/cygdrive/t/tmpdir clang x.c
error: unable to open output file '/cygdrive/t/tmpdir/x-01564d.o':
   'Operation not permitted'
1 error generated.

/cygdrive/t/tmpdir/ is a clean dir.
/usr/bin/touch /cygdrive/t/tmpdir/dummy works without problems


I can confirm the bug, but only for the clang version linked to
Cygwin. clang version of MinGW does not show that error, so this looks
like a Cygwin bug.


I can reproduce the bug on Cygwin "CYGWIN_NT-10.0-19045
3.6.0-0.73.gc2310061c66a.x86_64":
 snip 
$ cat x.c
#include 
int main(int ac, char *av[]) { puts("hello world"); return 0 ; }

$ TMPDIR=/cygdrive/t/tmpdir/ strace -o clang_tmpdir_on_nfs41fs.log
"C:\cygwin64\bin\clang-8.exe" x.c
error: unable to open output file '/cygdrive/t/tmpdir/x-8cb6f7.o':
'Operation not permitted'
1 error generated.
 snip 

Full strace log is at https://nrubsig.kpaste.net/ff6248c25 (I use the
line numbers from that site below).

It seems starting with line 2949 this goes wrong:
 snip 
   505 5069822 [main] clang-8 40295 symlink_info::check: 0x0 =
NtCreateFile (\??\T:\tmpdir\x-8cb6f7.o)
  3645 5073467 [main] clang-8 40295 symlink_info::check: not a symlink
   266 5073733 [main] clang-8 40295 symlink_info::check: 0 =
symlink.check(T:\tmpdir\x-8cb6f7.o, 0x796E0) (mount_flags 0x4020,
path_flags 0x0)
   310 5074043 [main] clang-8 40295 path_conv::check:
this->path(T:\tmpdir\x-8cb6f7.o), has_acls(1)
   305 5074348 [main] clang-8 40295 build_fh_pc: fh 0x800027A30, dev 00C3
  1441 5075789 [main] clang-8 40295 __set_errno: int
check_access(security_descriptor&, GENERIC_MAPPING&, ACCESS_MASK, int,
bool):600 setting errno 13
   257 5076046 [main] clang-8 40295 check_file_access: flags 0x2, ret -1
 snip 

So |build_fh_pc()| somehow fails with error 13... but I don't understand why...

And then there is this weird ACL:
 snip -
$ ls -l /cygdrive/t/tmpdir/x-8cb6f7.o
-rw--- 1 Unix_User+197608 Unix_Group+197121 0 Mar 11 11:00
/cygdrive/t/tmpdir/x-8cb6f7.o
$ getfacl /cygdrive/t/tmpdir/x-8cb6f7.o
# file: /cygdrive/t/tmpdir/x-8cb6f7.o
# owner: Unix_User+197608
# group: Unix_Group+197121
user::---
group::---
other::---
 snip 

/usr/bin/file, echo&&/&/usr/bin/cat can read/write that file
 snip 
$ file /cygdrive/t/tmpdir/x-8cb6f7.o
/cygdrive/t/tmpdir/x-8cb6f7.o: empty
$ echo "foo" >>/cygdrive/t/tmpdir/x-8cb6f7.o
$ cat /cygdrive/t/tmpdir/x-8cb6f7.o
foo
 snip 

I have no idea why clang fails in this case... I need help with this one...


For normal temp space behaviour under Cygwin, I found you have to:

chmod   -c a+rwxt  /cygdrive/t/tmpdir/
setfacl -m u::rwx,g::rwx,o::rwx,d:u::rwx,d:g::rwx,d:o::rwx /cygdrive/t/tmpdir/

to set the DACLs to rwx and avoid any problems.

--
Take care. Thanks, Brian Inglis  Calgary, Alberta, Canada

La perfection est atteinte   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry


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


Re: ls/stat on OneDrive causes download of files

2024-03-11 Thread Corinna Vinschen via Cygwin
On Mar  9 15:29, Marcin Wisnicki via Cygwin wrote:
> I did more testing and found out that the problem does not happen in
> cygwin by default because cygwin mounts with acl which doesn't do
> header sniffing while msys uses noacl.
> 
> Testing on an mp4 file in OneDrive, when I use noacl in cygwin it
> triggers the read as well.
> After upgrading to the test version the read is gone and an mp4 file
> is not executable.
> 
> Thank you!

Thanks a lot for testing.  I backported the changes (minus the lsattr(1)/
chattr(1) changes) to the 3.5 branch so it will be in released with
3.5.2 in the next few weeks.


Corinna

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


Re: Request for a rough release timeline for Cygwin 3.5.2

2024-03-11 Thread Corinna Vinschen via Cygwin
On Mar 11 11:48, Kate Deplaix via Cygwin wrote:
> Hi,
> 
> Sorry to bother you all,
> 
> Following the fixes (thank you so much again) of the two critical
> issues in cygwin 3.5.0/3.5.1
> https://cygwin.com/pipermail/cygwin/2024-February/255561.html , we
> were wondering if cygwin 3.5.2 is likely to be released soon. We would
> be extremely grateful and happy for that.

Probably still this month.


Corinna

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