Hello raf,

On 9/6/2026 10:33 PM, raf via Cygwin wrote:
Hi,

This is on Win10.

I have a seemingly impossible problem with fstatat following a symlink to
a fifo. Most of the resulting struct stat correctly contains details of the
fifo except for the st_mode field. It contains the type and permissions
of the symlink itself.

I assume I must be doing something wrong but the same code works on
six other operating systems.

Any idea what the cause might be? My tests relating to this have been
failing for ages, and I just accepted that this wierd little case just
might not work on Cygwin, but looking into it closely shows that it
almost does work, just not quite.

Actually, the same problem happens with stat(1), not just my program.
Here's a demonstration:

   mkdir t
   cd t
   mkfifo fifo
   sleep 5
   ln -s fifo symfifo
   stat symfifo fifo
   stat -L symfifo
   cd ..
   rm -r t

The above commands show this ouptut:

   $ stat symfifo fifo
     File: symfifo -> fifo
     Size: 4               Blocks: 0          IO Block: 65536  symbolic link
   Device: 15518,20572     Inode: 7599824372130494  Links: 1
   Access: (0777/lrwxrwxrwx)  Uid: (197609/    john)   Gid: (197121/    None)
   Access: 2026-09-07 15:25:50.209111800 +1000
   Modify: 2026-09-07 15:25:50.209111800 +1000
   Change: 2026-09-07 15:25:50.209111800 +1000
    Birth: 2026-09-07 15:25:50.209111800 +1000
     File: fifo
     Size: 0               Blocks: 1          IO Block: 65536  fifo
   Device: 0,196   Inode: 8162774325551800  Links: 1
   Access: (0666/prw-rw-rw-)  Uid: (197609/    john)   Gid: (197121/    None)
   Access: 2026-09-07 15:25:49.754243600 +1000
   Modify: 2026-09-07 15:25:43.732451800 +1000
   Change: 2026-09-07 15:25:43.732451800 +1000
    Birth: 2026-09-07 15:25:43.732451800 +1000
$ stat -L symfifo
     File: symfifo -> fifo
     Size: 4294953488      Blocks: 1          IO Block: 65536  symbolic link
   Device: 0,196   Inode: 8162774325551800  Links: 1
   Access: (0777/lrwxrwxrwx)  Uid: (197609/    john)   Gid: (197121/    None)
   Access: 2026-09-07 15:25:53.970058800 +1000
   Modify: 2026-09-07 15:25:43.732451800 +1000
   Change: 2026-09-07 15:25:43.732451800 +1000
    Birth: 2026-09-07 15:25:43.732451800 +1000

Note that the last command that follows the symlink
states that the fifo is a "symbolic link" rather than "fifo"
and permissions "0777/lrwxrwxrwx" rather than "0666/prw-rw-rw-".

Is this fixable? Or is it just this pc?

I've reproduced this locally, so it's not your pc ;-). What version of Cygwin are you running on your Windows 10 machine?

I've also reproduced this on Cygwin 3.3.6, which is pretty old. You may have just run into a bug that has gone undiscovered for a long time. I'll look into investigating and patching this issue.
Thanks for the report,

..mark


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

Reply via email to