public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Roland Mainz <roland.mainz@nrubsig.org>
To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>
Subject: 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
Date: Fri, 25 Aug 2023 17:14:42 +0200	[thread overview]
Message-ID: <CAKAoaQmHFgo3xFoZdkyjL9ft-ibyTk4r_KYnUiNGvbJGFe-uUw@mail.gmail.com> (raw)
In-Reply-To: <ZOicD/nxECrAPnKV@calimero.vinschen.de>

On Fri, Aug 25, 2023 at 2:18 PM Corinna Vinschen via Cygwin
<cygwin@cygwin.com> 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

I know.

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

I think most issues have been fixed for the Microsoft NFSv3 client,
and for the CITI NFSv4.1 client (technically it's called
"ms-nfsv41-client") the situation is even better since it's
opensource, and we can fix problems even faster there.
From what I see the ms-nfsv41-client is stable enough for daily
routine usage, and I know that other institutions like DFG and CERN
use it for daily work too. The only nasty part is the damn lack of
documentation, and that there are no signed binaries, so any kernel
with UEFI/SecureBook cannot use them.

> Anyway.  How would you like to make sure that a Cygwin application
> can differ between real FIFOs and Cygwin FIFOs?

For now I can provide a migration script, and in the medium term we
should get Microsoft to provide some kind of |mknod()| API. see below.

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

See below.

> > 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.
>
> Even better would be if we could just create and use real FIFOs
> on NFS(*).  But while NtQueryEaFile can be used to fetch real
> NFS file info, and while NtCreateFile can be used to create real
> synmlinks via NFS, I don't see an interface resembling mknod/mkfifo.

Looking at the ms-nfs41-client source code, there is no API for that *YET*.

So my plan would be like this:
1. Cygwin: implements the proposed devnodes-as-symlink emulation code,
if the env var CYGWIN has "nfs_emulate_dev_special_files_as_symlink"
set
2. Cygwin: By default |mkfifo()| will fail with |ENOSYS| (not |EPERM|,
as we intend to fix the issue!) on NFS filesystems, unless
CYGWIN=nfs_emulate_dev_special_files_as_symlink
3. (CITI) ms-nfsv41-client: adds a private API to do a |mknod()|
4. Cygwin: Implements the new API added in [3] as *prototype*, so
|mknod()| will properly work in a portable manner
5. We ask Microsoft to review the private API created in [3], and ask
them to implement it for the Microsoft NFSv3 client too (because we
have a precedent with [4]!)

Optional:
6. Cygwin: Like [1] add  "afs_emulate_dev_special_files_as_symlink" to
do the same for AFS
7. Cygwin: Like [2] |mkfifo()| should fail on AFS, unless [6] ...

Issues:
- [6] and [7] should be decided by the owner of the Microsoft AFS
filesystem driver.
- Should the new Windows NFS mknod-API be only available for accounts
with administrator rights/permissions ?

----

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

  parent reply	other threads:[~2023-08-25 15:15 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 14:42 Martin Wege
2023-08-07 18:26 ` Brian Inglis
2023-08-07 19:14   ` Corinna Vinschen
2023-08-07 21:14     ` Martin Wege
2023-08-08  8:20       ` Corinna Vinschen
2023-08-08 19:38         ` Martin Wege
2023-08-09  8:01           ` Corinna Vinschen
2023-08-09  9:12             ` Martin Wege
2023-08-09  9:56               ` Corinna Vinschen
2023-08-10 12:49                 ` Martin Wege
2023-08-18  4:02 ` Martin Wege
2023-08-18  8:34   ` Corinna Vinschen
2023-08-18 13:14     ` Martin Wege
2023-08-21  4:49     ` Cedric Blancher
2023-08-21  8:37       ` Corinna Vinschen
2023-08-22 14:52         ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-22 23:05           ` How to fix |mkfifo()| failure if |pathname| is on NFS ? / was: " Roland Mainz
2023-08-24 16:45             ` Martin Wege
2023-08-25  4:25               ` Cedric Blancher
2023-08-26 17:58               ` Martin Wege
2023-08-25 12:18             ` Corinna Vinschen
2023-08-25 12:25               ` Corinna Vinschen
2023-08-26 11:26                 ` Cedric Blancher
2023-08-26 14:15                   ` Corinna Vinschen
2023-08-26 17:40                     ` Martin Wege
2023-08-26 19:16                       ` Brian Inglis
2023-08-25 15:14               ` Roland Mainz [this message]
2023-08-26 11:27                 ` Cedric Blancher
2023-08-25 23:21               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-26 14:28                 ` Corinna Vinschen
2023-08-26 14:39                   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-26 17:44               ` Documenting Cygwin on NFS, no longer only exchange-medium! " Martin Wege
2023-08-26 19:16                 ` Brian Inglis
2023-08-27 12:35                 ` Corinna Vinschen
2023-08-28  5:35                   ` Cedric Blancher
2023-08-28 10:02                     ` Corinna Vinschen
2023-08-28 11:41                   ` Joshuah Hurst
     [not found]           ` <14a692f6-7244-4a7e-a69b-d14521fb01e8@secure-endpoints.com>
2023-08-23 17:39             ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-08-24  5:28             ` Cedric Blancher
2023-08-24 16:40             ` Martin Wege
2023-08-21 12:12     ` Martin Wege

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKAoaQmHFgo3xFoZdkyjL9ft-ibyTk4r_KYnUiNGvbJGFe-uUw@mail.gmail.com \
    --to=roland.mainz@nrubsig.org \
    --cc=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).