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 5466 invoked from network); 30 Aug 2021 21:36:52 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Aug 2021 21:36:52 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630359412; b=HVeUrTgD7ETUq2negsghLz+C8byudmiHatCcF/H0H6pSAGwfG4AJVQEgYlQ+CTfhW30lQmgQFD sRPbWhBbH9WuMGeiOy8nCbZuWVL1vv+9YYZpzUuw6srYOSiqYdibS4bQfTX7UWrQcFKq0CycfU Z4TUgePhTlN/B/XobHTkk46j1B15GC1unobO/AaU1di/5IcddZLgN4aYERYgF8HjnWWHe+Y1Ei ULUQZhTkdXAlonbBh6arCNq/x/95GQrc9FUYYIVdDKM7NszjIci0QiNM6uv75ygaTstwsnL7jU 7a+sEr+fy/e4N0xado7VIhp52tCY1YUKgIdZP2JdvvDVhg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f174.google.com) smtp.remote-ip=209.85.219.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 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=1630359412; bh=hSiAPOS4zn30edP4oVzF1m0cDpDRTwS9hdsOAV8qLR8=; 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=I0eTn9jsomdQb7EmQHg2KkNxYiLgrXYuto70xOgj8rqJl5H5i1gbjvvVbmkldwVFeaicER3kSB CrxM0ZEvQOy9GEVfa3TCpIIkQp2uEX+yRodL6uRS+Rxw3lAprsqJsH0omO6yVgesKBQZVuz3ZQ namIUFjD5MeVSkTGkv0YAflpK9HPWJbBn1N67pdux3DdYljwnifRMRHoVIj1NJTsDfRyigdEVd 4EONtqlm94K9aFGQCelfX9gFImG+XnJslaa2mCoZuKS2Bs9jvT/sdiJ5p+yGO1I5M7ZK8HsKHK ua4GOnQuMNDowbLOKEIogS1AfzVeLyutfhqlfG29d+Z/Kw==; 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=9neVfs05B+W2ghpJ05UpnqGiAhSFjY3BdnI7mCrarRo=; b=pP9q2n8moaeX6RXqG18AFNxr+u pkt1OkaBKxAKDeM7M6ue7sbQJhTA+hb9YtcnvQ/0b+Of8LsHfdTEoV0Cmt0CHDKSgerVIsEx9HrmN wWzGp03Buf0H+r7VwtplvDFOzzT60/4v38dKd/Wp8xX5D4cb/SZ0xtXwz5EHH2PBjiKOrgFB5XClv +VwuIWSAUt6WrqV/+MBu9ysNGzTfYidXSsxYktjdxO8BRpnR9vtX2GFy4/WoyWEU8lgmiqkYAm2Fn o8PyD3LYHl2VI4j+g5H1VppjNByV5qGBZNZFvxhCcqCFlkwgOAhHkxA0orKbkKY0rdUmZssQUwuYY TP6H+lWg==; Received: from authenticated user by zero.zsh.org with local id 1mKoxY-0007Er-KO; Mon, 30 Aug 2021 21:36:52 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f174.google.com) smtp.remote-ip=209.85.219.174; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f174.google.com ([209.85.219.174]:43592) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mKowr-0006jZ-Ew; Mon, 30 Aug 2021 21:36:10 +0000 Received: by mail-yb1-f174.google.com with SMTP id k78so27729164ybf.10 for ; Mon, 30 Aug 2021 14:36:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9neVfs05B+W2ghpJ05UpnqGiAhSFjY3BdnI7mCrarRo=; b=V3/UO1MwPD0veS1CA2T2BsKd5tI0vrHsZR02x0/B44GHL1VoS0F30oNFHAYkTNj5W3 vznCECbz4mpK2+66GR00tOemQwoPv9PCPEhX7xGSd7TW2Xi61S9ErGlH/kC1Ecot5uxT 3rbQMCnw4jlT30zaSPmBbng3V7Zo1WDFYZlivEoe9xWVoOqA5sac9XkaJcz/bPRuUuWD LMaevTaBLoedpOq6ukiZmchL13/DC96SuhkM05f53/AKWjc+2rbzKJzxBBwkoXNf3lr8 59gUK3o6Neoj4tJ370G+alEQaaXNj/ggACEN/dhNfLzFTolh/jMAooTO7zNVCVEcULKF UK3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9neVfs05B+W2ghpJ05UpnqGiAhSFjY3BdnI7mCrarRo=; b=JSVPcxa23YmuWs1JIcnQU/A2p9DTsrQCzELlWjd+QIoQfqOWk/5lj5uNvIxmnZCW+r z11kcf7KoWjSVON9zb4k9b4Ow4LyRBCZFQsAQ+5PtFVA3rJ2Yw0quOf9YfisC3l+/Wuo /SJwz8IyACIs7rc7B+wmyMrYUNvOpNNH8hO2swsPkIL5a2dd8yTbBmaKAxKcMcZzPEdF iDcKGRTKPKgFmUGIZuYOKnTyB3F0bsnD+BZdxt5qEaTyLsVr9O36hxgCKecd02wLBN6S CmrAnsUZKMCDAzXvaalB8MjlnQeMclBj0Ei1ExNkNKpp3RSuEgt5XKwBstE0mqjeXtj2 nuKg== X-Gm-Message-State: AOAM532IoTYzZ+uc4o8muZ+vJ3j2pCs7TJViSbAV+J1Ca33mEQRZj5uf fgwF2Kpa39sbVswoOAYxPNXm7+VanelFFmoXKQmBN5wgB04= X-Google-Smtp-Source: ABdhPJz54CsSxDM72sH/8psEXAzGqMulibCOddNK7pYodih+0STFJGCTSoEwoFFhuDGohPkcZ8Q7FeIdhTzZe5Y7a/g= X-Received: by 2002:a25:31d7:: with SMTP id x206mr26612543ybx.297.1630359368235; Mon, 30 Aug 2021 14:36:08 -0700 (PDT) MIME-Version: 1.0 References: <391FB007-1453-44CF-A990-280C59750F65@twistedmatrix.com> In-Reply-To: <391FB007-1453-44CF-A990-280C59750F65@twistedmatrix.com> From: Bart Schaefer Date: Mon, 30 Aug 2021 14:35:56 -0700 Message-ID: Subject: Re: bug report: INTERACTIVECOMMENTS option interacts oddly with shell functions in an interactive context To: Glyph Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 49334 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, Aug 29, 2021 at 1:58 PM Glyph wrote: > > Comments in sample_function are interpreted normally, but comments *inside* the "bogus" expression will be interpreted as executing in an interactive context Hm, well, this is quite obviously intentional based on the code that interprets $(...) expressions. The only way I can think of to change it without breaking the behavior of $(...) typed at the actual command line, would be for "source" and related operations to put INTERACTIVECOMMENTS into the "sticky" emulation context during parsing of the file (even if it was off in the parent shell). That is, if "source" et al. always behaved as if emulate $(emulate) -o interactivecomments -c 'source ...' then comments in $(...) and related contexts would be ignored as if they were parsed during the "source" command instead of during the execution of the substitution. But that could have some pretty confusing side-effects for functions that want to examine $options (for example). Incidentally, you almost certainly want setopt LOCALOPTIONS INTERACTIVECOMMENTS in any functions where you intend to put comments inside $(...), otherwise you will propagate INTERACTIVECOMMENTS into the parent shell.