From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3352 invoked from network); 11 Dec 2022 20:01:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Dec 2022 20:01:49 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1670788909; b=ibZMHj3JVmkx6ZFmQddj9IfFNLqGjasCqVrb8N6iy7Yfn1QVtD3V897oAi9N/geZTKTuGWeW8i gY6iCyuQzcJtttAvkizab8IMTG86GouBQCNee0z3YiyyjaH2rEvjDJc/hGSkp/Z2QN/4AFeIwQ SqmFKjli+hR242drga4tZtZAPLEop15/8ZsOZc0BPjcEwV3KAiUAuVztI1WiF/WCDVpMozMPFs nDLQfCrua2aFhATT/3TH3e2URR5nmi0iVGj+kROsCglLktRAWUlKHGqBk4G0B94mti95vTsq+0 t6tppueryBNxoJuzswg2CIyTEdXrMvAlp8jZX5YN9c24MQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay10.mail.gandi.net) smtp.remote-ip=217.70.178.230; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1670788909; bh=MOzsy9r4duXjMS9Svwgxhso3jRO6Y0TP9kNBzpkO8Xc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=YhEaDnuhtcJPDMe8U/cy8RXAUZOBP3HFZOx+7R09xWvj+ztOtnz0dhI2L7eJwUAZ0uPwD0z85t QtfcTmnwKQWZPOiVDv39OvhantCG1r5q++Qk/Bir7pLkoaqvoBnQtYphWHvCjUJzmM7EHvWbMa ZuSTHLSsrJPKg+StH/YUdtcw0jau4tzrXkRkqAq1R7H/UJOUHYkteXGJ2+B7Bk2O1Pzv+9krkP gjIsI2Ty0RKuegrpQSPTTFGYJHn3DGPaNim5gzUTSl7t7LeB1KymFi9IDxIn3QsLTnqXLJ5Dds JRT/jxJHgNSax/jrmsF51qRDJ52/Pv2Ifj7N+CzkDUiizA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Icq/Z8BgKzLA7/oU7Bzwki3s1h+0l+hnhke6BNW9pkY=; b=JjEMFOlHGsdN/0VmvezLZMHy1/ aaIDVWuyF3dqA54pPrPGJBxjzuFXSJLE/LxuNKOYgdBgYkCil4z3Sjz0lcEt7wotcP8kNVko6s05P 6AEGk6su+Nl2ethp2gL/1NxzVm9Sbhg/A+2t05wzKOBCFX5GQ5senErxFBky39cQnw8fOdHQlD4sA RUfeLhVOe216YS+f9cV+qTYxxapatGo8YUf8xaCGY7vMti+3AvGfVHWc/97+9mz51Nr6l0S+mFwgI nsRzBt1oPbOz5wCJ+ee3xehxWYeALIUSxau9ePklFf5xY/RFoboJhRzh/YnRSMmLbNV4NtS5Z0WWC quDVkiDw==; Received: by zero.zsh.org with local id 1p4SWC-0006uA-VO; Sun, 11 Dec 2022 20:01:48 +0000 Authentication-Results: zsh.org; iprev=pass (relay10.mail.gandi.net) smtp.remote-ip=217.70.178.230; dmarc=none header.from=chazelas.org; arc=none Received: from relay10.mail.gandi.net ([217.70.178.230]:41701) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1p4SVz-0006az-NE; Sun, 11 Dec 2022 20:01:36 +0000 Received: (Authenticated sender: stephane@chazelas.org) by mail.gandi.net (Postfix) with ESMTPSA id 70EC8240002; Sun, 11 Dec 2022 20:01:34 +0000 (UTC) Date: Sun, 11 Dec 2022 20:01:33 +0000 From: Stephane Chazelas To: Bart Schaefer Cc: Daniel Shahaf , zsh-workers@zsh.org Subject: Re: xtrace output sets ERRNO to 9 (EBADF) Message-ID: <20221211200133.v5ih3ss2hx24lp4x@chazelas.org> Mail-Followup-To: Bart Schaefer , Daniel Shahaf , zsh-workers@zsh.org References: <20221209141047.oyv3jsdvo5s3z6m6@chazelas.org> <20221210113813.GX27622@tarpaulin.shahaf.local2> <20221211183546.ogwicuctgxbtit6w@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 51190 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: 2022-12-11 10:52:44 -0800, Bart Schaefer: [...] > In any case, > fileno() doesn't set errno (it's just a data structure deref, would > only fail by crashing) Not that it matters much here, but POSIX does say that fileno() shall return -1 EBADF if "The stream is not associated with a file." and may if "The file descriptor underlying stream is not a valid file descriptor." https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/fileno.html musl libc has: int fileno(FILE *f) { FLOCK(f); int fd = f->fd; FUNLOCK(f); if (fd < 0) { errno = EBADF; return -1; } return fd; } -- Stephane