From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127277 invoked by alias); 15 Apr 2016 16:27:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 127241 invoked by uid 89); 15 Apr 2016 16:27:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hallyn, serge, ttynamehtml, passedin X-HELO: mx1.redhat.com Subject: Re: [PATCH 1/1] linux ttyname: return link if appropriate To: Serge Hallyn References: <20160415152929.GA7932@ubuntumail> From: Florian Weimer Cc: libc-alpha@sourceware.org Message-ID: <5711165D.5040902@redhat.com> Date: Fri, 15 Apr 2016 16:27:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160415152929.GA7932@ubuntumail> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00394.txt.bz2 On 04/15/2016 05:29 PM, Serge Hallyn wrote: > The current ttyname does the wrong thing in two cases: > > 1. If the passed-in link (say /proc/self/fd/0) points to a > device, say /dev/pts/2, in a parent mount namespace, and a > /dev/pts/2 exists (in a different devpts) in the current > namespace, then it returns /dev/pts/2. But /dev/pts/2 is > NOT the current tty, it is a different file and device. Is this the first change? > 2. If the passed-in link (say /proc/self/fd/0) points to > a device, say /dev/pts/2, in a parent mount namespace, and > /dev/pts/2 does not exist in the current namespace, it > returns success but an empty name. As far as I can tell, > there is no reason for it to not return /proc/self/fd/0. > http://pubs.opengroup.org/onlinepubs/009695399/functions/ttyname.html > does not say anything about not returning a link. Is it safe to drop the verification that ttyname ordinarily would do? ttyname_r will need a similar change. Florian