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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12777 invoked from network); 23 Aug 2021 16:43:28 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Aug 2021 16:43:28 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1629737008; b=OlhO8u+/Wj1Bc3Y8i8ByuNfEToteRAe65zqmcbQsbJpJ3wGjKF+psqxhCIj52uOPt3cKOeaUoY LlZC21jVXOU9fGYMjZXIKUzOnrBe/sAlbY0yobo+ZNzC/tyzo8h/czaKK5qC5AAjv9M3jJcp53 Lny1eEarC7z1ozLh8IQxNvqbZr0Lk/jwREgFIlgW6oeizvheb9+J+XhCWa142haXQ4kpOGFMD3 YlRLKvT33treysoPIF7qHGbgBn15s8m9voEviyVdH5is/a9gb3Gj2b/NvhATbZTe/9tHjON5o1 TQSD2Q8lUp1zM0B5MyhWZxmv2Z68Y2zmCvb+cQhu4vtHSA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-io1-f44.google.com) smtp.remote-ip=209.85.166.44; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1629737008; bh=S+Ahg4sNYycT1FmZoBmiUsTpuTti3eudkBq3SG39Xgo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=G7LXfQmM+o5qfdkUBzSeq6NY57yqkG+5UvReEsAVkq4u/d+mw5cR5c+gb1B3dg+lyP2pfiADzH KqY2ziDSaAt2C2fdWXZg6X4DJyr5rjvrgQlVlQF2NGZjUdj7m4ID2veVGOmeDpNyxPINuFXUyh IhlDsCf2FnlN2KBVA1KkfnidMemTaU6kNVB3WEDxgnvnV5D7U/cNSodBMJLQYIStwsVT8vbEn1 T3yMyc7UiYDRBT/9HVKVdPvxaNYrbWRsZ2D1lwtZGWs5wdBlrEyvJ1r6//EJggerjnmdb9AN96 R/WON1RgdlyK/cr7cP556IaY4fqWpv/retXeeiZXIO9Eqg==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=eJbt6j3a/YtIp6VnWMOoXHQQCP84PPqZqlke3x6PyRk=; b=DAwMAKq84XT/AjfqsLby6tk9AM hRTFDYf5Gl6P3zCdwsKElVzCfvLLXq5oiCJfowdgDGS/BICtW1O/JUZpwJVs7v9b007W6hu2s4RIu a4nZThCOjyGagEoqXj6bIzPcyuw52FzZeqoweTCMCMc7/pC+Ynen1CX8D56Xu5JBt19XqGGAikFCC SnXd8Jgkl3HWSFRjgK8uQgZK9CgNxu5nRccnoMAJ2QS1rzqt6WUtKSngsCzPrg0JCzev07sLmQ/S3 qbp76Voe9Gp5bBpdP0D9ppqm0v9qnizMRs9LehPJ7c82crXyASOANGTJVf36qR2QAcc9oo9hBmb3K Ecv0Qy5w==; Received: from authenticated user by zero.zsh.org with local id 1mID2k-000JsM-Bf; Mon, 23 Aug 2021 16:43:26 +0000 Authentication-Results: zsh.org; iprev=pass (mail-io1-f44.google.com) smtp.remote-ip=209.85.166.44; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-io1-f44.google.com ([209.85.166.44]:46061) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mID1m-000J9j-UQ; Mon, 23 Aug 2021 16:42:28 +0000 Received: by mail-io1-f44.google.com with SMTP id e186so22564847iof.12 for ; Mon, 23 Aug 2021 09:42:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=eJbt6j3a/YtIp6VnWMOoXHQQCP84PPqZqlke3x6PyRk=; b=hvR7OiiE7romHY+cfCN50Mww0rd/3VNLyQ3/CogbPI/BSzrLcilWecj8CjbepYk6Ky RfeydBjc75n90W3gWdwFC43i3Eo0+NN2pFqj4b1EYvVGrxddouEotKpgKBoc16bt+0k8 fxUAbnL+bfx95H8CFydg6GgCV6+JLMPCcocgWvZFYA5ANe/wYIqE3sxqFJLQO5WifFoI e0WRDJqHmvEVkD84445/q2/3eOCE4g+XDBE7WOVPiwz6L+nbRCdarPyJsn5RqOsy9iaX facNoq3wc1V+Eq3SbWIDjsBudUfHgW+OWGJL+2W4NaF4wf68At+dKL1wcaHNjHK+W+QQ jshw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=eJbt6j3a/YtIp6VnWMOoXHQQCP84PPqZqlke3x6PyRk=; b=NA2CkoEKkM7NZID2WHJJxVbgQfbgJGChrkaZ2EE0ZRNzpdRlVaotc6hkHW/cTOFvoD S+5YmnHN81N10PbpzYar4gjNVD0dP2soIPBhc6ngc1eJobHE4PqSKV48m/2fVxcIxe7A T0Br0kXHkaSrC51dnc9qMfc1uSdAMJIz4JInlVnaGo2CJjcpha8OICes1eT4nqpqIP90 clHObvabqKuWaUk7A2EYzatqHyCRnpbjA4cU70StW0c1hhB69LzUf0AUbJPlSMPlfEGG 8Q6nEZO6uGzeD50Hg0feJQ0MGtvE7x9dxr45NBCAzt1ePfKwYU5/PcjKzgi4au3PiRDQ w51Q== X-Gm-Message-State: AOAM531G//ECDhx/WF/0beaRg9A2AjuMEMuc2o2kZ4ZWSX1qH497q5hQ nuavdgGLf2PLiiOOAQ69sN3HYcRgufNSm+Osr6KhhuMKecs= X-Google-Smtp-Source: ABdhPJypgcDCE0I97iXMsWULhO+wa3olepunKTAtnHCEXG6k8NDtvWB5Ft2G6jxhwh2mw56NvKwyhmpqWRaxccR588w= X-Received: by 2002:a02:cd89:: with SMTP id l9mr29966004jap.29.1629736944641; Mon, 23 Aug 2021 09:42:24 -0700 (PDT) MIME-Version: 1.0 From: Zach Riggle Date: Mon, 23 Aug 2021 11:42:13 -0500 Message-ID: Subject: Prevent a specific function from being xtrace'd To: Zsh Users Content-Type: multipart/alternative; boundary="000000000000a9acbf05ca3cb39c" X-Seq: 26967 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --000000000000a9acbf05ca3cb39c Content-Type: text/plain; charset="UTF-8" Hello all! ~~ TL; DR ~~ Is there any way to mark or annotate a function such that its internals should not be traced, even if "set -x" or "zsh -x" is used? ~~ Research ~~ I've got a handful of functions that get loaded into each script via "source" or (more frequently) "autoload". In order for the contents of these functions to not pollute the xtrace output, I set the first line of each function to do "set +x" which prevents further tracing. However, the "set +x" itself shows up in the xtrace. Chapter 9 (functions) doesn't mention anything about tracing at all. Chapter 16 (options) mentions a few related things, notably SOURCE_TRACE, VERBOSE, and XTRACE, but doesn't have anything like that. Chapter 17 (builtins) discusses the "functions" builtin and some of the options that are available to it. None of these look relevant. ~~ Misc Notes ~~ I've created a small script[1] that somewhat achieves this effect, with TRAPDEBUG and ZSH_DEBUG_COMMAND -- using funcfiletrace to simply not print any of the lines that come from the file that contains the do-not-want-traced functions -- but I expect there is something simpler. It's similar to xtrace / verbose, but only prints the first line of each statement executed. [1]: https://gist.github.com/zachriggle/eedbfebee870bf66bfafcc2f78b2da78 *Zach Riggle* --000000000000a9acbf05ca3cb39c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello all!

~~ TL; DR ~~
Is ther= e any way to mark or annotate a function such that its internals should not= be traced, even if "set -x" or "zsh -x" is used?
=

~~ Research ~~
I've got a handful o= f functions that get loaded into each script via "source" or (mor= e frequently) "autoload".

In order for t= he contents of these functions to not pollute=C2=A0the xtrace output, I set= the first line of each function to do "set=C2=A0+x" which preven= ts further tracing.=C2=A0 However, the "set=C2=A0+x" itself shows= up in the xtrace.

Chapter 9 (functions) doesn'= ;t mention anything about tracing at all.

Chapter = 16 (options) mentions a few related things, notably SOURCE_TRACE, VERBOSE, = and XTRACE, but doesn't have anything like that.

Chapter 17 (builtins) discusses the "functions" builtin and so= me of the options that are available to it.=C2=A0 None of these look releva= nt.

~~ Misc Notes ~~
I've creat= ed a small script[1] that somewhat achieves this effect, with TRAPDEBUG and= ZSH_DEBUG_COMMAND -- using=C2=A0funcfiletrace to simply not print any of t= he lines that come from the file that contains the do-not-want-traced funct= ions -- but I expect there is something simpler.=C2=A0 It's similar to = xtrace / verbose, but only prints the first line of each statement executed= .


Zach Riggle

--000000000000a9acbf05ca3cb39c--