delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/09/07/01:34:24

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 6875YOtN597619
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 6875YOtN597619
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=WasZYERq
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 615924BC7ECC
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1788759263;
bh=LpC7pNK8QKBU7dH1Cbm9/ErxHfksgiTbPShfbjt7f+I=;
h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=WasZYERq22cIG15ceLJoHRlwZBQP26qAZMLb10RXjXY5nuGU+pQEmeuE6jGmdi/ko
DLW9vfy3M3VqTTi4kkRz0FqrozpRRi+RqeRmCUrhy2nnWJUYY4DIjfMp4fqUs7NxFn
8iNXGyExmLPLuisAmSqXuXlSjOjEaR3eRatgVXBM=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA2804BC0550
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA2804BC0550
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788759216; cv=none;
b=WrWJj4jqG0pLEPpMTiW1sKyaNKmXQa5QWKH5jOyV54taFZeHGVGlKTbcxwJWG0x3K7cEmi3vPil4B9gPshkAn3y2SGYKIXankdpVH+jmhg9FoUmxtoTaBw2fePsc+/lI1KwoVaVdpr5qvaubG0FaFW2SKTaDtvmCiO2kVxWi51s=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1788759216; c=relaxed/simple;
bh=g53jpz4XKL9ZKLniUYVfTNa/UErxOAiTW8Qeygrd8OI=;
h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;
b=MTy79IiDzuTlN/bZm3GjIB1USJZbcMgANOm3gv/sYHkfCKmHxd63pIPPfK3/xaO3U/wo+M2bKEN3uVqb6TR/E5OnmQYJ1EcA574uoS2BaiH2QpMzqNzggiamPG2pDdjqAW+FWuYEDWxNa6wdzZP0gsorfsOpMlhYfg61nSngiso=
ARC-Authentication-Results: i=1; sourceware.org;
dkim=pass (2048-bit key, secure) header.d=raf.org
header.i=@raf.org header.a=rsa-sha256 header.s=001 header.b=Pm23aaHE
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA2804BC0550
X-Virus-Scanned: Debian amavis at ook.raf.org
Date: Mon, 7 Sep 2026 15:33:17 +1000
To: cygwin AT cygwin DOT com
Subject: fstatat of symlink to fifo gets st_mode from symlink, not from fifo
Message-ID: <ap5MnTuoylBGxwBm@raf.org>
Mail-Followup-To: cygwin AT cygwin DOT com
MIME-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: raf via Cygwin <cygwin AT cygwin DOT com>
Reply-To: raf <cygwin AT raf DOT org>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

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?

cheers,
raf


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2026   by DJ Delorie     Updated Sep 20 2026