From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6077 Path: news.gmane.org!not-for-mail From: Justin Cormack Newsgroups: gmane.linux.lib.musl.general Subject: Re: Add login_tty Date: Thu, 4 Sep 2014 23:31:13 +0100 Message-ID: References: <20140825185756.GA6077@euler> <20140825224333.GX12888@brightrain.aerifal.cx> <20140826165627.GA1208@euler> <20140904212159.GG10361@port70.net> <20140904213334.GF23797@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1409869894 23254 80.91.229.3 (4 Sep 2014 22:31:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Sep 2014 22:31:34 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-6090-gllmg-musl=m.gmane.org@lists.openwall.com Fri Sep 05 00:31:28 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1XPfYs-0006Tx-MS for gllmg-musl@plane.gmane.org; Fri, 05 Sep 2014 00:31:26 +0200 Original-Received: (qmail 28051 invoked by uid 550); 4 Sep 2014 22:31:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 28040 invoked from network); 4 Sep 2014 22:31:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=specialbusservice.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=U2Bgca8lFtRykyxwrRkAk/CJfRYkkZnFLrnhmxwVrus=; b=rF/9W658hpExGdjrfVRaa2SAVsIfVgGAdUuMYnj5FvwkgLBx+QyYi7cv8X7kcSDNQ8 xieUiRq2LAu5G87Tevw14akpmTFXdLG3ETANA0v6jbiHy5AyqRj32tPAV41orF+AAR65 p9+rGJCgsj/dgq/foiF4glbNOT2YLj2SGUI9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=U2Bgca8lFtRykyxwrRkAk/CJfRYkkZnFLrnhmxwVrus=; b=FU16Epc4/evu3Y51a7gzDcYCzeuop0iswXR/JU9TUfxIYEAuU7mE+wGVfOBRuTKZC9 FRB259I/s1qlknMBzNkqSZ1Lu9rsKOItOBNkhkItxkb4YUW4pGn1DeGJ9D/BqJxmPZM1 Kn3DPtex6UlPX+nEyZMv/KuQ6GkoGSl3CIXf2p2nqgoLAtU0udGYpBq4+T3c3LpfYro+ t/YzuohcDvF37S38XFx7c5oP9hdg+Ktr/yqzkxIIagaevG0jf5Jlij0txevydJaeSnc5 Zs3Rxcw5iQadSMDZ/GfRnk5EcphU/QAez3AMQ84QU3uJXiSD9Rcr1KA5S3QbuAgmPaMw SJeg== X-Gm-Message-State: ALoCoQnI4/+Oy0Vw4UUW0hGlzfXbXBi0LSxQyzxpSA9K3Un7jfDcoJkR3dFqc0OHPiEKLW8osGPk X-Received: by 10.152.9.170 with SMTP id a10mr7453010lab.79.1409869873509; Thu, 04 Sep 2014 15:31:13 -0700 (PDT) In-Reply-To: <20140904213334.GF23797@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:6077 Archived-At: On Thu, Sep 4, 2014 at 10:33 PM, Rich Felker wrote: > Actually, musl's dup2 already accounts for the issue by looping > internally, but I'm thinking we should remove that. POSIX does not > forbid dup2 from failing when you do something idiotic like this > (actually, like I said, I think it's morally UB), but it does demand > that open and dup2 be atomic with respect to each other for regular > files, whereas the loop would delay indefinitely a thread calling dup2 > on a file descriptor for which another thread is stuck in > uninterruptible sleep trying to open (e.g. slow/dead NFS). > > Any thoughts on whether/how this should be changed? Both FreeBSD and NetBSD block indefinitely on dup2 running the example code, and this behaviour does not seem wholly unreasonable. But removing the loop in Musl seems right, and having a note in the man page saying if you get EBUSY you did something stupid, so abort on this seems best. Justin