Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16077

verbosity of DEBUG trap following edit-and-execute-command

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Ami Fischman <ami@fischman.org>
Newsgroups gnu.bash.bug
Subject verbosity of DEBUG trap following edit-and-execute-command
Date Thu, 2 Apr 2020 09:50:45 -0700
Lines 36
Approved bug-bash@gnu.org
Message-ID <mailman.20.1585849035.2644.bug-bash@gnu.org> (permalink)
References <CAGKqTXWmNgoG5yGFrz3ysORDarQZi8ZsKqNS+QDkpuhM6EARNQ@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace usenet.stanford.edu 1585849035 2833 209.51.188.17 (2 Apr 2020 17:37:15 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=fischman-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=I5rF6exY82dk+YZ6U7CXqGSeSqiGqFOjBS98LLttURk=; b=RBjJWzPicwU0jIbv3AlIqOEguSwXQx3irf5p141UATOR/Lx1pGuCPgS1erj6/C/ETj mI92kNpv+FKk/fC5BsYB+SKTpD639+2yGenZNd2uF4iB9/k0vDFD+3MgAHt4D9DEQVly oh6Fx0D0MU+JYvmUnJgRhSpFnO7nmE7sUZClt9UxTplDxsOG2lL06dJpJZQwF9pFAogz gZIGf9G/Yhcw8wKTDs2MccU+bbk2zph+BjeyNK6KNWA9ZnNBBuWgYHWPVy0Mi8aeJro7 z8K7rgEcevjPk65f3PMVhLhTP6mRzr0WrnWIOYodcARKk8p0+IhyRS3A/K0cmsXUmjU1 3Atg==
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=I5rF6exY82dk+YZ6U7CXqGSeSqiGqFOjBS98LLttURk=; b=JuRBHY0W4w54wSaq5iqridoE2FciqrySleRyIwfnLaMYqaYeS/PckIEHHHxuyT5Gu7 hov/RfVR++BarVo88rwBPp4FihFgq0pFTrSZPWiIGB/FcLgBJoU5l9d4hqHQlnbKX+f2 J0ewifKUu4MPxO12JjKuWo3fT2lmyU2UiQk2pMhzWASR7sB1G17RtGSCaLKlH4EUa5KQ HTcUUgmVYHt3menRFvA81907evNeicxvaQEHxi5/qt87ix+BYN1QKk2lNyAb4sJoGjKT a71Nua9ciZ9N009zz+I60OtJXsHdi3+nOahQj4xiGgxOdztcydcMOyt5is0Uemc6t+Cy ifaA==
X-Gm-Message-State AGi0PuaW3d0n39je0aJxAI7qgzLCHYIkqbksz3YernIoW9T9/+fLsbBv KUAvuxtyhvZIiXVXXDNkmMK/RDyr3wfsJpE81L/yrkfXRFerOg==
X-Google-Smtp-Source APiQypKcCWezdVGyu+XaqP9wrqiHm5PNJ++YGOhow9lQQVxfmGdsb/Up59qoBoogaPmmPzIEGByK1zDSpB3614pyTiE=
X-Received by 2002:a5d:4a84:: with SMTP id o4mr3537643wrq.57.1585846256685; Thu, 02 Apr 2020 09:50:56 -0700 (PDT)
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2a00:1450:4864:20::444
X-Mailman-Approved-At Thu, 02 Apr 2020 13:37:14 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAGKqTXWmNgoG5yGFrz3ysORDarQZi8ZsKqNS+QDkpuhM6EARNQ@mail.gmail.com>
Xref csiph.com gnu.bash.bug:16077

Show key headers only | View raw


After the editor invoked by edit-and-execute-command exits, the
about-to-be-executed command (as edited by the editor) is echoed, but seemingly
as if [set -v] was set, causing a command executed before the edited command as
the result of a trap DEBUG to be echoed, as well. This is annoying for example
when using the DEBUG trap as a way to change colors as demonstrated in
https://nigeltao.github.io/blog/2018/colorful-text.html#shell-prompts

It would be nicer if the set -v was undone before the trap's handler was
executed so that the printf wasn't shown to the user in the example below.

Repro recipe follows. The initial echo demonstrates that the trap is silent in
the absence of edit-and-execute-command. The second echo command has C-x C-e hit
after the "echo He" is typed, and the line containing printf (third from the
bottom) is what I'm hoping to avoid.

~ $ docker run -it bash:5.0.16
bash-5.0# EDITOR=ed
bash-5.0# trap 'printf "\e[0m"' DEBUG
bash-5.0# echo Hello
Hello
bash-5.0# echo He
"/tmp/bash-fc.INbEkF", 1 lines, 8 chars
: 1s/He/Hello/
: w
"/tmp/bash-fc.INbEkF", 1 lines, 11 chars
: q
echo Hello
printf "\e[0m"
Hello
bash-5.0#

Note this also repros in 5.0.11(1) as well as 3.2.57(1).

Cheers,
-a

Back to gnu.bash.bug | Previous | NextNext in thread | Find similar


Thread

verbosity of DEBUG trap following edit-and-execute-command Ami Fischman <ami@fischman.org> - 2020-04-02 09:50 -0700
  Re: verbosity of DEBUG trap following edit-and-execute-command ami@fischman.org - 2020-05-01 22:40 -0700

csiph-web