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 26771 invoked from network); 28 Nov 2021 19:51:31 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Nov 2021 19:51:31 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638129091; b=SrtkQ4uDLTpEx5sBeq8Yct/YLzOlSQgFI4yaDGyIAg8RFF+VCldqVtUEE8L5tXLBDAaDk+OcWE rHdFT5bww3m3D3d2aRKT0kraueMmy27VgVZerqZTXjIjRkq4gEHnKrImA/6xzrz5wNYSUwfPtR uQ/iVAoeoIUvIb4gL9fulBUwXDX98n5oIxtqXI461kM1LrlsdDzt9bbOcfx3cR8t8HLUAcDmiL puPuSXagfwgmAn18JqJ9HcXsfqG9jfMoRN3qywM5YEPiMvyaLhJcS3a+cVsnujvani7YFsTkrn Q1Chycg/PkrI7L97cVESvT52abVkQExCgsKlH1U9QVl4yw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f181.google.com) smtp.remote-ip=209.85.219.181; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1638129091; bh=Wwtubmw5zQ8FMxYkkZKdNC3XUNQzipEXxg5NOqsk97Q=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Pce1+t4K5TxFqUQBWZ0T2KPXJ/8hFbbou8A3VfCnJ86gtrLEZTlMPsxOwolgxzeBKLwgYWzWoK WLbnWLt9nYcz2GbKsh3hEhBTloziZfuSM2s/cZSXZcys7Liuf15NzIq4h4pfYVGdNOlS/peQ2Q piSf6s8LIRwEC3y+fR9V2friobPRQKqy37rjsi2YGuBIttc3xVIh/SeN6w4fxGNclH6ZlTlhkH wgWaw9xRB3OncBSk7TlF8EiGMy6hk86T51uQAXKiZconFlQRbOjNmFfoTKfm2UG5VFlfkH/XQG n29rhaLTNmgt0sP7eADDYT/eSuXSOzJ5oIOrmW4HDNs4ag==; 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:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=P8NCVU4i0mKdE7xvz9SWIQP3i+WG+6pAdUuTHyAJ/n4=; b=ZL0UTzXCJJpd4rxuoTvzGvl8uh XOofPO4DoV/fJZKfm3ASXPO+7Lp1NV9XaThEJuMpLRZzZiLCratcxV4T/LxMkWb/57akFaHRLonJp gLfusMnGyNxpBXxy6huRHoPhYnIOx1AvdP+pJcS0chCXOB3M9WygYF1X9k/u9zKMLxqs2KQIfQBJJ 7OeDY8sG5uaybEN01jbxayLUbRQGPDIrLchYLSDtGvSGoMQF2T7XHXCPeSE6rxnB0p+qTfnBi1RzE FZur3CgaZuy6HeQ0p/p0FXY3qCNe6mp435+cvRW950z1Xjn914Jv4VyIVC7ajy80AznNDdHhebxqy qQL8wDIw==; Received: from authenticated user by zero.zsh.org with local id 1mrQCv-000ENw-Bb; Sun, 28 Nov 2021 19:51:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f181.google.com) smtp.remote-ip=209.85.219.181; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f181.google.com ([209.85.219.181]:45670) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mrQCI-000E7C-4u; Sun, 28 Nov 2021 19:50:51 +0000 Received: by mail-yb1-f181.google.com with SMTP id x32so35798493ybi.12 for ; Sun, 28 Nov 2021 11:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=P8NCVU4i0mKdE7xvz9SWIQP3i+WG+6pAdUuTHyAJ/n4=; b=A/Bj4sdSdgWeIqlR448dvCJz7HuSni3kSIz1FDJVP3MWxYNhB6dUrKvpGdllsPy8pX cEAbPOaCbt7maX08RDoqAsOuuKxwJlPUxYz8SOnTvQRGVWI+c32WPCIXQIJWGOIgpUjo EOs4u85ETc9VeCi7oltZfqXdvUhxZ/g8gmVglsAJOrjhePy1n66Y3visXFUn8iDQpLVJ 55+FV/anWVoobdij16jyGgyfaBZUebWmhAjlatleTzr4/aCBe/AiP48THTEgYbgvonBe 458gytoz9E9jAWyZIz23nenoAN4yuX8niFJw0TMKBGJR9VTolciP0zBBbI/BpV3+P3M3 Ju0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P8NCVU4i0mKdE7xvz9SWIQP3i+WG+6pAdUuTHyAJ/n4=; b=H6sCJAWinkVtQtdX0fpj3W4hl5tXQVS6Rc7luBk1uyfN6iY3lg85RzbOzPoB6rgKcR Do5YmSEeJTioNqMBe51ptTtZLgIg2Kuu8+AqR3v4iJ3DslBq9/33x6qWirT61QJ4lqYn kJ9eiAeBBR7zOhvtLdojzYDbItzG19bc9Z35b+eoCFtaheNclfjAzDEUkyeTbSi0mAsr ngcDuZrJkPIvMhAT5LHeX9sbkRl6VDiRU2d1bwAjRVRyTDv7uLRDZ30QdvDUGFTX9rua W+4e4HxYbuD3FJNDoX4AAgIfHQOQdyQAvM2QPK+gmd9l+bUCxM/4yP3WBR3JQn9Vf9TG 5HOQ== X-Gm-Message-State: AOAM5328FEJxIweTjt8wSmGuJh1uAhs4j45mQqt8YRTh0vLkQ/cyDzTA 2CdGm/fIlXrJHfTUW/PVql6bhOtlloIQbG6IO6radg== X-Google-Smtp-Source: ABdhPJxU60qUXePKI1BOTNp8SaWjOSO9B9rpic3O0LF3EZbHfx+Or8+7dfKv4IXBY4zvPvScqKULs5hOTgqwd0pWwjQ= X-Received: by 2002:a25:8711:: with SMTP id a17mr30552127ybl.323.1638129048601; Sun, 28 Nov 2021 11:50:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 28 Nov 2021 11:50:37 -0800 Message-ID: Subject: Re: Prompt expansion on signals To: Roman Perepelitsa Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49609 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: On Sun, Nov 28, 2021 at 2:01 AM Roman Perepelitsa wrote: > > For this to work correctly, prompt_subst must be set when prompt is > expanded. However, this requirement can be violated when prompt is > expanded in a signal handler. A more egregious example might be when the global settings have "unsetopt promptpercent". Are prompts the only case where this is an issue, though? The most visible, certainly, but "zle -F" for example? What about the reverse situation, where the signal handler is a function that changes options locally? > Prompt expansion can be affected by options other than prompt_*. Are you aware of any cases where this is true but prompt_subst is false? > Is there a solution for this problem that I'm missing? Are there > workarounds? How could it be fixed? I can't think of any workaround, other than perhaps to create a signal handler that does "zle -I" ... as to a possible fix, since the prompt parameters are all specials they could be programmed to memoize the options in effect at the time they are assigned, similar to the way functions can have "sticky" options when defined within an "emulate -c", and restore those before expansion. That introduces several other questions: Can each prompt have different options (e.g., RPS1 differ from PS1)? If a prompt parameter is assigned within a function, does it memoize the local options? If PS1 et al. are imported from the environment, what options are initially memoized and when? Perhaps the prompt options should be excluded from those altered by "emulate -R"? "... except for certain options describing the interactive environment ... only those options likely to cause portability problems in scripts and functions are altered ..." Are promptsubst and promptpercent etc. "likely to cause portability problems"? I suppose they are if a "select" statement is used and PS3 has been changed. Either way that doesn't fix an explicit setopt of those.