X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8037385843A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1671621351;
	bh=fLvS7X4rC8cuMMfR2Od967KRboDWeg/t1W12/TQCQLc=;
	h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=dIAKnyfzcAFDvCmvQz5wAUKxBcmPDl+SJ1b1X1gAzUKeQEQR85AU7NsNb6EkANnP8
	 AADLr5hpdwrDy5Cr0mzUPeOCy8eSAUdGkRbt8atbofFxsqpfDwvxDGGBX0Qa+5++GC
	 1LcEW23mP6S8JgYOtUwB3u17DvA8N5Rv8Hkg8Ma4=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 19A1E3858D1E
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-Spam-Language: en
X-Spam-Relay-Country: 
X-Spam-DCC: B=; R=smtp1.atof.net 1102; Body=1 Fuz1=1 Fuz2=1
X-Spam-RBL: 
X-Spam-PYZOR: Reported 0 times.
Date: Wed, 21 Dec 2022 06:15:27 -0500
To: cygwin@cygwin.com
Subject: open /dev/null O_NOFOLLOW fails with ELOOP
Message-ID: <Y6Lqz3O1AcAPjBRu@xps13>
Mime-Version: 1.0
Content-Disposition: inline
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
 SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: "gs-cygwin.com--- via Cygwin" <cygwin@cygwin.com>
Reply-To: gs-cygwin.com@gluelogic.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>

open /dev/null O_NOFOLLOW fails with ELOOP

Windows 10, 64-bit cygwin

Failed with my existing install, then I ran setup.exe, updated to
latest, and my tests still failed.

a.c
---

#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>

int main (void)
{
    int fd = open("/dev/null", O_RDWR | O_NOFOLLOW, 0);
    if (fd < 0)
        perror("open(/dev/null)");
    return fd;
}


$ gcc a.c ; ./a.exe
open(/dev/null): Too many levels of symbolic links

While troubleshooting this, there were times where it succeeded and then
times where it failed, though it failed most of the time.  It did not
fail (or succeed) randomly, but seemingly in streaks.

Trying to start lighttpd seems to run into this bug reliably,
  $ /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
In the next release of lighttpd, I may end up omitting O_NOFOLLOW
if __CYGWIN__ is defined.

Cheers, Glenn

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