Re: Installing Cygwin as normal user in nonstandard location?

2024-05-27 Thread Martin Wege via Cygwin
On Sun, May 26, 2024 at 7:35 PM Andrey Repin  wrote:
>
> Greetings, Martin Wege!
>
> >> Can Cygwin be installed as a normal user (without Admin rights) in a
> >> > nonstandard location, like C.\Users\martinwege\cygwinroot36\...)?
> >> >
> >> > Also, can this be done for more than one Cygwin version, e.g. I'd like
> >> > to test multiple Cygwin versions in parallel.
> >> >
> >>
> >> (?) Why ask when you can just try both scenarios pretty easily?
>
> > Simple example for possible issues (might be more):
> > Cygwin seems to modify the global REGISTRY with a "Install for
> > everyone" (as Admin). What will happen then?
>
> Why would you try to "install for everyone" if you don't have an admin rights?
>
> > Can Cygwin installations installed as non-admin interact via Windows
> > REGISTRY, or other unexpected ways?
>
> That's pretty strange question.

Why?

>
> > So testing by a non-expert like me might not uncover
> > such things immediately, so I better ask the experts here
>
> What do you ACTUALLY want to do?

We want to install multiple Cygwin installations, so we can do
(automated) regression testing. Also, the machines in question might
already have one admin-installed&approved Cygwin installation for all
users, which should not interact with any of the per-user
installations used for testing.

Thanks,
Martin

-- 
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: Installing Cygwin as normal user in nonstandard location?

2024-05-26 Thread Martin Wege via Cygwin
On Sun, May 26, 2024 at 2:14 AM Bill Stewart via Cygwin
 wrote:
>
> On Sat, May 25, 2024 at 3:54 PM Martin Wege wrote:
>
> Can Cygwin be installed as a normal user (without Admin rights) in a
> > nonstandard location, like C.\Users\martinwege\cygwinroot36\...)?
> >
> > Also, can this be done for more than one Cygwin version, e.g. I'd like
> > to test multiple Cygwin versions in parallel.
> >
>
> (?) Why ask when you can just try both scenarios pretty easily?

Simple example for possible issues (might be more):
Cygwin seems to modify the global REGISTRY with a "Install for
everyone" (as Admin). What will happen then? Can Cygwin installations
installed as non-admin interact via Windows REGISTRY, or other
unexpected ways? So testing by a non-expert like me might not uncover
such things immediately, so I better ask the experts here

@Corinna Vinschen ?

Thanks,
Martin

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


LD_PRELOAD for Win32?

2024-05-25 Thread Martin Wege via Cygwin
Hello,

Does Cygwin or Win32 have something like LD_PRELOAD, so I can
override/substitute functions in a DLL or EXE, like it is common for
UNIX/Linux ELF shared libraries?

Thanks,
Martin

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


Installing Cygwin as normal user in nonstandard location?

2024-05-25 Thread Martin Wege via Cygwin
Hello,

Can Cygwin be installed as a normal user (without Admin rights) in a
nonstandard location, like C.\Users\martinwege\cygwinroot36\...)?

Also, can this be done for more than one Cygwin version, e.g. I'd like
to test multiple Cygwin versions in parallel.

Thanks,
Martin

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


Win32 FILE_BASIC_INFORMATION.*Time.QuadPart - which value should be used if filesystem does not support it, so Cygwin /usr/bin/stat lists the value as '-'?

2024-04-04 Thread Martin Wege via Cygwin
On Fri, Apr 5, 2024 at 2:05 AM Martin Wege  wrote:
>
> Hello,
>
> I have problems with debugging, so a quick help would be appreciated,
> as I cannot figure this out after several hours of digging.
>
> Cygwin /usr/bin/stat returns "Birth: -" for some files. Which value
> must the CreationTime member of FILE_BASIC_INFORMATION have to cause
> /usr/bin/stat ti return "-"? 0, -1, or something else?

In a related matter:
The Win32 FILE_BASIC_INFORMATION structure defines four time values:

LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;

How can a filesystem indicate if it does not support a particular
timestamp, such as ChangeTime? Should ChangeTime.QuadPart then be -1,
-2 or 0, or another value?

Thanks,
Martin

-- 
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 /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?

2024-04-04 Thread Martin Wege via Cygwin
On Fri, Apr 5, 2024 at 2:55 AM Brian Inglis via Cygwin
 wrote:
>
> On 2024-04-04 18:05, Martin Wege via Cygwin wrote:
> > I have problems with debugging, so a quick help would be appreciated,
> > as I cannot figure this out after several hours of digging.
> >
> > Cygwin /usr/bin/stat returns "Birth: -" for some files. Which value
> > must the CreationTime member of FILE_BASIC_INFORMATION have to cause
> > /usr/bin/stat ti return "-"? 0, -1, or something else?
>
> https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/stat.c#n1618
>
> => tv_nsec < 0
>
> https://cygwin.com/git?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler/disk_file.cc#l414
>
> https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/times.cc#l283

Thank you

But how can tv_nsec become negative (tv_nsec < 0)? That can only
happen if BasicInformation.CreationTime.QuadPart is negative, right?

Thanks,
Martin

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


Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?

2024-04-04 Thread Martin Wege via Cygwin
Hello,

I have problems with debugging, so a quick help would be appreciated,
as I cannot figure this out after several hours of digging.

Cygwin /usr/bin/stat returns "Birth: -" for some files. Which value
must the CreationTime member of FILE_BASIC_INFORMATION have to cause
/usr/bin/stat ti return "-"? 0, -1, or something else?

Thanks,
Martin

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


Implementing /bin/ionice, ioprio_set() support with FILE_IO_PRIORITY_HINT_INFO?

2024-04-02 Thread Martin Wege via Cygwin
Hello,

could Cygwin implement support for /usr/bin/ionice and ioprio_set()
via FILE_IO_PRIORITY_HINT_INFO?

So basically implement ioprio_set() to store the value per process,
and for each file open() call this:

FILE_IO_PRIORITY_HINT_INFO priorityHint={0};
priorityHint.PriorityHint = ioniceprio2WinIoPriorityHint(ioniceprio);
result = SetFileInformationByHandle( hFile,
 FileIoPriorityHintInfo,
 &priorityHint,
 sizeof(PriorityHint));

NTFS and ReFS support FILE_IO_PRIORITY_HINT_INFO

Thanks,
Martin

-- 
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&Win32 file prefetch, block sizes?

2024-04-02 Thread Martin Wege via Cygwin
On Tue, Apr 2, 2024 at 3:17 PM Corinna Vinschen via Cygwin
 wrote:
>
> On Apr  2 02:04, Martin Wege via Cygwin wrote:
> > Hello,
> >
> > Is there any document which describes how Cygwin and Win32 file
> > prefetch and readahead work, and which sizes are used (e.g. always
> > read one full page even if only 16 bytes are requested?)?
>
> I'm not aware of any docs, but again, keep in mind that Cygwin is a
> usersapce DLL. We basically do what Windows does for low-level file
> access.
>
> > Quick /usr/bin/stat /etc/profile returns "IO Block: 65536". Does that
> > mean the file's block size is really 64k? Is this info per filesystem,
> > or hardcoded in Cygwin?
>
> Hardcoded in Cygwin since 2017, based on a discussion in terms of
> file access performance, especially when using stdio.h functions:
>
>   https://cygwin.com/cgit/newlib-cygwin/commit/?id=7bef7db5ccd9c

OUCH.

While I can understand the motivation, FAT32 on multi-GB-devices
having 64k block size, and Win32 API on Win95/98/ME/Win7 being
optimized to that insane block size, it is absolutely WRONG with
today's NTFS and even more so with ReFS. This only works if you stream
files, but as soon as you are doing random read/writes the performance
is terrible due to cache thrashing. That could explain the many
complaints about Cygwin's IO performance.

So, what can be done? I'm not a benchmarking guru, so I'd like to
propose to add a tunable called EXPERIMENTAL_PREFERRED_IO_BLKSIZE to
the CYGWIN env variable (marked as "experimental"), so the
benchmarking guys can do performance testing without recompiling
everything, get perf results for Cygwin 3.6, and decide what to do for
Cygwin 3.7.

Thanks,
Martin

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


Cygwin&Win32 file prefetch, block sizes?

2024-04-01 Thread Martin Wege via Cygwin
Hello,

Is there any document which describes how Cygwin and Win32 file
prefetch and readahead work, and which sizes are used (e.g. always
read one full page even if only 16 bytes are requested?)?

Quick /usr/bin/stat /etc/profile returns "IO Block: 65536". Does that
mean the file's block size is really 64k? Is this info per filesystem,
or hardcoded in Cygwin?

Thanks,
Martin

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


UNIX nobody/nogroup mapping to which Windows SID/account?

2024-03-03 Thread Martin Wege via Cygwin
Hello,

How can we map UNIX "nobody"/"nogroup" to Win32 SIDs/accounts? Cygwin
has entries for "nobody" in /etc/passwd and "nogroup" in /etc/group,
but these accounts have SIDs returned by /usr/bin/getent passwd and
/usr/bin/getent group which LookupAccountSidA() does not recognise.

So what is the correct Win32 solution?

Thanks,
Martin

-- 
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: openat(O_DIRECT) supported in Cygwin?

2024-03-03 Thread Martin Wege via Cygwin
On Wed, Feb 28, 2024 at 10:08 AM Corinna Vinschen via Cygwin
 wrote:
>
> On Feb 27 17:46, Martin Wege via Cygwin wrote:
> > Hello,
> >
> > Does Cygwin support openat(O_DIRECT)? Which effect does O_DIRECT in
> > Cygwin have, and which underlying Windows API is used?
>
> https://cygwin.com/cgit/newlib-cygwin/tree/winsup/cygwin/fhandler/base.cc#n587

So O_DIRECT will be translated to Win32 FILE_NO_INTERMEDIATE_BUFFERING?

Thanks,
Martin

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


openat(O_DIRECT) supported in Cygwin?

2024-02-27 Thread Martin Wege via Cygwin
Hello,

Does Cygwin support openat(O_DIRECT)? Which effect does O_DIRECT in
Cygwin have, and which underlying Windows API is used?

Thanks,
Martin

-- 
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 sqlite locking debug options still available?

2024-02-17 Thread Martin Wege via Cygwin
On Tue, Feb 6, 2024 at 12:31 PM Martin Wege  wrote:
>
> Hello!
>
> Is the debug mode for sqlite locking mode as described in
> https://cygwin.cygwin.narkive.com/nkjMGQga/test-sqlite3-3-7-17-1-1-7-19-locking-feature
> soehow still available?
>
> We sometimes get sqlite locking errors, and like to investigate what
> and why this fails

Corinna?

Thanks,
Martin

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


Cygwin sqlite locking debug options still available?

2024-02-06 Thread Martin Wege via Cygwin
Hello!

Is the debug mode for sqlite locking mode as described in
https://cygwin.cygwin.narkive.com/nkjMGQga/test-sqlite3-3-7-17-1-1-7-19-locking-feature
soehow still available?

We sometimes get sqlite locking errors, and like to investigate what
and why this fails

Thanks,
Martin

-- 
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 tools to read/write NTFS alternate data streams?

2024-01-11 Thread Martin Wege via Cygwin
On Mon, Jan 8, 2024 at 3:11 PM Corinna Vinschen via Cygwin
 wrote:
>
> On Dec 18 18:47, Martin Wege via Cygwin wrote:
> > On Fri, Dec 1, 2023 at 10:52 AM Corinna Vinschen via Cygwin
> >  wrote:
> > >
> > > On Nov 30 04:55, Martin Wege via Cygwin wrote:
> > > > Hello,
> > > >
> > > > Does Cygwin have tools (modified /usr/bin/dd ?) to read/write NTFS
> > > > alternate data streams?
> > >
> > > No.  As you know, the colon is translated to a normal filename
> > > character, and there's no POSIX-like API to expose ADS raw to user
> > > space.
> > >
> > > There is, however, an old function we still expose to user space
> > > for backward compat:
> > >
> > >   #include 
> > >
> > >   int cygwin_attach_handle_to_fd (char *name,
> > >   int fd,
> > >   HANDLE handle,
> > >   mode_t bin,
> > >   DWORD myaccess);
> > >
> > > This allows to sneak in a HANDLE into a Cygwin file descriptor
> > > representation, kind of like this:
> > >
> > >   HANDLE h;
> > >   int fd;
> > >
> > >   h = CreateFile ("foo:bar", GENERIC_READ, FILE_SHARE_VALID_FLAGS,
> > >   NULL, OPEN_EXISTING, 0, NULL);
> > >   if (h != INVALID_HANDLE_VALUE)
> > > {
> > >   fd = cygwin_attach_handle_to_fd ("foo", -1, h, 0, GENERIC_READ);
> > >   if (fd < 0)
> > > bail_out;
> > > }
> > >
> > > For the bin parameter, only 0, O_BINARY or O_TEXT are acceptable,
> > > for myaccess, only GENERIC_READ and/or GENERIC_WRITE are acceptable.
> >
> > Could this be abstracted into O_XATTR support, i.e. openat() file with
> > O_XATTR, and then have access to the alternate data streams in a
> > (virtual) subdir?
>
> I'm not too hot on adding more open(2) flags, the reason being,
> that we have room left for only 7 more flags in the 32 bit mode.
> Nobody knows what comes along officially in future.

Right, but Solaris, Illumos, and Opengroup draft already have O_XATTR,
so this is IMO OK.

Also, it would provide a good abstraction for alternate data stream
support, which is compatible with Windows, OSX, Solaris, Illumos, and
NTFS, ZFS, SMB, NFSv4.

>
> Apart from that, this sounds like a nice idea for Cygwin 3.6,
> provided somebody implements it, https://cygwin.com/acronyms/#SHTDI
>
> Assuming we can live without actually having a subdir and just
> allowing to open and create a file with the O_XATTR flag, it might be
> pretty simple to implement.  The path handling code would just have to
> drop the colon from the list of characters converted to the private-use
> Unicode area.
>
> Implementing the subdir is a bit more complicated, especially when
> taking opendir/readdir of that virtual subdir into account, but it
> would certainly be doable.

How do other OSes implement the O_XATTR subdir?

Thanks,
Martin

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


cygwin@cygwin.com

2023-12-21 Thread Martin Wege via Cygwin
On Wed, Dec 20, 2023 at 6:21 PM Kaz Kylheku via Cygwin
 wrote:
>
> On 2023-12-17 22:22, Dan Shelton via Cygwin wrote:
> > It would be nice if someone from the Cygwin authors could assist me in
> > figuring out why this happens.
>
> Cygwin is famously slow; this is nothing new. We are grateful
> for Cygwin because it makes stuff work at all; if it were blazing
> fast that would be a bonus.
>
> E.g. git operations (clone, rebase, ...); ./configure scripts; ...: all
> run like molasses.
>
> The following is just my fast and loose opinion, shot from the hip,
> and possibly off or wrong, but it likely has to do with the layering.
> Cygwin's core API is based on a C library called Newlib. Cygwin bolts
> Newlib to Windows by means of an additional shim below Newlib that
> is based on C++ objects, where there is path munging going on and such,
> and that's where the Win32 calls get made. It's an additional abstraction.

I disagree with that. Ok, part of that is that the layering causes
more memory allocations and copies, but this is not the root cause.

The root cause is IMO the extra Win32 syscalls (>= 3 per file lookup,
compared to 1 on Linux) to lookup the *.lnk and *.exe.lnk files on
filesystems which have native link support (NTFS, ReFS, SMBFS, NFS).
On SMBFS and NFS it hurts the most, because access latency is the
highest for networked filesystems.

So my proposal would be to add an option ('fslinktypes') to the CYGWIN
environment variable to define which types of links are supported:
default 'all'. which is an shortcut for 'native,lnk,lnkexe'.
So in case people do not want 'lnk' link support they just add
CYGWIN+=' fslinktypes:native' to env, to turn off support for
lnk/lnk.exe style links, and be happy.

@Corinna Vinschen Would that be acceptable?

Thanks,
Martin

-- 
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 tools to read/write NTFS alternate data streams?

2023-12-18 Thread Martin Wege via Cygwin
On Fri, Dec 1, 2023 at 10:52 AM Corinna Vinschen via Cygwin
 wrote:
>
> On Nov 30 04:55, Martin Wege via Cygwin wrote:
> > Hello,
> >
> > Does Cygwin have tools (modified /usr/bin/dd ?) to read/write NTFS
> > alternate data streams?
>
> No.  As you know, the colon is translated to a normal filename
> character, and there's no POSIX-like API to expose ADS raw to user
> space.
>
> There is, however, an old function we still expose to user space
> for backward compat:
>
>   #include 
>
>   int cygwin_attach_handle_to_fd (char *name,
>   int fd,
>   HANDLE handle,
>   mode_t bin,
>   DWORD myaccess);
>
> This allows to sneak in a HANDLE into a Cygwin file descriptor
> representation, kind of like this:
>
>   HANDLE h;
>   int fd;
>
>   h = CreateFile ("foo:bar", GENERIC_READ, FILE_SHARE_VALID_FLAGS,
>   NULL, OPEN_EXISTING, 0, NULL);
>   if (h != INVALID_HANDLE_VALUE)
> {
>   fd = cygwin_attach_handle_to_fd ("foo", -1, h, 0, GENERIC_READ);
>   if (fd < 0)
> bail_out;
> }
>
> For the bin parameter, only 0, O_BINARY or O_TEXT are acceptable,
> for myaccess, only GENERIC_READ and/or GENERIC_WRITE are acceptable.

Could this be abstracted into O_XATTR support, i.e. openat() file with
O_XATTR, and then have access to the alternate data streams in a
(virtual) subdir?

Thanks,
Martin

-- 
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 UNC path conversion functions?

2023-12-18 Thread Martin Wege via Cygwin
On Fri, Dec 1, 2023 at 10:15 AM Corinna Vinschen via Cygwin
 wrote:
>
> On Nov 30 04:44, Martin Wege via Cygwin wrote:
> > Hello,
> >
> > does Cygwin have UNC path conversion functions, for example UNC path
> > to DOS mount letter, UNC path to file URL?
>
> Neither Cygwin nor Windows really care for that when using paths.
> Either you use a drive letter or you use an UNC path, and either it
> exists or not.  Everything else is done in the mount manager or kernel.
>
> If you want to look for drive letter to UNC path conversion, you can
> utilise QueryDosDevice.

Does Cygwin have a command line tool for that?

Thanks,
Martin

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


Cygwin mount limited to 64 mounts, even for UNC paths?

2023-11-29 Thread Martin Wege via Cygwin
Hello,

Cygwin mount(1) is (per docs) limited to 64 mounts. Why was that
limitation chosen, and does it  apply even if I create bind mounts to
UNC paths (not DOS letters)? DOS letters might be restricted by the
ASCII A-Z, but UNC paths are unlimited.

Thanks,
Martin

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


cmd.exe clone with UNC support?

2023-11-29 Thread Martin Wege via Cygwin
Hello,

Is there a cmd.exe clone for Windows which supports UNC paths? Can
that be shipped with Cygwin?

Thanks,
Martin

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


Cygwin tools to read/write NTFS alternate data streams?

2023-11-29 Thread Martin Wege via Cygwin
Hello,

Does Cygwin have tools (modified /usr/bin/dd ?) to read/write NTFS
alternate data streams?

Thanks,
Martin

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


"Lazy" bind mounts?

2023-11-29 Thread Martin Wege via Cygwin
Hello,

if I do a mount -o bind //foo/bar/baz /mnt the UNC path //foo/bar/baz
is evaluated immediately, i.e. the network share //foo/bar/baz is
"mounted" immediately.

Is it possible to mount //foo/bar/baz only the first time someone does
a cd /mnt, sort of automounter-style "lazy" mount-on-demand?

Thanks,
Martin

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


Cygwin UNC path conversion functions?

2023-11-29 Thread Martin Wege via Cygwin
Hello,

does Cygwin have UNC path conversion functions, for example UNC path
to DOS mount letter, UNC path to file URL?

Thanks,
Martin

-- 
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 tool to differ junctions from soft links?

2023-11-15 Thread Martin Wege via Cygwin
?

On Wed, Nov 1, 2023 at 10:14 AM Martin Wege  wrote:
>
> Good morning!
>
> Does Cygwin have a command line tool (Scriptable!) which can be used
> to differ between soft links and Windows junctions?
>
> Thanks,
> Martin

-- 
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: Please support download setup-x86_64.exe on IPv6-only network

2023-11-15 Thread Martin Wege via Cygwin
On Thu, Nov 16, 2023 at 2:40 AM Bin W via Cygwin  wrote:
>
> https://www.cygwin.com/setup-x86_64.exe
> IPv6-only network can't download the installer.

Details please. Does
https://www.cygwin.com/setup-x86_64.exe
not work on an IPv6-only network?

Or can setup-x86_64.exe not download data on an IPv6 network?

Thanks,
Martin

-- 
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: setup-x86_64.exe (bug ?): Cannot write to /usr/bin/cygwin1.dll - cyserver squatting it...

2023-11-15 Thread Martin Wege via Cygwin
On Wed, Nov 15, 2023 at 6:05 PM Andrey Repin via Cygwin
 wrote:
>
> Greetings, Mainz, Roland!
>
>
> > Hi!
>
> > 
>
> > The Cygwin installer "setup-x86_64.exe" has problems updating cygwin1.dll 
> > when cygserver is running:
>
> You should stop ALL Cygwin processes before starting setup.exe.
> This is documented.

This is not helpful. Cygwin setup-x86-64.exe not being able to update,
because SOMETHING is locking cygwin1.dll is in the top 50 of your IT
support, right followed by the question of IT support whether
"updating to WSL" will solve the situation for them permanently.

>
> >  snip 
> > Unable to extract /usr/bin/cygwin1.dll -- error writing file
> >  snip 
>
> > The fix is to do a $ sc stop cygserver # as Administrator, then
> > "setup-x86_64.exe" can write to that file, and after "setup" is done do a $ 
> > sc start cygserverr # as Admin again.
>
> > ... is it possible to modify "setup-x86_64.exe" to stop cygserver before
> > doing the installation process and re-start it after it ?
>
> There's no reason to do so, as there's no easy way to detect beforehand, if
> you actually need to do so.

sc query cygserver is EASY to detect.

IMO Cygwin needs a serious effort towards
user-friendliness-by-default. Right now Cygwin is a specialist
environment which requires half an university degree to get it
working, and that makes me unhappy because your work is GREAT

>
> You could have cygserver running from one Cygwin setup but installing to the
> different one. And so on.

Seriously, who has TWO Cygwin setups on one machine? Also, sc query
can handle those cases too.

Thanks,
Martin

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


Cygwin filesystem test suite?

2023-11-09 Thread Martin Wege via Cygwin
Hello,

Does Cygwin 3.5 come with a Cygwin filesystem test suite, which uses
Cygwin or the native Win32 api to check whether file access is
working?

Thanks,
Martin

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

2023-11-09 Thread Martin Wege via Cygwin
On Sun, Oct 22, 2023 at 3:20 PM Jonathan Chapman-Moore via Cygwin
 wrote:
>
> Hi,
>
> I was considering the people at Cygwin rebrand Cygwin to Services for UNIX.

SFU might be a M$ trademark.

But what about "Services for POSIX" - "SFP"?

Thanks,
Martin

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


Cygwin tool to differ junctions from soft links?

2023-11-01 Thread Martin Wege via Cygwin
Good morning!

Does Cygwin have a command line tool (Scriptable!) which can be used
to differ between soft links and Windows junctions?

Thanks,
Martin

-- 
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.0 KDE kate crashes in |cygdbus-1-3!_dbus_get_local_machine_uuid_encoded ()| ...

2023-11-01 Thread Martin Wege via Cygwin
On Tue, Oct 17, 2023 at 5:30 AM Takashi Yano via Cygwin
 wrote:
>
> On Mon, 16 Oct 2023 20:27:09 -0600
> Brian Inglis wrote:
> > On 2023-10-16 15:31, Roland Mainz via Cygwin wrote:
> > > Steps to reproduce:
> > > 1. Boot Windows 10
> > > 2. Log in
> > > 3. Open Cygwin terminal
> > > 4. Run "kate"
> > > Result:
> > > kate crashes
> > > Expected result:
> > > kate runs
> > >  snip 
> > > $ uname -a
> > > CYGWIN_NT-10.0-19045 DERFWNB8353 3.5.0-0.438.g322c7150b25e.x86_64
> > > 2023-09-17 14:19 UTC x86_64 Cygwin
> > > $ gdb --args kate
> > > GNU gdb (GDB) (Cygwin 12.1-1) 12.1
> > > Copyright (C) 2022 Free Software Foundation, Inc.
> > > [snip]
> > > (gdb) run
> > > Starting program: /usr/bin/kate
> > > [New Thread 9784.0x29ac]
> > > [New Thread 9784.0x32c8]
> > > [New Thread 9784.0x4288]
> > > [New Thread 9784.0x4fa4]
> > > [New Thread 9784.0x4e18]
> > > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to
> > > '/tmp/runtime-roland.mainz'
> > > [New Thread 9784.0x4350]
> > > [New Thread 9784.0x4a0]
> > > [New Thread 9784.0x159c]
> > > [New Thread 9784.0x19d8]
> > > [New Thread 9784.0x15f8]
> > > [New Thread 9784.0x24fc]
> > > process 170: D-Bus library appears to be incorrectly set up; failed to
> > > read machine uuid: Failed to open "/etc/machine-id": No such file or
> > > directory
> > > See the manual page for dbus-uuidgen to correct this issue.
> > >D-Bus not compiled with backtrace support so unable to print a 
> > > backtrace
> >
> > Don't you need XWin and dbus running and env vars set, the following files, 
> > get
> > a clean OK from cygcheck, or be able to rerun the postinstall script:
> >
> > $ ls -lgo /etc/machine-id /var/lib/dbus/machine-id 
> > /etc/postinstall/dbus.sh.done
> > lrwxrwxrwx  1 26 May 14  2013 /etc/machine-id -> ../var/lib/dbus/machine-id*
> > -rwxr-xr-x+ 1 33 May 14  2013 /var/lib/dbus/machine-id*
> > -rw-r--r--  1 54 Aug  9  2017 /etc/postinstall/dbus.sh.done
> > $ head /etc/postinstall/dbus.sh.done
> > mkdir -p /var/lib/dbus
> > /usr/bin/dbus-uuidgen --ensure
>
> I think dbus postinstall script does not make symbolic link
> /etc/machine-id -> ../var/lib/dbus/machine-id
> does it?

Not in my case.

Thanks,
Martin

-- 
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.0 KDE kate crashes in |cygdbus-1-3!_dbus_get_local_machine_uuid_encoded ()| ...

2023-10-17 Thread Martin Wege via Cygwin
On Tue, Oct 17, 2023 at 2:29 AM Takashi Yano via Cygwin
 wrote:
>
> On Mon, 16 Oct 2023 23:31:40 +0200
> Roland Mainz wrote:
> > Steps to reproduce:
> > 1. Boot Windows 10
> > 2. Log in
> > 3. Open Cygwin terminal
> > 4. Run "kate"
> >
> > Result:
> > kate crashes
> >
> > Expected result:
> > kate runs
> >
> >  snip 
> > $ uname -a
> > CYGWIN_NT-10.0-19045 DERFWNB8353 3.5.0-0.438.g322c7150b25e.x86_64
> > 2023-09-17 14:19 UTC x86_64 Cygwin
> > $ gdb --args kate
> > GNU gdb (GDB) (Cygwin 12.1-1) 12.1
> > Copyright (C) 2022 Free Software Foundation, Inc.
> > [snip]
> > (gdb) run
> > Starting program: /usr/bin/kate
> > [New Thread 9784.0x29ac]
> > [New Thread 9784.0x32c8]
> > [New Thread 9784.0x4288]
> > [New Thread 9784.0x4fa4]
> > [New Thread 9784.0x4e18]
> > QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to
> > '/tmp/runtime-roland.mainz'
> > [New Thread 9784.0x4350]
> > [New Thread 9784.0x4a0]
> > [New Thread 9784.0x159c]
> > [New Thread 9784.0x19d8]
> > [New Thread 9784.0x15f8]
> > [New Thread 9784.0x24fc]
> > process 170: D-Bus library appears to be incorrectly set up; failed to
> > read machine uuid: Failed to open "/etc/machine-id": No such file or
> > directory
> > See the manual page for dbus-uuidgen to correct this issue.

Basically all KDE apps crash like that in Cygwin 3.5

>
> Does not
> dbus-uuidgen --ensure=/etc/machine-id
> help?

I tried the steps-to-reproduce, and I get the same problem.
I tried to run kate with dbus-run-session kate, but while kate the
runs, dialogs like Open... need a MINUTE to open, and similar delays
happen when I browse inthe filesystem using that dialog.

Thanks,
Martin

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


Setuid exe (chmod u+s,g+s foo.exe) not working with Cygwin...

2023-09-24 Thread Martin Wege via Cygwin
Hello,

I tried to setuid an executable, so that it runs as user "SYSTEM", but
it does not work.

I tried this as an user with administrator rights:
chown SYSTEM:SYSTEM foo.exe
chmod u+s,g+s foo.exe

But running ./foo then just runs it as the current user.

What am I doing wrong?

Thanks,
Martin

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


Cygwin, converting PSID to string?

2023-09-24 Thread Martin Wege via Cygwin
Hello,

Does Cygwin have a function to convert a PSID (pointer to sid) to a
human readable string? Is there a function to do the opposite, turn a
string from the first function back into a SID type?

Thanks,
Martin

-- 
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: Running bash script as SYSTEM from account with admin rights?

2023-09-22 Thread Martin Wege via Cygwin
On Fri, Sep 22, 2023 at 9:42 AM Christian Franke via Cygwin
 wrote:
>
> Martin Wege via Cygwin wrote:
> > Hello,
> >
> > Does Cygwin have a tool to run a bash script as SYSTEM user if my
> > account already have admin rights?
>
> No (AFAIK).
>
> I use psexec from Sysinternals tools
> (https://learn.microsoft.com/sysinternals/downloads/psexec)
>
> This starts a Cygwin terminal as SYSTEM user:
>
> psexec -s -i c:\cygwin\bin\mintty -

Use of psexec is forbidden, as it triggers our security software (Cortex XDR).

Windows has 
https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-impersonateloggedonuser
Can we use that to write a C wrapper program, to switch from current
user with admin rights to the SYSTEM account, execute command and then
exit(0) the wrapper?

Thanks,
Martin

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


Shell API to get Windows SID from Cygwin name?

2023-09-21 Thread Martin Wege via Cygwin
Hello,

Does Cygwin have a shell (e.g. bash) API to lookup the Windows SID for
a given Cygwin user or group name?

/usr/bin/getent usersid thisisausername

does not work

Thanks,
Martin

-- 
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: std::runtime_error on std::locale("")

2023-09-21 Thread Martin Wege via Cygwin
On Thu, Sep 21, 2023 at 9:07 PM Christian Franke via Cygwin
 wrote:
>
> Brian Inglis via Cygwin wrote:
> > On 2023-09-21 10:28, Takashi Yano via Cygwin wrote:
> >> On Fri, 22 Sep 2023 01:12:04 +0900
> >> Takashi Yano wrote:
> >>> I wonder why the following code throws std::runtime_error
> >>> even though the LC_ALL is set to valid locale other than "C".
> >>> This does not occur only when LC_ALL is set to "C".
> >>>
> >>> #include 
> >>> int main()
> >>> {
> >>> std::locale("");
> >>> return 0;
> >>> }
> >>>
> >>> In linux, this occurs only when the LC_ALL is set to invalid
> >>> locale (i.e. locale that is not registered in system).
> >>
> >> Similarly,
> >> std::locale("ja_JP.UTF-8")
> >> throws std::runtime_error in cygwin.
> >
> > Looks like the implementation does not like any default "" or explicit
> > "en_US.UTF-8" strings there! See example at link and below; results
> > are always the same:
> >
> > https://en.cppreference.com/w/cpp/locale/locale
> >
> > #include 
> > #include 
> >
> > int main()
> > {
> > std::wcout << "User-preferred locale setting is "
> ><< std::locale().name().c_str() << '\n';
> >
> > // on startup, the global locale is the "C" locale
> > std::wcout << 1000.01 << '\n';
> >
> > // replace the C++ global locale and the "C" locale with the
> > user-preferred locale
> > std::locale::global(std::locale(""));
> > // use the new global locale for future wide character output
> > std::wcout.imbue(std::locale());
> >
> > // output the same number again
> > std::wcout << 1000.01 << '\n';
> > }
> >
> > $ g++ -o c++locale{,.cc}
> > $ ./c++locale
> > User-preferred locale setting is C
> > 1000.01
> > terminate called after throwing an instance of 'std::runtime_error'
> >   what():  locale::facet::_S_create_c_locale name not valid
> > Aborted (core dumped)
> >
>
> According to libstdc++ source, the internal function
> locale::facet::_S_create_c_locale() calls some __newlocale() which
> apparently does not arrive at newlocale() from cygwin1.dll. But
> cygstdc++-6.dll imports newlocale() from cygwin1.dll.

So this is a BUG?

>
> Only standard locale "C" and its alias "POSIX" work with C++ std::locale().
>
> The cygwin1.dll function newlocale() works as expected - except that it
> does not set errno if the locale name is invalid.

What does
bash -c 'locale -a'
print on your system?

Thanks,
Martin

-- 
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: Question on statically linking with cygwin

2023-09-21 Thread Martin Wege via Cygwin
On Tue, Sep 19, 2023 at 5:24 PM Johannes Thoma via Cygwin
 wrote:
>
> Hi,
>
> As I understood the reason for not being able to statically link
> the cygwin1.dll in to a binary and distribute that is because of
> licensing issues.

Do you have any references for that?

> Are there any technical issues that would make
> it impossible to link with cygwin statically?
>
> The reason I am asking is I am working on a GPL project
> (WinDRBD: https://github.com/LINBIT/windrbd) and am currently
> delivering the cygwin1.dll along with the binary. It would be
> desireable to have the cygwin1.dll statically linked (for example
> to avoid version clashes) instead. Is that technically possible?
> If necessary I am ready to compile cygwin (at least the needed
> files) on my own.

Interesting.
But how (from a developers perspective) do you link cygwin1.dll
statically into a binary?

Thanks,
Martin

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


Unmount USB stick from Cygwin shell?

2023-09-21 Thread Martin Wege via Cygwin
Hello,

How can I unmount an USB stick from the bash shell?

Thanks,
Martin

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


/usr/bin/dd *.iso to USB stick?

2023-09-21 Thread Martin Wege via Cygwin
Hello,

How can I use /usr/bin/dd to copy a *.iso image (Debian netinstall
boot image) to a USB stick as raw bytes?

Thanks,
Martin

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


Running bash script as SYSTEM from account with admin rights?

2023-09-21 Thread Martin Wege via Cygwin
Hello,

Does Cygwin have a tool to run a bash script as SYSTEM user if my
account already have admin rights?

Thanks,
Martin

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


NFS mkfifo support in cygwin 3.5.0 Re: [ANNOUNCEMENT] cygwin 3.4.9-1

2023-09-07 Thread Martin Wege via Cygwin
On Wed, Sep 6, 2023 at 5:27 PM Corinna Vinschen via Cygwin-announce
via Cygwin  wrote:
>
> The following packages have been uploaded to the Cygwin distribution:
>
> * cygwin-3.4.9-1
> * cygwin-devel-3.4.9-1
> * cygwin-doc-3.4.9-1
>
> Bug Fixes
> -
>
> - Fix a bug introduced in cygwin 3.4.0 that switch_to_nat_pipe flag is
>   not cleared properly when non-cygwin app is terminated in the case
>   where pseudo console is not activated.
>
> - For the time being, disable creating special files using mknod/mkfifo
>   on NFS.
>   Addresses: https://cygwin.com/pipermail/cygwin/2023-August/254266.html

While I am unhappy that you disabled this for Cygwin 3.4.9-1, we
noticed that you added mkfifo support for Cygwin 3.5.0 in
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=622fb0776ea333dd708ff312f08ec98311138fbe
🙏😁 :-)

Thanks

We are testing 3.5.0-0.423.g7ced682549ae.x86_64 - which includes
622fb0776ea333dd708ff312f08ec98311138fbe - right now, feedback will
come on Monday

Thanks,
Martin

-- 
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: How to fix |mkfifo()| failure if |pathname| is on NFS ? / was: Re: [EXTERNAL] Re: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-26 Thread Martin Wege via Cygwin
On Thu, Aug 24, 2023 at 6:45 PM Martin Wege  wrote:
>
> On Wed, Aug 23, 2023 at 1:06 AM Roland Mainz via Cygwin
>  wrote:
> >
> > On Tue, Aug 22, 2023 at 4:52 PM Lavrentiev, Anton (NIH/NLM/NCBI) [C]
> > via Cygwin  wrote:
> > > > FIFOs which don't make *any* sense
> > > > ... FWIW, a remote NFS fileystem.
> > >
> > > I got an impression that the OP is trying to deploy something (maybe the 
> > > entire Cygwin) onto an
> > > NFS share.  So the named FIFO "file" is also created in there.
> >
> > I agree with that impression. This is basically what large sites
> > (universities etc) do with UNIX and Linux: The machines mount an
> > user's ${HOMR} directory via automounter over NFS, and users are
> > discouraged (e.g. grumpy admin visiting you in person, blocking all
> > escape routes... =:-) ) from using the machine's local filesystems (in
> > Cygwin's case that includes "C:"!).
> >
> > In that case people want to use |mkfifo()|/|mkfifoat()| and/or
> > /usr/bin/mkfifo in their home directory, and don't expect that it does
> > not work.
> >
> > But that is what happens on Cygwin 3.4.8 right now, if someone tries
> > to do a |mkfifo()| on a NFS home directory (tested with MS NFSv3 and
> > CITI NFSv4 clients):
> > |mkfifo()| succeeds, but the resulting inode is *NOT* a FIFO as requested
> >
> > Example (/cygdrive/h/ is my home directory shared from my Linux machine):
> >  snip 
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ uname -a
> > CYGWIN_NT-10.0-19045 winkrakra1 3.4.8-1.x86_64 2023-08-17 17:02 UTC
> > x86_64 Cygwin
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ mount
> > C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
> > C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
> > C:/cygwin64 on / type ntfs (binary,auto)
> > C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> > H: on /cygdrive/h type nfs (binary,posix=0,user,noumount,auto)
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ ls -l
> > total 1
> > -rw-rw-rw- 1 Unix_User+0 Unix_Group+0 330 Aug 22 23:58 
> > cygwin_mkfifo_on_nfs.c
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ cat -n cygwin_mkfifo_on_nfs.c
> >  1  #include 
> >  2  #include 
> >  3  #include 
> >  4  #include 
> >  5  #include 
> >  6  #include 
> >  7
> >  8  int main(int ac, char *av[])
> >  9  {
> > 10  (void)puts("# start");
> > 11
> > 12  if
> > (mkfifo("/cygdrive/h/work/cygwin_mkfifo_on_nfs/myfifo.fifo", 0) != 0)
> > 13  perror("mkfifo failed");
> > 14  (void)puts("# done.");
> > 15  return EXIT_SUCCESS;
> > 16  }
> > 17
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ gcc -g cygwin_mkfifo_on_nfs.c
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ ./a
> > # start
> > # done.
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ ls -l
> > total 68
> > -rwxr-xr-x 1 Unix_User+0 Unix_Group+0 66951 Aug 23 00:12 a.exe
> > -rw-rw-rw- 1 Unix_User+0 Unix_Group+0   330 Aug 22 23:58 
> > cygwin_mkfifo_on_nfs.c
> > lrwxrwxrwx 1 Unix_User+0 Unix_Group+011 Aug 23 00:12 myfifo.fifo
> > -> ':\0:c4:1000'
> >
> > roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> > $ cat  > -bash: myfifo.fifo: No such file or directory
> >  snip 
> >
> > Note that Cygwin does not interpret the file |myfifo.fifo| as FIFO,
> > instead it comes back as a symlink "myfifo.fifo -> ':\0:c4:1000'".
> >
> > AFAIK there are (at least) these two options to fix the problems:
> > 1. Check whether the filesystem for the fifos path is NFS
> > (cgywin.dll's |fs.fs_is_nfs()|), and if it is a symlink check if it
> > starts with ':\0:c4:' (assuming "c4" is the prefix for inodes created
> > with |mkfifo()|). If this condition is |true|, then cygwin |stat()|,
> > |open()| etc. should treat this inode as FIFO.
> > 2. Check whether the filesystem for the fifos path is NFS
> > (cgywin.dll's |fs.fs_is_nfs()|), and then just refuse |mkfifo()| with
> > |ENOSYS| (not implemented)
> >
> > Better algorithm for [1] might be to check whether the inode is a
> > symlink, and then do a |fs.fs_is_nfs()| on the symlinks |pathname|,
> > assuming this is more performant.
>
> We would like to see option 1 implemented, maybe as an option in the
> CYGWIN environment variable
> (CYGWIN=nfs_emulate_dev_special_files_as_symlink ?)

One problem I see is how we can set machine-wide defaults, as the
CYGWIN variable is only inherited from process to process, and
/usr/bin/env - myprog will start myprog with an empty environment.

So if there is no way to set machine-wide defaults, I would prefer to
have the nfs_emulate_dev_special_files_as_symlink enabled by default.

Thanks,
Martin

-- 
Problem reports:  https://cygwin.com/problems.html
FAQ:  https://cygwin.com/faq/
Documentation:https:/

Documenting Cygwin on NFS, no longer only exchange-medium! Re: How to fix |mkfifo()| failure if |pathname| is on NFS ? / was: Re: [EXTERNAL] Re: mkfifo: cannot set permissions of 'x.fifo': Not a direc

2023-08-26 Thread Martin Wege via Cygwin
On Fri, Aug 25, 2023 at 2:19 PM Corinna Vinschen via Cygwin
 wrote:
>
> On Aug 23 01:05, Roland Mainz via Cygwin wrote:
> > Note that Cygwin does not interpret the file |myfifo.fifo| as FIFO,
> > instead it comes back as a symlink "myfifo.fifo -> ':\0:c4:1000'".
> >
> > AFAIK there are (at least) these two options to fix the problems:
> > 1. Check whether the filesystem for the fifos path is NFS
> > (cgywin.dll's |fs.fs_is_nfs()|), and if it is a symlink check if it
> > starts with ':\0:c4:' (assuming "c4" is the prefix for inodes created
> > with |mkfifo()|). If this condition is |true|, then cygwin |stat()|,
> > |open()| etc. should treat this inode as FIFO.
>
> The downside is that it is not possible to diffentiate between Cygwin
> FIFOs and real FIFOs created from the remote side in `ls -l'
> output.  Note that Cygwin returns the NFS stat info verbatim, so
> a real FIFO is returned as a real FIFO:
>
>   linux$ mkfifo bar
>   cygwin$ ls -l bar
>   prw-r--r-- 1 corinna vinschen  0 Aug 25 13:58 bar
>
> The idea was always to use NFS as exchange medium, but not as
> installation medium for the entire distro or to keep Cygwin home
> dirs on NFS.  There were times where NFS was pretty unstable.
> I used NFS for quite some time to build Cygwin packages, but at one
> point I got trouble (performance problems with multiple concurrent
> processes accessing an NFS share, build errors out of the blue),
> so I switched to Samba shares, albeit grudgingly.  I'm not yet
> sure if the problems are fixed.  At least a recent OpenSSH build
> ran through without problems...

Corinna, could you please update the Cygwin documentation then? We use
NFS, both Windows builtin and CITI NFSv4.1, with Cygwin for years
without major problems, so that comment about exchange-medium-only is
clearly wrong!

Thanks,
Martin

-- 
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: How to fix |mkfifo()| failure if |pathname| is on NFS ? / was: Re: [EXTERNAL] Re: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-26 Thread Martin Wege via Cygwin
On Sat, Aug 26, 2023 at 4:16 PM Corinna Vinschen via Cygwin
 wrote:
>
> On Aug 26 13:26, Cedric Blancher via Cygwin wrote:
> > On Fri, 25 Aug 2023 at 14:26, Corinna Vinschen via Cygwin
> >  wrote:
> > >
> > > On Aug 25 14:18, Corinna Vinschen via Cygwin wrote:
> > > > On Aug 23 01:05, Roland Mainz via Cygwin wrote:
> > > > > 2. Check whether the filesystem for the fifos path is NFS
> > > > > (cgywin.dll's |fs.fs_is_nfs()|), and then just refuse |mkfifo()| with
> > > > > |ENOSYS| (not implemented)
> > > >
> > > > I like the idea.
> > >
> > > EPERM, btw.  See https://man7.org/linux/man-pages/man2/mknod.2.html
> > >
> >
> > I am vehemently opposed to that idea. That will IMHO not only be the
> > wrong solution, it will break actual things like autoconf&friends on
> > NFS - they create fifos for testing, but do not use them. If you just
> > make this return EPERM, then you break stuff we have to rely on.
>
> https://cygwin.com/acronyms/#STC, please.#

Real world failure for Cygwin on NFS:

wget 
'http://deb.debian.org/debian/pool/main/k/ksh93u+m/ksh93u+m_1.0.4.orig.tar.gz
cd ksh-1.0.4
$PWD/bin/package make

This fails with Cygwin 3.4.8-1:

cat buildlog.log
package: update
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/bin/execrate
package: initialize the
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64
view
package: update
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64/lib/probe/C/make/probe
package: update
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64/bin/mamake
package: make with mamake
package: make output captured in
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64/lib/package/gen/make.out
mkfifo: cannot set permissions of
'/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64/lib/package/gen/make.out.fifo':
No such file or directory
package: make done at Fri Aug 26 19:24:26 CEST 2023 in
/cygdrive/z/arbeitdfn/windows_ksh/build_nfsv3/ksh-1.0.4/arch/cygwin.i386-64

If you need more examples just let me now, we have MUCH more of that...

Thanks,
Martin

-- 
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: How to fix |mkfifo()| failure if |pathname| is on NFS ? / was: Re: [EXTERNAL] Re: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-24 Thread Martin Wege via Cygwin
On Wed, Aug 23, 2023 at 1:06 AM Roland Mainz via Cygwin
 wrote:
>
> On Tue, Aug 22, 2023 at 4:52 PM Lavrentiev, Anton (NIH/NLM/NCBI) [C]
> via Cygwin  wrote:
> > > FIFOs which don't make *any* sense
> > > ... FWIW, a remote NFS fileystem.
> >
> > I got an impression that the OP is trying to deploy something (maybe the 
> > entire Cygwin) onto an
> > NFS share.  So the named FIFO "file" is also created in there.
>
> I agree with that impression. This is basically what large sites
> (universities etc) do with UNIX and Linux: The machines mount an
> user's ${HOMR} directory via automounter over NFS, and users are
> discouraged (e.g. grumpy admin visiting you in person, blocking all
> escape routes... =:-) ) from using the machine's local filesystems (in
> Cygwin's case that includes "C:"!).
>
> In that case people want to use |mkfifo()|/|mkfifoat()| and/or
> /usr/bin/mkfifo in their home directory, and don't expect that it does
> not work.
>
> But that is what happens on Cygwin 3.4.8 right now, if someone tries
> to do a |mkfifo()| on a NFS home directory (tested with MS NFSv3 and
> CITI NFSv4 clients):
> |mkfifo()| succeeds, but the resulting inode is *NOT* a FIFO as requested
>
> Example (/cygdrive/h/ is my home directory shared from my Linux machine):
>  snip 
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ uname -a
> CYGWIN_NT-10.0-19045 winkrakra1 3.4.8-1.x86_64 2023-08-17 17:02 UTC
> x86_64 Cygwin
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ mount
> C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
> C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
> C:/cygwin64 on / type ntfs (binary,auto)
> C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> H: on /cygdrive/h type nfs (binary,posix=0,user,noumount,auto)
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ ls -l
> total 1
> -rw-rw-rw- 1 Unix_User+0 Unix_Group+0 330 Aug 22 23:58 cygwin_mkfifo_on_nfs.c
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ cat -n cygwin_mkfifo_on_nfs.c
>  1  #include 
>  2  #include 
>  3  #include 
>  4  #include 
>  5  #include 
>  6  #include 
>  7
>  8  int main(int ac, char *av[])
>  9  {
> 10  (void)puts("# start");
> 11
> 12  if
> (mkfifo("/cygdrive/h/work/cygwin_mkfifo_on_nfs/myfifo.fifo", 0) != 0)
> 13  perror("mkfifo failed");
> 14  (void)puts("# done.");
> 15  return EXIT_SUCCESS;
> 16  }
> 17
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ gcc -g cygwin_mkfifo_on_nfs.c
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ ./a
> # start
> # done.
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ ls -l
> total 68
> -rwxr-xr-x 1 Unix_User+0 Unix_Group+0 66951 Aug 23 00:12 a.exe
> -rw-rw-rw- 1 Unix_User+0 Unix_Group+0   330 Aug 22 23:58 
> cygwin_mkfifo_on_nfs.c
> lrwxrwxrwx 1 Unix_User+0 Unix_Group+011 Aug 23 00:12 myfifo.fifo
> -> ':\0:c4:1000'
>
> roland_mainz@winkrakra1 /cygdrive/h/work/cygwin_mkfifo_on_nfs
> $ cat  -bash: myfifo.fifo: No such file or directory
>  snip 
>
> Note that Cygwin does not interpret the file |myfifo.fifo| as FIFO,
> instead it comes back as a symlink "myfifo.fifo -> ':\0:c4:1000'".
>
> AFAIK there are (at least) these two options to fix the problems:
> 1. Check whether the filesystem for the fifos path is NFS
> (cgywin.dll's |fs.fs_is_nfs()|), and if it is a symlink check if it
> starts with ':\0:c4:' (assuming "c4" is the prefix for inodes created
> with |mkfifo()|). If this condition is |true|, then cygwin |stat()|,
> |open()| etc. should treat this inode as FIFO.
> 2. Check whether the filesystem for the fifos path is NFS
> (cgywin.dll's |fs.fs_is_nfs()|), and then just refuse |mkfifo()| with
> |ENOSYS| (not implemented)
>
> Better algorithm for [1] might be to check whether the inode is a
> symlink, and then do a |fs.fs_is_nfs()| on the symlinks |pathname|,
> assuming this is more performant.

We would like to see option 1 implemented, maybe as an option in the
CYGWIN environment variable
(CYGWIN=nfs_emulate_dev_special_files_as_symlink ?)

Thanks,
Martin

-- 
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: [EXTERNAL] Re: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-24 Thread Martin Wege via Cygwin
On Wed, Aug 23, 2023 at 5:44 PM Jeffrey Altman via Cygwin
 wrote:
>
> On 8/22/2023 10:52 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin
> wrote:
> >> FIFOs which don't make *any* sense
> >> ... FWIW, a remote NFS fileystem.
> > I got an impression that the OP is trying to deploy something (maybe the 
> > entire Cygwin) onto an NFS share.  So the named FIFO "file" is also created 
> > in there.
> >
> > It's pointless to assume that the FIFO can be used as a communication 
> > device between the hosts that can mount the share, but it can be quite 
> > feasible to envision a scenario, in which the same host opens the FIFO 
> > located on the share from two processes and establish the communication 
> > using that special "file" (which is basically a special data-less i-node).
>
> I've been following this thread with quite a bit of curiosity. For those
> who do not know me, I'm the lead developer of the AFS filesystem on
> Windows. There have been requests for more than two decades for AFS
> clients to add support for locally created pipe files because AFS
> volumes are often used as home directories (even on Windows) and so many
> applications allocate a pipe in the home directory as a method of
> inter-process communication or a lock. The problem is that even if the
> intended usage of the file is entirely local, the directory object, the
> directory entry and the allocated inode (or equivalent) is network
> visible.

Who cares? It is up to the user, script or application author to do
'the right thing(tm)'.

>
> What happens when the user executes two copies of an
> application such as PyCharm on two separate machines sharing the same
> home directory? Does the directory entry and inode get reused on startup
> and/or deleted on exit? How does that impact the process instance on the
> other machine? The conclusion I came to long ago is that if pipes are to
> be implemented in a network file system namespace then the pipes must be
> fully functional network pipes. In just about all cases applications can
> be configured to use a non-default paths. In my opinion they should not
> be placed in a shared file system.

Oh my god. Please have this debate at the Austin Group. They do the
POSIX standard. We're here about implementing&using the POSIX
standard.

We only want that mkfifo() works with Cygwin on a NFS filesystem, as
specified in 
https://pubs.opengroup.org/onlinepubs/009696799/functions/mkfifo.html

My intention was not to invent something new. Just code using mkfifo,
and scripts using /usr/bin/mkfifo, should work on NFS. On UNIX&Linux
this works.

Have a look at https://cygwin.com/pipermail/cygwin/2023-August/254266.html,
sounds like there is a feasible way to implement this.

Thanks,
Martin

-- 
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 pathconf() query filesystem kernel data? Re: How does Cygwin detect MSFT NFSv3 file system? Re: Weird (path) problems with cygwin test release 3.5.0-0.384.g9939aa7d0945.x86_64 ...

2023-08-24 Thread Martin Wege via Cygwin
On Tue, Aug 22, 2023 at 12:07 AM Brian Inglis  wrote:
>
> On 2023-08-21 06:03, Martin Wege via Cygwin wrote:
> > On Sat, Aug 19, 2023 at 7:50 PM Brian Inglis  wrote:
> >>
> >> On 2023-08-18 07:09, Martin Wege via Cygwin wrote:
> >>> On Fri, Aug 18, 2023 at 10:44 AM Corinna Vinschen via Cygwin
> >>>  wrote:
> >>>>
> >>>> On Aug 17 20:49, Martin Wege via Cygwin wrote:
> >>>>> On Mon, Aug 14, 2023 at 10:56 PM Corinna Vinschen via Cygwin
> >>>>>  wrote:
> >>>>>> and the result is the same.  Note that Cygwin supports MSFT NFSv3 but
> >>>>>> not CITI NFSv4.1 internally.  No gurantee that Cygwin always does what
> >>>>>> is necessary for that other NFS.
> >>>>>
> >>>>> 1. How does Cygwin detect whether something is a MSFT NFSv3, or not?
> >>>>> Cygwin /bin/mount lists the CITI NFSv4.1 as 'nfs', so there *IS*
> >>>>> something which detects that?
> >>>>
> >>>> The filesystem name returned by NtQueryVolumeInformationFile is "NFS".
> >>>> If any other NFS returns the same filesystem name, it will be treated
> >>>> just like MSFT NFSv3.
> >>>>
> >>>>> 2. Are Cygwin soft link handing depend on MSFT NFSv3 or not, i.e. does
> >>>>> the Cygwin soft link code behave differently for MSFT NFSv3 file
> >>>>> systems?
> >>>>
> >>>> Yes.  NFS doesn't support symlink creation and symlink reading via
> >>>> the usual functions, because Windows symlinks are created as reparse
> >>>> points.  NFS doesn't support reparse points.  So the developers of
> >>>> the MSFT NFS client had to invent their own way to create and
> >>>> read NFS symlinks:
> >>>>
> >>>> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l1719
> >>>>
> >>>> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l2750
> >>>>
> >>>>> 3. Does Cygwin implement the pathconf() api?
> >>>>
> >>>> Yes.  Surprisingly, you can check this yourself by just calling the
> >>>> function and trying to compile your code.
> >>>
> >>> Apologies, how do we say in German? "Ich sollte meine Frage 
> >>> konkretisieren:"
> >>>
> >>> Does the Cygwin implementation of pathconf() support query data of the
> >>> underlying filesystem based on data from the kernel, as UNIX does? So
> >>> pathconf() returns different values for NTFS, ReFS, or Windows builtin
> >>> NFSv3?
> >>>
> >>> I am asking, because as far as I know the Linux implementation is not
> >>> a syscall, and instead glibc guesses values based on builtin static
> >>> data, and whatever fstatfs() has to offer. Compared to that UNIX
> >>> (Solaris, AIX, HPUX, ...) have pathconf() as a syscall, and actually
> >>> ask the filesystem itself.
> >>
> >> Many library functions are implemented as documented either in the Cygwin
> >> packages cygwin-doc and man-pages-posix available for installation; and 
> >> use as
> >> e.g. `man 3p fpathconf`, also available online at:
> >> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html 
> >> or
> >> https://man7.org/linux/man-pages/man3/fpathconf.3p.html
> >> and for comparison and reference we make Cygwin package man-pages-linux
> >> available for installation; and use as e.g. `man -m linux 3 fpathconf`, 
> >> also
> >> available online at:
> >>
> >>  https://man7.org/linux/man-pages/man3/fpathconf.3.html
> >>
> >> suggestions for setup are in the package announcements made every 9-12 
> >> weeks
> >> when the latest Linux man-pages package is released and updated on Cygwin.
> >>
> >> Please also note that the getconf(1) program is installed as part of 
> >> Cygwin and
> >> can access f/pathconf variables associated with a pathname argument, as 
> >> shown in
> >> getconf(1) `man 1 getconf` and getconf(1p) `man 1p getconf`.
> >
> > Thanks, but my question was about the Cygwin *implementation*: Does it
> > distinguish between NTFS, REFS, FAT, NFS? Does it use data obtained
> > from the Windows kernel at runtime, or does it rely on static data
> > compiled into the cygwin.dll library?
>
> My suggestion was to encourage you to try out the command on the relevant
> filesystems, or feel free to check out the repo and the implementation.

Where in the git is the implementation of pathconf()?

Thanks,
Martin

-- 
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: Test for Windows Administrator permissions from Cygwin terminal|script?

2023-08-24 Thread Martin Wege via Cygwin
On Sat, Aug 19, 2023 at 10:15 AM ASSI via Cygwin  wrote:
>
> Martin Wege via Cygwin writes:
> > How can I find out whether the current Cygwin terminal has
> > Administrator rights? I want to safeguard our admin scripts with a
> > simple test and bail out with an error if someone wants to do admin
> > stuff (say: regtool) without admin privileges.
>
> Windows really doesn't have a defined notion of what is or is not an
> "administrator".  Each particular definition will be insufficient or
> invalid in certain contexts.  When you're dealing with hardened
> installations (via group policies or otherwise), large windows domains
> and/or server administration you may have to be way more specific than
> just looking at one simple indication.
>
> That said, most commonly the presence of SID S-1-5-32-544 in your user
> token (in Cygwin: gid=544, unless you override it in the group config)
> will be the best simple approximation.  Incidentally, this is what tcsh
> is using on Cygwin to define the "superuser" for the purpose of setting
> the prompt with "%#":
> https://github.com/tcsh-org/tcsh/blob/d075ab5b4155ebff9d30e765733c030c3da5e362/tc.prompt.c#L212
>
> For (ba)sh scripts you can parse the output from id along the lines of
>
> id -G | grep -q '\<544\>' && echo admin || echo "not admin"

Is there any guarantee that the UNIX GID of the "administrator" will
always be "544", regardless of locale or Country-specific version of
Windows?

Also, this might be something for a Cygwin ADMINISTRATOR&PROGRAMMING
FAQ, if there is such a thing.

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-21 Thread Martin Wege via Cygwin
On Fri, Aug 18, 2023 at 10:34 AM Corinna Vinschen
 wrote:
>
> On Aug 18 06:02, Martin Wege via Cygwin wrote:
> > On Mon, Aug 7, 2023 at 4:42 PM Martin Wege  wrote:
> > >
> > > Hello,
> > >
> > > We get a weird mkfifo failure in Cygwin on NTFS:
> > >
> > > /usr/bin/mkfifo -m 600 x.fifo
> > > mkfifo: cannot set permissions of 'x.fifo': Not a directory
> > >
> > > Is there a known workaround? So far named fifos cannot be created somehow.
> >
> > This is fixed for NTFS, but still broken for Windows builtin NFS v3 client:
>
> It was actually never supposed to work on NFS.  Cygwin FIFOs are
> created as symlinks of the type Windows shortcut with the R/O attribute
> set.  Those are only generated on NTFS and FAT filesystems.  NFS symlinks
> are generated using special magic.  NFS doesn't support DOS attributes.

NFS supports symlinks!
Easy solution would be to say that symlinks on NFS pointing to
:\0:c4:$inodenum are pipes on the local Cygwin machine.
/usr/bin/mkfifo on Cygwin creates a symlink :\0:c4:$inodenum. Cygwin
stat() functions turn symlinks with a value of :\0:c4:... to pipes.
Everyone is happy!

It does not have to be portable across different platforms. Just
portable enough that mkfifo in with bash scripts works on NFS.

Thanks,
Martin
>
> 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 pathconf() query filesystem kernel data? Re: How does Cygwin detect MSFT NFSv3 file system? Re: Weird (path) problems with cygwin test release 3.5.0-0.384.g9939aa7d0945.x86_64 ...

2023-08-21 Thread Martin Wege via Cygwin
On Sat, Aug 19, 2023 at 7:50 PM Brian Inglis  wrote:
>
> On 2023-08-18 07:09, Martin Wege via Cygwin wrote:
> > On Fri, Aug 18, 2023 at 10:44 AM Corinna Vinschen via Cygwin
> >  wrote:
> >>
> >> On Aug 17 20:49, Martin Wege via Cygwin wrote:
> >>> On Mon, Aug 14, 2023 at 10:56 PM Corinna Vinschen via Cygwin
> >>>  wrote:
> >>>> and the result is the same.  Note that Cygwin supports MSFT NFSv3 but
> >>>> not CITI NFSv4.1 internally.  No gurantee that Cygwin always does what
> >>>> is necessary for that other NFS.
> >>>
> >>> 1. How does Cygwin detect whether something is a MSFT NFSv3, or not?
> >>> Cygwin /bin/mount lists the CITI NFSv4.1 as 'nfs', so there *IS*
> >>> something which detects that?
> >>
> >> The filesystem name returned by NtQueryVolumeInformationFile is "NFS".
> >> If any other NFS returns the same filesystem name, it will be treated
> >> just like MSFT NFSv3.
> >>
> >>> 2. Are Cygwin soft link handing depend on MSFT NFSv3 or not, i.e. does
> >>> the Cygwin soft link code behave differently for MSFT NFSv3 file
> >>> systems?
> >>
> >> Yes.  NFS doesn't support symlink creation and symlink reading via
> >> the usual functions, because Windows symlinks are created as reparse
> >> points.  NFS doesn't support reparse points.  So the developers of
> >> the MSFT NFS client had to invent their own way to create and
> >> read NFS symlinks:
> >>
> >> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l1719
> >>
> >> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l2750
> >>
> >>> 3. Does Cygwin implement the pathconf() api?
> >>
> >> Yes.  Surprisingly, you can check this yourself by just calling the
> >> function and trying to compile your code.
> >
> > Apologies, how do we say in German? "Ich sollte meine Frage konkretisieren:"
> >
> > Does the Cygwin implementation of pathconf() support query data of the
> > underlying filesystem based on data from the kernel, as UNIX does? So
> > pathconf() returns different values for NTFS, ReFS, or Windows builtin
> > NFSv3?
> >
> > I am asking, because as far as I know the Linux implementation is not
> > a syscall, and instead glibc guesses values based on builtin static
> > data, and whatever fstatfs() has to offer. Compared to that UNIX
> > (Solaris, AIX, HPUX, ...) have pathconf() as a syscall, and actually
> > ask the filesystem itself.
>
> Many library functions are implemented as documented either in the Cygwin
> packages cygwin-doc and man-pages-posix available for installation; and use as
> e.g. `man 3p fpathconf`, also available online at:
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html or
> https://man7.org/linux/man-pages/man3/fpathconf.3p.html
> and for comparison and reference we make Cygwin package man-pages-linux
> available for installation; and use as e.g. `man -m linux 3 fpathconf`, also
> available online at:
>
> https://man7.org/linux/man-pages/man3/fpathconf.3.html
>
> suggestions for setup are in the package announcements made every 9-12 weeks
> when the latest Linux man-pages package is released and updated on Cygwin.
>
> Please also note that the getconf(1) program is installed as part of Cygwin 
> and
> can access f/pathconf variables associated with a pathname argument, as shown 
> in
> getconf(1) `man 1 getconf` and getconf(1p) `man 1p getconf`.

Thanks, but my question was about the Cygwin *implementation*: Does it
distinguish between NTFS, REFS, FAT, NFS? Does it use data obtained
from the Windows kernel at runtime, or does it rely on static data
compiled into the cygwin.dll library?

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-18 Thread Martin Wege via Cygwin
On Fri, Aug 18, 2023 at 10:34 AM Corinna Vinschen
 wrote:
>
> On Aug 18 06:02, Martin Wege via Cygwin wrote:
> > On Mon, Aug 7, 2023 at 4:42 PM Martin Wege  wrote:
> > >
> > > Hello,
> > >
> > > We get a weird mkfifo failure in Cygwin on NTFS:
> > >
> > > /usr/bin/mkfifo -m 600 x.fifo
> > > mkfifo: cannot set permissions of 'x.fifo': Not a directory
> > >
> > > Is there a known workaround? So far named fifos cannot be created somehow.
> >
> > This is fixed for NTFS, but still broken for Windows builtin NFS v3 client:
>
> It was actually never supposed to work on NFS.  Cygwin FIFOs are
> created as symlinks of the type Windows shortcut with the R/O attribute
> set.  Those are only generated on NTFS and FAT filesystems.  NFS symlinks
> are generated using special magic.  NFS doesn't support DOS attributes.

So what would be a way to fix this for users with NFS mounted
projects, data or home dirs?

Thanks,
Martin

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


ReFS support in Cygwin?

2023-08-18 Thread Martin Wege via Cygwin
Hello,

is ReFS supported in Cygwin? If so, what does Cygwin /bin/mount print
- "ntfs" or "refs"?

Thanks,
Martin

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


Cygwin pathconf() query filesystem kernel data? Re: How does Cygwin detect MSFT NFSv3 file system? Re: Weird (path) problems with cygwin test release 3.5.0-0.384.g9939aa7d0945.x86_64 ...

2023-08-18 Thread Martin Wege via Cygwin
On Fri, Aug 18, 2023 at 10:44 AM Corinna Vinschen via Cygwin
 wrote:
>
> On Aug 17 20:49, Martin Wege via Cygwin wrote:
> > On Mon, Aug 14, 2023 at 10:56 PM Corinna Vinschen via Cygwin
> >  wrote:
> > > and the result is the same.  Note that Cygwin supports MSFT NFSv3 but
> > > not CITI NFSv4.1 internally.  No gurantee that Cygwin always does what
> > > is necessary for that other NFS.
> >
> > 1. How does Cygwin detect whether something is a MSFT NFSv3, or not?
> > Cygwin /bin/mount lists the CITI NFSv4.1 as 'nfs', so there *IS*
> > something which detects that?
>
> The filesystem name returned by NtQueryVolumeInformationFile is "NFS".
> If any other NFS returns the same filesystem name, it will be treated
> just like MSFT NFSv3.
>
> > 2. Are Cygwin soft link handing depend on MSFT NFSv3 or not, i.e. does
> > the Cygwin soft link code behave differently for MSFT NFSv3 file
> > systems?
>
> Yes.  NFS doesn't support symlink creation and symlink reading via
> the usual functions, because Windows symlinks are created as reparse
> points.  NFS doesn't support reparse points.  So the developers of
> the MSFT NFS client had to invent their own way to create and
> read NFS symlinks:
>
> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l1719
>
> https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/path.cc;hb=HEAD#l2750
>
> > 3. Does Cygwin implement the pathconf() api?
>
> Yes.  Surprisingly, you can check this yourself by just calling the
> function and trying to compile your code.

Apologies, how do we say in German? "Ich sollte meine Frage konkretisieren:"

Does the Cygwin implementation of pathconf() support query data of the
underlying filesystem based on data from the kernel, as UNIX does? So
pathconf() returns different values for NTFS, ReFS, or Windows builtin
NFSv3?

I am asking, because as far as I know the Linux implementation is not
a syscall, and instead glibc guesses values based on builtin static
data, and whatever fstatfs() has to offer. Compared to that UNIX
(Solaris, AIX, HPUX, ...) have pathconf() as a syscall, and actually
ask the filesystem itself.

Thanks,
Martin

-- 
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 console: Different default background color when terminal runs as Admin?

2023-08-18 Thread Martin Wege via Cygwin
On Fri, Aug 18, 2023 at 7:27 AM Jonathon Merz via Cygwin
 wrote:
>
> On Thu, Aug 17, 2023 at 7:13 PM Martin Wege via Cygwin 
> wrote:
>
> > Just an idea: Could the default background color of the Cygwin console
> > be changed from black to grey (or RED) if the terminal has been
> > started with Administrator rights?
> >
>
> Assuming that:
> 1. The Administrators group is called "Administrators"
> 2. There aren't any non-administrative groups with "Administrators" in the
> name
> 3. You're using mintty for your terminal
>
> You can run the following in bash or zsh with the desired RGB values:
>
> if [[ `id -Gn` == *Administrators* ]]
> then
> echo -ne "\e]11;#FFBBEE\a";
> fi
>

Looking at the output of /usr/bin/id -a was my first guess too. But
this fails quickly because the names are localized. Seriously MS runs
the Windows group names through the l10n wringer!! So what works on
Windows for Germany will surely fail for Windows for Japan. Thus I am
looking for a more portable solution.

Maybe the numeric group ids are more 'portable' across the Windows
versions for different countries?

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-17 Thread Martin Wege via Cygwin
On Mon, Aug 7, 2023 at 4:42 PM Martin Wege  wrote:
>
> Hello,
>
> We get a weird mkfifo failure in Cygwin on NTFS:
>
> /usr/bin/mkfifo -m 600 x.fifo
> mkfifo: cannot set permissions of 'x.fifo': Not a directory
>
> Is there a known workaround? So far named fifos cannot be created somehow.

This is fixed for NTFS, but still broken for Windows builtin NFS v3 client:
$ mkfifo -m 0600 hellofifo.fifo
mkfifo: cannot set permissions of 'hellofifo.fifo': No such file or directory
$ ls -l hellofifo.fifo
lrwxrwxrwx 1 Unix_User+3640 Unix_Group+3640 11 Aug 18 05:58
hellofifo.fifo -> ':\0:c4:1180'
$ uname -a
CYGWIN_NT-10.0-19045 wincluster01_40_88 3.4.8-1.x86_64 2023-08-17
17:02 UTC x86_64 Cygwin

Thanks,
Martin

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


Cygwin console: Different default background color when terminal runs as Admin?

2023-08-17 Thread Martin Wege via Cygwin
Hello,

Just an idea: Could the default background color of the Cygwin console
be changed from black to grey (or RED) if the terminal has been
started with Administrator rights?

Thanks,
Martin

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


Test for Windows Administrator permissions from Cygwin terminal|script?

2023-08-17 Thread Martin Wege via Cygwin
Hello,

How can I find out whether the current Cygwin terminal has
Administrator rights? I want to safeguard our admin scripts with a
simple test and bail out with an error if someone wants to do admin
stuff (say: regtool) without admin privileges.

Thanks,
Martin

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


How does Cygwin detect MSFT NFSv3 file system? Re: Weird (path) problems with cygwin test release 3.5.0-0.384.g9939aa7d0945.x86_64 ...

2023-08-17 Thread Martin Wege via Cygwin
On Mon, Aug 14, 2023 at 10:56 PM Corinna Vinschen via Cygwin
 wrote:
> and the result is the same.  Note that Cygwin supports MSFT NFSv3 but
> not CITI NFSv4.1 internally.  No gurantee that Cygwin always does what
> is necessary for that other NFS.

1. How does Cygwin detect whether something is a MSFT NFSv3, or not?
Cygwin /bin/mount lists the CITI NFSv4.1 as 'nfs', so there *IS*
something which detects that?
2. Are Cygwin soft link handing depend on MSFT NFSv3 or not, i.e. does
the Cygwin soft link code behave differently for MSFT NFSv3 file
systems?
3. Does Cygwin implement the pathconf() api?

Thanks,
Martin

-- 
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: Weird (path) problems with cygwin test release 3.5.0-0.384.g9939aa7d0945.x86_64 ...

2023-08-14 Thread Martin Wege via Cygwin
On Mon, Aug 14, 2023 at 7:30 PM Roland Mainz via Cygwin
 wrote:
>
> On Mon, Aug 14, 2023 at 6:25 PM Roland Mainz  wrote:
> > On Mon, Aug 14, 2023 at 12:21 PM Corinna Vinschen via Cygwin
> >  wrote:
> > > On Aug 11 13:36, Mainz, Roland via Cygwin wrote:
> [snip]
> > > > In our case we have a project with both custom binaries and sources
> > > > both hosted on the filesystem as /home/rmainz/ (i.e. filesystem
> > > > mounted on H:, and then bind mount to /home/rmainz).
> > > >
> > > > After updating Cygwin to 3.5.0-0.384.g9939aa7d0945.x86_64 the build
> > > > now fails *IF* I access the binaries with their full absolute path AND
> > > > the sources with their absolute path:
> > > >  snip 
> > > > $ cd 
> > > > /home/rmainz/tmp/try10_rde_new_rds/RDE-Development/build_windows4/tmp
> > > > $ ls -l x.cpp
> > > > -rw-r--r-- 1 rmainz rovdevel 110 Aug 11 15:32 x.cpp
> > > > $ 
> > > > /home/rmainz/tmp/try10_rde_new_rds/Dependencies/win/qt/qt_5_15_2/Tools/mingw810_64/bin/c++
> > > >  $PWD/x.cpp
> > > > c++.exe: error: 
> > > > /home/rmainz/tmp/try10_rde_new_rds/RDE-Development/build_windows4/tmp/x.cpp:
> > > >  No such file or directory
> > > > c++.exe: fatal error: no input files
> > > > compilation terminated.
> > > >  snip 
> > >
> > > I can't reproduce this:
> > >
> > > $ net use H: 
> >
> > Is  Samba, CIFS or NFS ?
> >
> > > $ mount -o exec H: /home/rmainz
> > > $ cd /home/rmainz/tmp
> > > $ cp /bin/cat.exe .
> > > $ mkdir baz
> > > $ echo foo > baz/bar
> > > $ /home/rmainz/tmp/cat $PWD/baz/bar
> > > foo
> >
> > Grumpf... ;-(
> >
> > ... I'm still seeing this problem.
> > The sources we are building are proprietary (sorry), but I can
> > reproduce this with both CITI's NFSv4.1 and Windows 10 builtin NFSv3
> > clients.
> >
> > Setup for Windows's NFSv3 client on Cygwin is simple:
> > 1. Install Windows 10 builtin NFSv3 client via "Programs&Features" (I
> > think there is a way to do that in a scripted way, but I still didn't
> > had time to figure that out)
> >
> > 2. Export NFSv3 directory 10.49.20.131:/export/home/rmainz (rmainz has
> > uid=1616, gid=1616) on a Linux NFS-Server (RHEL, Debian etc.)
> >
> > 3. Mount NFSv3 filesystem in Windows 10 in a Cygwin terminal, with
> > default user uid=1616, gid=1616 like this:
> >  snip 
> > $ regtool -i -s set
> > '/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/ClientForNFS/CurrentVersion/Default/AnonymousUID'
> > 1616
> > $ regtool -i -s set
> > '/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/ClientForNFS/CurrentVersion/Default/AnonymousGID'
> > 1616
> > $ /cygdrive/c/Windows/system32/mount -o anon
> > '\\10.49.20.131\export\home\rmainz' H:
> >  snip 
> >
> > 4. After that I started building our sources with Cygwin 3.4.7
> > (works), then closed all Cygwin windows etc., and installed Cygwin
> > 3.5.0-0.388.g1a646ad7970a.x86_64 (reboot or not reboot - doesn't
> > matter). After that the build fails.
> >
> > - See https://rovema.kpaste.net/e5774d8077 build log on Cygwin 3.4.7,
> > which works without problems
> > - See https://rovema.kpaste.net/1a3b98e0b for the build failure on
> > Cygwin 3.5.0-0.388.g1a646ad7970a.x86_64
> > - The horrifying abdomination ("buildrdecygwin.bash") used to build
> > the mess can be found at https://rovema.kpaste.net/e98be
>
> It seems the issue can be reduced to this on  Cygwin
> 3.5.0-0.388.g1a646ad7970a.x86_64 - c++ with H:/path/.../x.cpp works,
> c++ with  /home/rmainz/path/.../x.cpp does not.
>
> This definitely *WORKED* in Cygwin 3.4.7:
>
> Example:
>  snip 
> $ uname -a
> CYGWIN_NT-10.0-19045 WINGRENDEL01 3.5.0-0.388.g1a646ad7970a.x86_64
> 2023-08-11 14:14 UTC x86_64 Cygwin
>
> $ cat /etc/fstab
> # /etc/fstab
> #
> #This file is read once by the first process in a Cygwin process tree.
> #To pick up changes, restart all Cygwin processes.  For a description
> #see https://cygwin.com/cygwin-ug-net/using.html#mount-table
>
> # This is default anyway:
> none /cygdrive cygdrive binary,posix=0,user 0 0
> H:  /home/rmainznonebinary,posix=0,user 0   0
>
>
> $ mount -a
>
> $ 
> /home/rmainz/tmp/winnfstest/hummingbirdnfstest1/try10_rde_new_rds/Dependencies/win/qt/qt_5_15_2/Tools/mingw810_64/bin/c++
> /home/rmainz/tmp/winnfstest/hummingbirdnfstest1/try10_rde_new_rds/RDE-Development/build_windows5/tmp/x.cpp
> c++.exe: error:
> /home/rmainz/tmp/winnfstest/hummingbirdnfstest1/try10_rde_new_rds/RDE-Development/build_windows5/tmp/x.cpp:
> No such file or directory
> c++.exe: fatal error: no input files
> compilation terminated.
>
> $ 
> /home/rmainz/tmp/winnfstest/hummingbirdnfstest1/try10_rde_new_rds/Dependencies/win/qt/qt_5_15_2/Tools/mingw810_64/bin/c++
> H:/tmp/winnfstest/hummingbirdnfstest1/try10_rde_new_rds/RDE-Development/build_windows5/tmp/x.cpp
>
> $ ./a
> Hello World!
>  snip 
>
> /proc/cygwin/h/path/... does not work either...
>
> Does anyone have any idea what changed between Cygwin 3.4.7 and Cygwin
> 3.5.0-0.388.g1a646ad7970a.x86_64 in this case ?
>

Maybe MinGW compat is bro

Re: Entering Cygwin command line (bash login) from Windows cmd.exe ?

2023-08-14 Thread Martin Wege via Cygwin
On Mon, Aug 14, 2023 at 9:35 AM Brian Inglis  wrote:
>
> On 2023-08-13 11:40, Martin Wege via Cygwin wrote:
> > On Sun, Aug 13, 2023 at 12:53 AM Roland Mainz via Cygwin wrote:
> >> On Mon, Aug 7, 2023 at 7:38 AM KAVALAGIOS Panagiotis (EEAS) via Cygwin 
> >> wrote:
> >>>> On Sat, Jul 29, 2023 at 6:18 AM Roland Mainz wrote:
> >>>>> Is there an official way to enter the Cygwin command line (e.g. bash
> >>>>> login) from Windows cmd.exe, e.g. if someone ssh's into a Windows
> >>>>> machine he/she ends/up in a cmd.exe and not bash...
>
> >>> You may run your favourite shell from the bin directory of your Cygwin 
> >>> installation:
> >>> "C:\Program Files\Cygwin\bin\bash.exe"
> >>> "C:\Program Files\Cygwin\bin\tcsh.exe"
> >>> replace " C:\Program Files" with your target Cygwin installation 
> >>> directory root.
>
> >> Turns out my problem was simply that I forgot that just typing "bash"
> >> only gives me an interactive shell, which sources only the interactive
> >> shell configs (e.g. /etc/ksh.kshrc + ~/.kshrc for ksh93, and
> >> /etc/bash.bashrc + ~/.bashrc for bash), but not the login configs
> >> (e.g. /etc/profile + ~/.profile).
> >> So the simple fix was just to type:
> >> C:\Program Files\Cygwin\bin\bash.exe --login
> >> or
> >> C:\Program Files\Cygwin\bin\ksh93.exe --login
> >> P.S.: Which reminds me - is there a way to contribute a Cygwin ksh93 
> >> package ?
>
> > We would greatly appreciate a Korn Shell 93 package, preferably with
> > some POSIX builtin commands.
>
> $ cygcheck -p Korn
> Found 6 matches for Korn
> mksh-53a-1-src - mksh-src: MirBSD Korn Shell (source)
> mksh-54-1-src - mksh-src: MirBSD Korn Shell (source)
> mksh-56c-1-src - mksh-src: MirBSD Korn Shell (source)
> mksh-53a-1 - mksh: MirBSD Korn Shell
> mksh-54-1 - mksh: MirBSD Korn Shell
> mksh-56c-1 - mksh: MirBSD Korn Shell
>
> https://cygwin.com/packages/summary/mksh-src.html

I know about that, but it has only ksh88 compatibility. What would be
great is the real ksh93, with IEEE754-style floating point math,
compound variables, and regex with ~(X) (egrep with logical AND),
~(E), .sh.match pattern matching facilities.

Thanks,
Martin

-- 
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 breaks net use Z: /delete in scripts?

2023-08-13 Thread Martin Wege via Cygwin
On Sun, Aug 13, 2023 at 7:13 PM Martin Wege  wrote:
>
> On Sun, Aug 13, 2023 at 12:43 AM Roland Mainz via Cygwin
>  wrote:
> >
> > On Fri, Aug 11, 2023 at 10:55 AM Corinna Vinschen via Cygwin
> >  wrote:
> > [snip]
> > > On Aug 11 10:25, Martin Wege wrote:
> > > > Cygwin somehow breaks unmounting of network shares, but ONLY if the
> > > > net use /delete happens in a bash shell script.
> > > >
> > > > Example:
> > > > Mount SMB network share on Z:
> > > > Do not touch Z:!
> > > >
> > > > Then do a net use /delete in a bash script:
> > > > net use Z: /delete
> > > > Systemfehler 1794 aufgetreten.
> > > > Der Redirector wird verwendet und kann nicht aus dem Speicher entfernt 
> > > > werden.
> > > >
> > > > If I execute the net use Z: /delete in an interactive bash shell it 
> > > > works.
> > > >
> > > > Can anyone explain this?
> > >
> > > Something is wrong on your side, but no, I can't explain it.  It's
> > > not related to Cygwin:
> > >
> > > $ cat > b.sh < > > #!/bin/bash
> > > net use Z: /delete
> > > EOF
> > > $ chmod +x b.sh
> > > $ net use Z: server\\share
> > > The command completed successfully.
> > >
> > > B:[~]$ ./b.sh
> > > Z: was deleted successfully.
> >
> > I think it's the problem that a shell keeps a fd open to the shell
> > script's file.
> >
> > Example:
> >  snip 
> > $ cat shellfd.ksh
> > #!/bin/ksh93
> > # shell script printing the fd which the shell
> > # process has open right now
> > ls -l /proc/$$/fd/
> > true # needed here so ksh93 doesn't make a tail optimisation
> > exit 0
> > $ bash shellfd.ksh
> > total 0
> > lrwx-- 1 test001 users 64 Aug 13 00:26 0 -> /dev/pts/7
> > lrwx-- 1 test001 users 64 Aug 13 00:26 1 -> /dev/pts/7
> > lrwx-- 1 test001 users 64 Aug 13 00:26 2 -> /dev/pts/7
> > lr-x-- 1 test001 users 64 Aug 13 00:26 255 -> 
> > /cygdrive/h/tmp/shellfd.ksh
> > $ ksh93 shellfd.ksh
> > total 0
> > lrwx-- 1 test001 users 64 Aug 13 00:26 0 -> /dev/pts/7
> > lrwx-- 1 test001 users 64 Aug 13 00:26 1 -> /dev/pts/7
> > lr-x-- 1 test001 users 64 Aug 13 00:26 10 -> /cygdrive/h/tmp/shellfd.ksh
> > lrwx-- 1 test001 users 64 Aug 13 00:26 2 -> /dev/pts/7
> >  snip 
> >
> > So both bash4 an ksh93 keep a fd to the shell script ("shellfd.ksh")
> > around (I even tried /usr/bin/shcomp to make shell bytecode, but the
> > issue remains...)
> >
> > And here comes the nasty part: If shellfd.ksh is on a network
> > filesystem (in my test setup my home dir, mounted at H:), then in some
> > cases (I do not know why) a $ net use Z: /delete # will fail with
> > error #1794 if both network filesystems are from the same server.
> >
> > This is NOT the same as the script tries to unmount the filesystem it
> > is residing on - Z: is mounted separately, and a different exported
> > directory than H:, and yet I can reproduce that issue (after around
> > 30-40 experiments, until I remembered that ksh93 keeps a fd to the
> > script open).
> >
> > This sounds a lot like a Windows bug.
> >
> > Martin: Do you have more than one network filesystem mounted on your 
> > machine ?
>
> Yes, usually 12-14 filesystems mounted per machine. This includes user
> directories, and several directories where the software and production
> data come from. I still have to test whether putting software on a
> local disk solves the problem. Maybe I should better call this a
> workaround for a silly Windows restriction.

Yeah, putting software on a local disk allows me to do a successful
net use Z: /delete

So what do we do now? File a bug at Microsoft support, and they fix
that for Windows 12 in 2038?

Thanks,
Martin

-- 
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: Entering Cygwin command line (bash login) from Windows cmd.exe ?

2023-08-13 Thread Martin Wege via Cygwin
On Sun, Aug 13, 2023 at 12:53 AM Roland Mainz via Cygwin
 wrote:
>
> On Mon, Aug 7, 2023 at 7:38 AM KAVALAGIOS Panagiotis (EEAS) via Cygwin
>  wrote:
> >
> > > On Sat, Jul 29, 2023 at 6:18 AM Roland Mainz 
> > > wrote:
> > > > Is there an official way to enter the Cygwin command line (e.g. bash
> > > > login) from Windows cmd.exe, e.g. if someone ssh's into a Windows
> > > > machine he/she ends/up in a cmd.exe and not bash...
> > >
> > > ping!
> >
> > You may run your favourite shell from the bin directory of your Cygwin 
> > installation:
> >
> > "C:\Program Files\Cygwin\bin\bash.exe"
> > "C:\Program Files\Cygwin\bin\tcsh.exe"
> >
> > replace " C:\Program Files" with your target Cygwin installation directory 
> > root.
>
> Thanks ;-)
>
> Turns out my problem was simply that I forgot that just typing "bash"
> only gives me an interactive shell, which sources only the interactive
> shell configs (e.g. /etc/ksh.kshrc + ~/.kshrc for ksh93, and
> /etc/bash.bashrc + ~/.bashrc for bash), but not the login configs
> (e.g. /etc/profile + ~/.profile).
>
> So the simple fix was just to type:
> C:\Program Files\Cygwin\bin\bash.exe --login
>
> or
>
> C:\Program Files\Cygwin\bin\ksh93.exe --login
>
> 
>
> Bye,
> Roland
>
> P.S.: Which reminds me - is there a way to contribute a Cygwin ksh93 package ?

We would greatly appreciate a Korn Shell 93 package, preferably with
some POSIX builtin commands.

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-10 Thread Martin Wege via Cygwin
On Wed, Aug 9, 2023 at 11:56 AM Corinna Vinschen
 wrote:
>
> On Aug  9 11:12, Martin Wege via Cygwin wrote:
> > On Wed, Aug 9, 2023 at 10:01 AM Corinna Vinschen
> >  wrote:
> > >
> > > On Aug  8 21:38, Martin Wege via Cygwin wrote:
> > > > On Tue, Aug 8, 2023 at 10:20 AM Corinna Vinschen
> > > >  wrote:
> > > > >
> > > > > On Aug  7 23:14, Martin Wege via Cygwin wrote:
> > > > > > Secondly, how are fifos, other device nodes and mknod implemented? 
> > > > > > You
> > > > > > encode them as softlinks on ntfs?
> > > > >
> > > > > Not only on NTFS.  FIFOs on the disk are always created as symlinks
> > > > > with a special target string, recognized by Cygwin.  No differece on
> > > > > NFS.  Microsoft NFSv3 has no way to specify creating a "real" FIFO
> > > > > on the remote filesystem.  It wouldn't make sense anyway, because
> > > > > there's no way to share the FIFO across systems.
> > > >
> > > > So no Windows ioctl to do a mknod?
> > >
> > > Windows does not have provisions to store FIFOs on disk.  The closest
> > > you get in Windows are Windows named pipes, and those are stored
> > > non-permanently in a special, temporary filesystem inside the native NT
> > > namespace.  Try this in Cygwin:
> > >
> > >   $ cd /proc/sys/Device/NamedPipe/<-- trailing slash!
> > >   $ ls -l
> > >
> > > FIFOs in the normal Windows filesystem are a Cygwin fake.
> >
> > Maybe make pipes in Cygwin symlinks to /proc/sys/Device/NamedPipe/?
>
> Why?  Windows Named Pipes don't act like UNIX FIFOs.

OK, dumb-user-question: Where is the difference?

>
> > > > What does a Linux/FreeBSD FIFO file look like, if you export that
> > > > filesystem via NFSv3, and mount it via the native Windows NFSv3
> > > > driver, and do a ls -l in Cygwin?
> > >
> > > It looks like a FIFO because MSFT NFSv3 exports the stat(2) info
> > > verbatim:
> > >
> > > linux$ mkfifo blubb
> > >
> > > cygwin$ ls -l blubb
> > > prw-r--r-- 1 corinna vinschen 0 Aug  8 10:22 blubb
> >
> > Will cygwin treat this as a FIFO?
>
> No.  Cygwin FIFOs != Unix FIFOs.
>
> > Can cygwin set the 'p' flag via a magic ioctl?
>
> No.  I don't understand your insistence to use FIFOs on NFS.  There is
> no value in that, because you can't share them between systems anyway.
>
> https://www.unix.com/unix-for-advanced-and-expert-users/10861-fifo-over-nfs.html
> https://stackoverflow.com/questions/1038788/cant-write-to-fifo-file-mouted-via-nfs

I'm aware of that.

But think about clusters of machines, or similar setups where many
machines from different architectures share one NFS filesystem, and
cooperatively work on that.
So for example a master machine sets up everything for the build
client machines, including generating FIFOs, which shall be used
locally on the client. But then... oopsie, client cannot use the FIFO
prepared by the cluster master, because it doesn't create the FIFO
mknod nodes the same way as other platforms.

Most of the concerns are about portability.

Thanks,
Martin

-- 
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: Compile win64 filesys kernel module only with Cygwin tools?

2023-08-10 Thread Martin Wege via Cygwin
On Wed, Aug 9, 2023 at 10:04 PM Hans-Bernhard Bröker via Cygwin
 wrote:
>
> Am 09.08.2023 um 21:17 schrieb Wendy Lin via Cygwin:
> > How can I compile
> > https://github.com/microsoft/Windows-driver-samples/tree/main/filesys/cdfs
> > with Cygwin gcc?
>
> You should not be trying to do that.
>
> That's deeply system-specific Windows code.  It has nothing to with
> POSIX, Cygwin or anything like that.
>
> For that you need a native Windows toolchain, and quite possibly some
> extra SDK packages from Microsoft to enable building them.  MinGW64
> (wether stand-alone, or the MSYS(2) hosted one, or the one hosted in
> Cygwin) might be able to do it.

I'd be very interested in this idea to (build *.sys kernel module with
minGW64). Has anyone ever tried to do that? Just from Googling PDB
(Windows Debug File Format) files will be absent, but that is all,
right?

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-09 Thread Martin Wege via Cygwin
On Wed, Aug 9, 2023 at 10:01 AM Corinna Vinschen
 wrote:
>
> On Aug  8 21:38, Martin Wege via Cygwin wrote:
> > On Tue, Aug 8, 2023 at 10:20 AM Corinna Vinschen
> >  wrote:
> > >
> > > On Aug  7 23:14, Martin Wege via Cygwin wrote:
> > > > On Mon, Aug 7, 2023 at 9:14 PM Corinna Vinschen
> > > >  wrote:
> > > > >
> > > > > On Aug  7 12:26, Brian Inglis via Cygwin wrote:
> > > > > > On 2023-08-07 08:42, Martin Wege via Cygwin wrote:
> > > > > > > We get a weird mkfifo failure in Cygwin on NTFS:
> > > > > > >
> > > > > > > /usr/bin/mkfifo -m 600 x.fifo
> > > > > > > mkfifo: cannot set permissions of 'x.fifo': Not a directory
> > > > > >
> > > > > > This error is also reproducible with default fifo permissions 666 or
> > > > > > anything else, and appears to be returned by gen_full_path_at() in
> > > > > > syscalls.cc when called with a fifo:
> > > > >
> > > > > This will be fixed in 3.4.8,
> > > >
> > > > Thank you
> > > >
> > > > > see
> > > > > https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=b56b4d7fd85b
> > > >
> > > > First, Can I download a beta of  3.4.8, or any other version with that
> > > > fix? It's pretty urgent
> > >
> > > You can install a test release of Cygwin, simply by using the setup tool
> > > These test releases are always created from the git main branch, though,
> > > so they are always test releases of the next major version, currently
> > > 3.5.0.
> >
> > Where can I download the Setup.exe tool for those test releases?
>
> You already have it: https://cygwin.com/install.html

Thanks

>
> > > > Secondly, how are fifos, other device nodes and mknod implemented? You
> > > > encode them as softlinks on ntfs?
> > >
> > > Not only on NTFS.  FIFOs on the disk are always created as symlinks
> > > with a special target string, recognized by Cygwin.  No differece on
> > > NFS.  Microsoft NFSv3 has no way to specify creating a "real" FIFO
> > > on the remote filesystem.  It wouldn't make sense anyway, because
> > > there's no way to share the FIFO across systems.
> >
> > So no Windows ioctl to do a mknod?
>
> Windows does not have provisions to store FIFOs on disk.  The closest
> you get in Windows are Windows named pipes, and those are stored
> non-permanently in a special, temporary filesystem inside the native NT
> namespace.  Try this in Cygwin:
>
>   $ cd /proc/sys/Device/NamedPipe/<-- trailing slash!
>   $ ls -l
>
> FIFOs in the normal Windows filesystem are a Cygwin fake.

Maybe make pipes in Cygwin symlinks to /proc/sys/Device/NamedPipe/?

> > What does a Linux/FreeBSD FIFO file look like, if you export that
> > filesystem via NFSv3, and mount it via the native Windows NFSv3
> > driver, and do a ls -l in Cygwin?
>
> It looks like a FIFO because MSFT NFSv3 exports the stat(2) info
> verbatim:
>
> linux$ mkfifo blubb
>
> cygwin$ ls -l blubb
> prw-r--r-- 1 corinna vinschen 0 Aug  8 10:22 blubb

Will cygwin treat this as a FIFO?

Can cygwin set the 'p' flag via a magic ioctl?

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-08 Thread Martin Wege via Cygwin
On Tue, Aug 8, 2023 at 10:20 AM Corinna Vinschen
 wrote:
>
> On Aug  7 23:14, Martin Wege via Cygwin wrote:
> > On Mon, Aug 7, 2023 at 9:14 PM Corinna Vinschen
> >  wrote:
> > >
> > > On Aug  7 12:26, Brian Inglis via Cygwin wrote:
> > > > On 2023-08-07 08:42, Martin Wege via Cygwin wrote:
> > > > > We get a weird mkfifo failure in Cygwin on NTFS:
> > > > >
> > > > > /usr/bin/mkfifo -m 600 x.fifo
> > > > > mkfifo: cannot set permissions of 'x.fifo': Not a directory
> > > >
> > > > This error is also reproducible with default fifo permissions 666 or
> > > > anything else, and appears to be returned by gen_full_path_at() in
> > > > syscalls.cc when called with a fifo:
> > >
> > > This will be fixed in 3.4.8,
> >
> > Thank you
> >
> > > see
> > > https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=b56b4d7fd85b
> >
> > First, Can I download a beta of  3.4.8, or any other version with that
> > fix? It's pretty urgent
>
> You can install a test release of Cygwin, simply by using the setup tool
> These test releases are always created from the git main branch, though,
> so they are always test releases of the next major version, currently
> 3.5.0.

Where can I download the Setup.exe tool for those test releases?

>
> > Secondly, how are fifos, other device nodes and mknod implemented? You
> > encode them as softlinks on ntfs?
>
> Not only on NTFS.  FIFOs on the disk are always created as symlinks
> with a special target string, recognized by Cygwin.  No differece on
> NFS.  Microsoft NFSv3 has no way to specify creating a "real" FIFO
> on the remote filesystem.  It wouldn't make sense anyway, because
> there's no way to share the FIFO across systems.

So no Windows ioctl to do a mknod?

What does a Linux/FreeBSD FIFO file look like, if you export that
filesystem via NFSv3, and mount it via the native Windows NFSv3
driver, and do a ls -l in Cygwin?

Thanks,
Martin

-- 
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: Find free drive letter in Cygwin?

2023-08-07 Thread Martin Wege via Cygwin
On Mon, Aug 7, 2023 at 8:43 PM Brian Inglis  wrote:
>
> On 2023-08-07 10:52, Martin Wege via Cygwin wrote:
> > What is the official cygwin way to find a free drive letter, which can
> > be used in a script to mount a drive?
>
> Just use the Windows UNC network path directly on Cygwin with '/' not '\'.
>
> For Windows, it may still be NET USE * \\... but have not used it in decades!
>
> Cygwin should pick it up and automount it under /proc/cygdrive/?/ but see
> disclaimer above.

So it would be a valid solution in bash to loop from a-z in
/proc/cygdrive/$letter/ and see whether this is a dir, right?

Thanks,
Martin

-- 
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: mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-07 Thread Martin Wege via Cygwin
On Mon, Aug 7, 2023 at 9:14 PM Corinna Vinschen
 wrote:
>
> On Aug  7 12:26, Brian Inglis via Cygwin wrote:
> > On 2023-08-07 08:42, Martin Wege via Cygwin wrote:
> > > We get a weird mkfifo failure in Cygwin on NTFS:
> > >
> > > /usr/bin/mkfifo -m 600 x.fifo
> > > mkfifo: cannot set permissions of 'x.fifo': Not a directory
> >
> > This error is also reproducible with default fifo permissions 666 or
> > anything else, and appears to be returned by gen_full_path_at() in
> > syscalls.cc when called with a fifo:
>
> This will be fixed in 3.4.8,

Thank you

> see
> https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=b56b4d7fd85b

First, Can I download a beta of  3.4.8, or any other version with that
fix? It's pretty urgent

Secondly, how are fifos, other device nodes and mknod implemented? You
encode them as softlinks on ntfs? What about Windows native NFSv3
driver, do you use native mknod then to create a fifo? Where can I
find the code in cygwin for that?

Thanks,
Martin

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


Find free drive letter in Cygwin?

2023-08-07 Thread Martin Wege via Cygwin
Hello,

What is the official cygwin way to find a free drive letter, which can
be used in a script to mount a drive?

Thanks,
Martin

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


mkfifo: cannot set permissions of 'x.fifo': Not a directory

2023-08-07 Thread Martin Wege via Cygwin
Hello,

We get a weird mkfifo failure in Cygwin on NTFS:

/usr/bin/mkfifo -m 600 x.fifo
mkfifo: cannot set permissions of 'x.fifo': Not a directory

Is there a known workaround? So far named fifos cannot be created somehow.

Thanks,
Martin

-- 
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: ms-nfs41 mount: Where does Unix_User+0 and Unix_Group+0 come from?

2023-08-03 Thread Martin Wege via Cygwin
On Fri, Aug 4, 2023 at 1:07 AM Martin Wege  wrote:
>
> On Thu, Aug 3, 2023 at 8:46 PM Martin Wege  wrote:
> >
> > Hello,
> >
> > We are working to deploy the ms-nfs41-nfs-filesystem on our Windows
> > machines, and encounter some issues with Cygwin (latest stable).
> >
> > For example, if we go to the ms-nfs41-nfs-filesystem (not the NFS
> > version 3 client from Windows!!!) with cd X: ; cd tmp/data9/, and do a
> > ls -l we get 'Unix_User+0' and 'Unix_Group+0' for user and group
> > names.
> > The question is: Where do these names come from - Windows,
> > ms-nfs41-nfs-filesystem or Cygwin?
> > getent passwd and getent group do not list this on Cygwin.
> > NFS version 4 server "lordbatman" has user mlw=uid(3620) and group 
> > mlw=gid(3620)
> >
> > Steps to reproduce:
> > 1. Download and install cygwin.
> > 2. Download http://www.citi.umich.edu/projects/nfsv4/windows/120612/
> > and install it.
> > 3. Start NFS version 4 client daemon:
> > ms-nfs41-client-x64/nfsd_debug.exe -d 3 --noldap --gid 3620 --uid 3620
> > 4. Mount NFS version 4 directory:
> > ms-nfs41-client-x64/ms-nfs41-client-x64/nfs_mount.exe -p -o sec=sys X
> > 'lordbatman.bias.dfn.de:/export/home/mlw'
> >
> > Expectation:
> > Cygwin ls -l should list file user/group as mlw/mlw
> >
> > Actual results:
> > Cygwin ls -l lists file user/group as Unix_User+0/Unix_Group+0
>
> Did a cygwin source clone, and found this:
> cygwin$ grep -r -E  'Unix_(User|Group)' .
> ./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group",
> ./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group",
> ./newlib-cygwin/winsup/utils/mkpasswd.c:"Unix_User",
> ./newlib-cygwin/winsup/utils/mkpasswd.c:
>
> But I do not understand this code. In which cases are Unix_User+0 and
> Unix_Group+0 used?

It just got more mysterious. I tried a ls -nl (uid, gid as numbers,
not names from /etc/passwd and /etc/group), and got this:
ls -nl
total 78474
-rwxr-xr-x 1 4278190080 427819008033063 Aug  3 12:02 CMakeCache.txt
drwxr-xr-x 1 4278190080 4278190080  374 Aug  3 12:51 CMakeFiles
-rwxr-xr-x 1 4278190080 4278190080 4790 Aug  3 12:02 CPackConfig.cmake
-rwxr-xr-x 1 4278190080 4278190080 5276 Aug  3 12:02 CPackSourceConfig.cmake
-rwxr-xr-x 1 4278190080 4278190080  440 Aug  3 12:03 CTestTestfile.cmake
-rwxr-xr-x 1 4278190080 427819008077004 Aug  3 12:03 Makefile

So where does the "4278190080" come from, for uid and gid? Hexadecimal
its 0xff00, which might be related to this:
./newlib-cygwin/winsup/cygwin/local_includes/security.h
/* For UNIX accounts not mapped to Windows accounts via winbind, Samba returns
  SIDs of the form S-1-22-x-y, with x == 1 for users and x == 2 for groups,
  and y == UNIX uid/gid.  NFS returns no SIDs at all, but the plain UNIX
  uid/gid values.

  UNIX uid/gid values are mapped to Cygwin uid/gid values 0xff00 +
  unix uid/gid.  This *might* collide with a posix_offset of some trusted
  domain, but it's *very* unlikely.  Define the mapping as macro. */
#define UNIX_POSIX_OFFSET   (0xff00)
#define UNIX_POSIX_MASK (0x00ff)
#define MAP_UNIX_TO_CYGWIN_ID(id)   (UNIX_POSIX_OFFSET \
| ((id) & UNIX_POSIX_MASK))

But why is it then Unix_User+0 and not Unix_User+3620 on Windows NFS?
Same for Unix_Group+0 vs Unix_Group+3620?

Martin

-- 
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: ms-nfs41 mount: Where does Unix_User+0 and Unix_Group+0 come from?

2023-08-03 Thread Martin Wege via Cygwin
On Thu, Aug 3, 2023 at 8:46 PM Martin Wege  wrote:
>
> Hello,
>
> We are working to deploy the ms-nfs41-nfs-filesystem on our Windows
> machines, and encounter some issues with Cygwin (latest stable).
>
> For example, if we go to the ms-nfs41-nfs-filesystem (not the NFS
> version 3 client from Windows!!!) with cd X: ; cd tmp/data9/, and do a
> ls -l we get 'Unix_User+0' and 'Unix_Group+0' for user and group
> names.
> The question is: Where do these names come from - Windows,
> ms-nfs41-nfs-filesystem or Cygwin?
> getent passwd and getent group do not list this on Cygwin.
> NFS version 4 server "lordbatman" has user mlw=uid(3620) and group 
> mlw=gid(3620)
>
> Steps to reproduce:
> 1. Download and install cygwin.
> 2. Download http://www.citi.umich.edu/projects/nfsv4/windows/120612/
> and install it.
> 3. Start NFS version 4 client daemon:
> ms-nfs41-client-x64/nfsd_debug.exe -d 3 --noldap --gid 3620 --uid 3620
> 4. Mount NFS version 4 directory:
> ms-nfs41-client-x64/ms-nfs41-client-x64/nfs_mount.exe -p -o sec=sys X
> 'lordbatman.bias.dfn.de:/export/home/mlw'
>
> Expectation:
> Cygwin ls -l should list file user/group as mlw/mlw
>
> Actual results:
> Cygwin ls -l lists file user/group as Unix_User+0/Unix_Group+0

Did a cygwin source clone, and found this:
cygwin$ grep -r -E  'Unix_(User|Group)' .
./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group",
./newlib-cygwin/winsup/utils/mkgroup.c: "Unix_Group",
./newlib-cygwin/winsup/utils/mkpasswd.c:"Unix_User",
./newlib-cygwin/winsup/utils/mkpasswd.c:

But I do not understand this code. In which cases are Unix_User+0 and
Unix_Group+0 used?

Martin

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


ms-nfs41 mount: Where does Unix_User+0 and Unix_Group+0 come from?

2023-08-03 Thread Martin Wege via Cygwin
Hello,

We are working to deploy the ms-nfs41-nfs-filesystem on our Windows
machines, and encounter some issues with Cygwin (latest stable).

For example, if we go to the ms-nfs41-nfs-filesystem (not the NFS
version 3 client from Windows!!!) with cd X: ; cd tmp/data9/, and do a
ls -l we get 'Unix_User+0' and 'Unix_Group+0' for user and group
names.
The question is: Where do these names come from - Windows,
ms-nfs41-nfs-filesystem or Cygwin?
getent passwd and getent group do not list this on Cygwin.
NFS version 4 server "lordbatman" has user mlw=uid(3620) and group mlw=gid(3620)

Steps to reproduce:
1. Download and install cygwin.
2. Download http://www.citi.umich.edu/projects/nfsv4/windows/120612/
and install it.
3. Start NFS version 4 client daemon:
ms-nfs41-client-x64/nfsd_debug.exe -d 3 --noldap --gid 3620 --uid 3620
4. Mount NFS version 4 directory:
ms-nfs41-client-x64/ms-nfs41-client-x64/nfs_mount.exe -p -o sec=sys X
'lordbatman.bias.dfn.de:/export/home/mlw'

Expectation:
Cygwin ls -l should list file user/group as mlw/mlw

Actual results:
Cygwin ls -l lists file user/group as Unix_User+0/Unix_Group+0

How do we fix this?

Thanks,
Martin

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