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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30874 invoked from network); 9 Nov 2020 07:28:03 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 9 Nov 2020 07:28:03 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1604906883; b=vfYVN1Lwh9hCE4wRDpHGdbIsa956xVsNwPJufkefg58+eBbfuq9Nqop2YlnVo3ReGd9banrHgn a2WmcLi47BY/sFg/V76pBXE0G2FcoyCWDq8Iv0NfwEkbwuniuZH3cocoazqIlQOggE1hoxwf4N XU7pK/xJpSt9vbw+6K8JYAu5fqfJzsqfJ6F9lb5RNLw02I9qVuhK9Idz2yl/kdPq7xk8fyDKah MIzWGz99IHCLq/iAssgrvX35/az+0v7XVdzQPWCRlEEFO3c6rEgCttKI3SfeYqH8xKTfqRWfH/ SNehIsDSZlRtqp2MOV5VkOsAP29FRkZVoQnaa/RMBIZBOg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay3-d.mail.gandi.net) smtp.remote-ip=217.70.183.195; dmarc=none header.from=waegenei.re; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1604906883; bh=iqWFJlI3pE/LzwbUbeVePlA16mTmcb8D1xmCvnDcj8c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:Subject:To:From:Date:Content-Transfer-Encoding: Content-Type:MIME-Version:DKIM-Signature; b=G+1hPrXaVP6WXxJs00wFSlj7U5rA4Rm7rv3sfRqhE3FEM8a1AQKIjnazrLeZH0FhnbE3+dzX1v Gn8j0r1CSBP12xxXsfCIWqNqR6BH70LCyuFWfVrjEPz3xioOZi1xRMTWvmhqTCO9wwebZnTO1/ msMRv/+kWZPYXQB2taNkv0/Jn6qFy0v55WNusx2NiSeecanUXOMfj8sWYRPGayWTwyYLfWMleV nW40Dm/ZxBEGZq+DAyZTVAAFFDTN4cXHFHt0MyXKmNxsJksHU/a7KwSTdNf516tO/f7Zokztux fDEPBq+4U+M7I9UQzWgArDAWgbESXTNnmvhGnB4+rPdNAA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-ID:Subject:To:From:Date: Content-Transfer-Encoding:Content-Type:MIME-Version:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=5lVedDaoU/Ta1bS+KFc1Jn6BXUElRMCCujX9BalN/KE=; b=kcyke4wT3iVRExIh/J5Zal2Jj3 dhBBd1NAicDF2/2WBb63P1uyoxQRnLw81DLFNXNZUQMkZrBazJ9nf17EXBd96a7ExPQFQOeNF04Lu fVBzVI3GsfgwnNxWFZEkwx2sE9OyVw9uxQ2tbdobFgbQ/PwCzInBl0BlnPQF7qHppzwedU1Kh63Wh ye4Cfqhf7eji7pKhFtYpK/F9PDLO19pAP3KopsrcBDRmSwYScBR5CVoDmfkQLxuazJrJL+gfQwLO2 mIES7Yke6zV2TkWvb4eQuox66pAScivyLMC9S5Xinoehz4A8usw1hNybJ744NtUlwsq1b6t+XdoIt S4L8lafQ==; Received: from authenticated user by zero.zsh.org with local id 1kc1am-000Dhw-8x; Mon, 09 Nov 2020 07:27:56 +0000 Authentication-Results: zsh.org; iprev=pass (relay3-d.mail.gandi.net) smtp.remote-ip=217.70.183.195; dmarc=none header.from=waegenei.re; arc=none Received: from relay3-d.mail.gandi.net ([217.70.183.195]:48349) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kc1aL-000DXn-V6; Mon, 09 Nov 2020 07:27:30 +0000 Received: from webmail.gandi.net (webmail19.sd4.0x35.net [10.200.201.19]) (Authenticated sender: brice@waegenei.re) by relay3-d.mail.gandi.net (Postfix) with ESMTPA id ED29160007 for ; Mon, 9 Nov 2020 07:27:28 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 09 Nov 2020 08:27:28 +0100 From: Brice Waegeneire To: zsh-workers@zsh.org Subject: [bug] Special parameters $PATH and $path aren't kept in sync after emulating sh Message-ID: X-Sender: brice@waegenei.re User-Agent: Roundcube Webmail/1.3.15 X-Seq: 47527 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: Archived-At: Hello, Yesterday I stumbled upon a bug where setting $PATH when emulating sh would would break the variable synchronization between the string ($PATH) and the array ($path): --8<---------------cut here---------------start------------->8--- $ echo $PATH /gnu/store/j1jv0f6cs18s76jbkp8h7nbh1i7rwgz2-profile/bin:/home/bricewge/.zsh/polaris/sbin:/home/bricewge/.zsh/polaris/bin:/home/bricewge/.zsh/polaris/usr/sbin:/home/bricewge/.zsh/polaris/usr/bin:/home/bricewge/misc/go/bin:/home/bricewge/.emacs.d/bin:/home/bricewge/.local/bin:/run/setuid-programs:/home/bricewge/.config/guix/current/bin:/home/bricewge/.guix-profile/bin:/home/bricewge/.guix-profile/sbin:/run/current-system/profile/bin:/run/current-system/profile/sbin $ echo $path /gnu/store/j1jv0f6cs18s76jbkp8h7nbh1i7rwgz2-profile/bin /home/bricewge/.zsh/polaris/sbin /home/bricewge/.zsh/polaris/bin /home/bricewge/.zsh/polaris/usr/sbin /home/bricewge/.zsh/polaris/usr/bin /home/bricewge/misc/go/bin /home/bricewge/.emacs.d/bin /home/bricewge/.local/bin /run/setuid-programs /home/bricewge/.config/guix/current/bin /home/bricewge/.guix-profile/bin /home/bricewge/.guix-profile/sbin /run/current-system/profile/bin /run/current-system/profile/sbin $ cat /tmp/test.sh unset PATH export PATH=/foo $ emulate sh -c 'source /tmp/test.sh' _direnv_hook:1: command not found: direnv $ echo $PATH /foo $ echo $path $ export PATH=bar:baz $ echo $PATH bar:baz $ echo $path --8<---------------cut here---------------end--------------->8--- In effect it overwride my path instead of adding a new entry to it when I do it from the array variable ($path) after setting it from from the string variable ($PATH). To workaround this issue I have found the following to work: --8<---------------cut here---------------start------------->8--- $ tmp="$PATH" $ unset PATH $ export PATH="$tmp" $ unset tmp --8<---------------cut here---------------end--------------->8--- Cheers, - Brice