From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 75126247B5 for ; Tue, 5 Mar 2024 23:20:11 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1709677211; b=P3psRTTbdIBpEmpORhGFcU2S8Z1aPqs/OEko1IE3zMf5q3nbJqNfT+voZhi9UY2ZP1qVrFiuvp RwdFBUk4/r/n/eC9f9nIZAkurtaTGlanI1yT+vz3dKlFdfRE3zWZ4HhxBJGtNgeBj8VYBepb9N 3qHnzNpMO0ZJ2oUMftvTOeb0bO/6AKSuJa6lbd6w5cg7ykCSf4oV1dS6hyYqKifhitFeu0Bb6l 1bNo6uYfDluOk0CPraLRZd7OuT1dYuFGxhBm5rOpUekojNn4vQGIPtkyrejipa3WIAfLOeYvUC 9Aur0SBpwTxu4gNUDQxDipz+rHhimBUXcmpiHBJM4M8Hvg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mslow1.mail.gandi.net) smtp.remote-ip=217.70.178.240; 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=1709677211; bh=Xj16ZoeKz1t3cY6Ynv5Of5oJLv7d5PrDWphoUN5Ll9c=; 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=buzj+xhVX+9XNpRq001zu9wOh2KR1O5soau9vJu4q0YH5p1Jqz59yCc1nC0xqw+hTNq+7HNDTz gbASZbjf8arU/qv8TLfu66fOlBaqSVfNSmgFT9Msm8Nniqo8lpwqIg/t8Zps1dyJVfMV5VijDI pRfha9MjREdtjv4jg8BWjNE6lNptawjFL8r1tAHg9Hy+ex6CtT7y4Yjx4IRSsU24Jj5hIBKzdG cL3WOMYflofdg2ByWrP24/LLwI57aPG1qeXjbsJzmTLLRdup6itpf150gY8GC8Y4XeFnmOHKRP 7HbvOz9a9DYwGHBlvWL3tI6czPEWNraW9pzrxANB7OVhhA==; 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=G+FK/s7iTCkKaszuuCBAdN/LeFm0LpgKg9Abc/Fs+Yc=; b=H4T9N5XAV8yENsIkSR6RN0WR6K zvauGsFieWeUHa6EznbEAXBwCCwlxxLM6v3viJke/weUnWkkfHk2PjSWUdWoO1rHm74vLrNAuJ+Ji wRZGBgIN2q4qVl/BUpJyJeJV9NCn8HlBzQFZNybcqa0qZiC/02f5qJqb3txPnMYOzKFqVGqIz0gCn IQu/Ai6VmER8P/FyPWkGrHAldvFci91C8dgjpcliNUsLA5b9+UO55lNNDOz/DvdVfQNqIpPC8YfxP SWt72iYvW0nuHYK6oSYQWHzYEd5fU23nUoVUin3VqxRRUF5R8wp1ElCouOjE903BvY5D8yHev+ThN FdGfZYow==; Received: by zero.zsh.org with local id 1rhd8t-0003Zk-QU; Tue, 05 Mar 2024 22:20:11 +0000 Authentication-Results: zsh.org; iprev=pass (mslow1.mail.gandi.net) smtp.remote-ip=217.70.178.240; dmarc=none header.from=chazelas.org; arc=none Received: from mslow1.mail.gandi.net ([217.70.178.240]:48209) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1rhd8e-0003FK-CJ; Tue, 05 Mar 2024 22:19:56 +0000 Received: from relay9-d.mail.gandi.net (unknown [IPv6:2001:4b98:dc4:8::229]) by mslow1.mail.gandi.net (Postfix) with ESMTP id 5DC65C1D4C for ; Tue, 5 Mar 2024 19:39:06 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 21071FF804; Tue, 5 Mar 2024 19:38:42 +0000 (UTC) Date: Tue, 5 Mar 2024 19:38:40 +0000 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: [PATCH] Fix crash on unset-through-nameref Message-ID: <20240305193840.vvixetyn6vfnbir2@chazelas.org> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20240304062914.kn6wquvgog3lefom@chazelas.org> <20240304193409.lv725ah6eifiazzx@chazelas.org> <20240305081859.r3qwiyduk2wgkdby@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-GND-Sasl: stephane@chazelas.org X-Seq: 52689 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: 2024-03-05 10:42:18 -0800, Bart Schaefer: [...] > > I hate to say this but it seems to me that if this kind of issue > > is not fixable, then it would likely be preferable (from a > > consistency PoV at least) to go for bash/mksh dumber approaches > > where namerefs are just plain scalar variables containing the > > name of another variable (or other lvalue) and having the target > > variable resolved any time the nameref is assigned/referenced > > That is in fact exactly how it works, with the addition now that -u > makes it skip upward one scope before resolving. [...] Well, not in the: $ ./Src/zsh -c 'f() { typeset -n ref=var; local var=1; echo $ref; }; var=0; f' 0 Which IMO is better than $ bash -c 'f() { typeset -n ref=var; local var=1; echo $ref; }; var=0; f' 1 $ mksh -c 'f() { typeset -n ref=var; local var=1; echo $ref; }; var=0; f' 1 But is IMO somewhat inconsistent with: $ ./Src/zsh -c 'f() { nameref ref=var; local var=1; echo $ref; }; f' 1 -- Stephane