GNU bug report logs - #36677
[PATCH] Don't truncate backtraces

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Robert Vollmert <rob@HIDDEN>; Keywords: patch; dated Mon, 15 Jul 2019 20:33:01 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 36677 <at> debbugs.gnu.org:


Received: (at 36677) by debbugs.gnu.org; 22 Jul 2019 00:36:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 21 20:36:18 2019
Received: from localhost ([127.0.0.1]:59731 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hpMJN-00020b-NI
	for submit <at> debbugs.gnu.org; Sun, 21 Jul 2019 20:36:17 -0400
Received: from world.peace.net ([64.112.178.59]:37324)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1hpMJK-00020K-VS
 for 36677 <at> debbugs.gnu.org; Sun, 21 Jul 2019 20:36:16 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hpMJE-0001lw-Lg; Sun, 21 Jul 2019 20:36:08 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: David Pirotte <david@HIDDEN>
Subject: Re: bug#36677: [PATCH] Don't truncate backtraces
In-Reply-To: <20190721195943.096ebac6@capac>
References: <20190715202918.92925-1-rob@HIDDEN>
 <87ef2ownkf.fsf@HIDDEN> <20190721195943.096ebac6@capac>
Date: Sun, 21 Jul 2019 20:33:53 -0400
Message-ID: <87lfwq52lv.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36677
Cc: 36677 <at> debbugs.gnu.org, Robert Vollmert <rob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi David,

> I am very pleased to read that you think it is important to enable
> truncated printing as a default for backtrace, I think so to. But
> maybe Guile could provide an easy mechanism to overwrite these
> defaults, using procedures, or parameters? (not depending on an
> 'external' variable I mean (*)

You can see now that there are pressures coming from both directions on
this issue.  There are complaints that we truncate too much information,
and other complaints that we don't truncate often enough.  There are
proposals to never truncate anything by default, and proposals to
truncate everything by default.

> I wrote "these defaults", "procedures or parameters", using plural,
> because I think that the default should also enable truncated printing
> for the repl and the raised exception system, what do you think?

I'm reluctant to truncate REPL output by default for a few reasons:

(1) Historically, the Guile has never truncated REPL output, and I'm
concerned that changing the default behavior may violate longstanding user expectations.  I, for one,
often ask for a moderately large data structure to be computed and
printed at the REPL, and I normally want to see the whole thing.

(2) Some software may act as a front-end for the Guile REPL, sending
commands to it and interpreting the output.  For example, I believe that
Geiser does this.  I'm concerned that changing the default truncation
behavior may cause problems here.

(3) I'm not confident that 'truncated-print' is fully robust for
arbitrary data types.  I would need to make a careful audit of the code.

(4) The Guile REPL already provides a way to specify a custom printer,
so there's nothing stopping you from installing 'truncated-print' as the
REPL printer.

Regarding truncating exception printing by default, I'm inclined to
think that it's better to err on the side of printing too much than too
little.  If an uncaught exception occurs, that clearly indicates an
error, and if we truncate the error report, that might make the
difference between being able to figure out what went wrong and being
unable to do so, especially if the error is not easily reproducible.

Your position on this is pretty much the opposite of what Robert
Vollmert is advocating here, although to be precise he's talking about
backtraces whereas you're now talking about exception conditions.
Still, they both seem to be in the same area.

To be honest, the main reason I find lack of truncation painful
sometimes is because Emacs does not cope well with extremely long lines,
to put it mildly.  Honestly, that's a flaw in Emacs, and it seems like
it would be better to fix Emacs than to work around it in Guile by
omitting potentially useful information from error reports by default.

I need to think more on this.  In the meantime, I welcome opinions.

     Regards.
       Mark




Information forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.

Message received at 36677 <at> debbugs.gnu.org:


Received: (at 36677) by debbugs.gnu.org; 21 Jul 2019 22:59:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 21 18:59:56 2019
Received: from localhost ([127.0.0.1]:59670 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hpKo8-0007JZ-Ay
	for submit <at> debbugs.gnu.org; Sun, 21 Jul 2019 18:59:56 -0400
Received: from maximusconfessor.all2all.org ([79.99.200.102]:39452)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <david@HIDDEN>) id 1hpKo6-0007JK-FJ
 for 36677 <at> debbugs.gnu.org; Sun, 21 Jul 2019 18:59:55 -0400
Received: from localhost (localhost [127.0.0.1])
 by maximusconfessor.all2all.org (Postfix) with ESMTP id 181221BE008D;
 Mon, 22 Jul 2019 00:59:53 +0200 (CEST)
Received: from maximusconfessor.all2all.org ([127.0.0.1])
 by localhost (maximusconfessor.all2all.org [127.0.0.1]) (amavisd-new,
 port 10024)
 with ESMTP id YiMYN7Pv-9D4; Mon, 22 Jul 2019 00:59:53 +0200 (CEST)
Received: from capac (unknown [189.122.155.59])
 by maximusconfessor.all2all.org (Postfix) with ESMTPSA id 05BD71BE0086;
 Mon, 22 Jul 2019 00:59:51 +0200 (CEST)
Date: Sun, 21 Jul 2019 19:59:43 -0300
From: David Pirotte <david@HIDDEN>
To: Mark H Weaver <mhw@HIDDEN>
Subject: Re: bug#36677: [PATCH] Don't truncate backtraces
Message-ID: <20190721195943.096ebac6@capac>
In-Reply-To: <87ef2ownkf.fsf@HIDDEN>
References: <20190715202918.92925-1-rob@HIDDEN> <87ef2ownkf.fsf@HIDDEN>
X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 boundary="Sig_/UOt=g2tr_=yla1Zg09sCTw="; protocol="application/pgp-signature"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 36677
Cc: 36677 <at> debbugs.gnu.org, Robert Vollmert <rob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--Sig_/UOt=g2tr_=yla1Zg09sCTw=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hello Mark,

> > This change was prompted by recent discussion on the Guix lists:
> >   https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
> > In Guix, the truncation of stack traces frequently obscures
> > important information due to the long filenames. =20

> I'm sympathetic to this problem, but simply disabling the truncated
> printing during backtraces is not workable.  It is quite often the case
> that some of the structures printed in backtraces are *huge*, or even
> cyclic.

I am very pleased to read that you think it is important to enable truncated
printing as a default for backtrace, I think so to. But maybe Guile could p=
rovide an
easy mechanism to overwrite these defaults, using procedures, or parameters=
? (not
depending on an 'external' variable I mean (*)

I wrote "these defaults", "procedures or parameters", using plural, because=
 I think
that the default should also enable truncated printing for the repl and the
raised exception system, what do you think?

I wrote about this a couple of times, and as a gentle ping, here is my last=
 email
about this request, which is a good summary which also points to other disc=
ussion on
this topic:

	https://lists.gnu.org/archive/html/guile-devel/2019-05/msg00034.html

David.

(*)	if an easy mechanism would depends on variables, let's make these Guile
variable then. like GUILE_BACKTRACE_PRINTER_TO_USE_N_COLUMN_AT_MOST
 (or what ever, I am not the best to name things ...),
GUILE_REPL_PRINTER_TO_USE_N_COLUMN_AT_MOST and
GUILE_RAISED_EXCEPTION_SYSTEM_TO_USE_N_COLUMN_AT_MOST, with -1 meaning no
truncated printing ...

But I would prefer procedures to set these, 'keeping' the default to be what
truncated-print uses as defined 'now', in  (ice-9 pretty-print), so we coul=
d use
them in our repl, our .guile, or the global init.scm setting, and change th=
at on the
fly as we wish ... as for the procedure names, or one procedure and two arg=
s, one
for the parmeter to set, one for the value ... let's think about it ...



--Sig_/UOt=g2tr_=yla1Zg09sCTw=
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAl007l8ACgkQ83T9k6MF
etfXzAf/cm1L65b2npLdjB/CpH+r2Vsjxfp7g4J29TBSAEmopVpoaDXA16wlpJ5z
53V2KkhX7pIrAXoeci46h7af/NRPSWkgfOZ/popEyxcfHpmZpluFVJ72wCIx4+b5
gBbe2pdp1ROoAjNF+lUUaWElZwLCLSWxZ6dnj95aRsLyZxllQfstQczXYNovMlwd
4CuoIlXssn85wMUdlUgh1wgHzUMNUqwRLvSL7Zt7Gf47cZrPQlkvkp7X6OX7fogl
EEh6zgefYWR5R7RLvrThIdHfJ5S3BMhAYVV2KElUcX+uFbr7ZOrciKslGtkm4Yka
FKDhbW/GHCX0nteHmZLKjAd28fPS3w==
=+MGU
-----END PGP SIGNATURE-----

--Sig_/UOt=g2tr_=yla1Zg09sCTw=--




Information forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.

Message received at 36677 <at> debbugs.gnu.org:


Received: (at 36677) by debbugs.gnu.org; 21 Jul 2019 15:35:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 21 11:35:57 2019
Received: from localhost ([127.0.0.1]:59334 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hpDsS-0002yL-Ji
	for submit <at> debbugs.gnu.org; Sun, 21 Jul 2019 11:35:56 -0400
Received: from mx2.mailbox.org ([80.241.60.215]:44974)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rob@HIDDEN>) id 1hpDsQ-0002y7-FP
 for 36677 <at> debbugs.gnu.org; Sun, 21 Jul 2019 11:35:55 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241])
 (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits))
 (No client certificate requested)
 by mx2.mailbox.org (Postfix) with ESMTPS id 63C11A1043;
 Sun, 21 Jul 2019 17:35:48 +0200 (CEST)
X-Virus-Scanned: amavisd-new at heinlein-support.de
Received: from smtp2.mailbox.org ([80.241.60.241])
 by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de
 [80.241.56.125]) (amavisd-new, port 10030)
 with ESMTP id Qjnxqs49o4qo; Sun, 21 Jul 2019 17:35:38 +0200 (CEST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: bug#36677: [PATCH] Don't truncate backtraces
From: Robert Vollmert <rob@HIDDEN>
In-Reply-To: <827D6B68-7E10-47BD-9419-A8471C9A0090@HIDDEN>
Date: Sun, 21 Jul 2019 17:35:35 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <D5475C37-C3E9-468C-B59E-496CB5CA7DCB@HIDDEN>
References: <20190715202918.92925-1-rob@HIDDEN>
 <87ef2ownkf.fsf@HIDDEN> <827D6B68-7E10-47BD-9419-A8471C9A0090@HIDDEN>
To: Mark H Weaver <mhw@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 36677
Cc: 36677 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)



> On 17. Jul 2019, at 20:11, Robert Vollmert <rob@HIDDEN> wrote:
>=20
>=20
>=20
>> On 17. Jul 2019, at 19:57, Mark H Weaver <mhw@HIDDEN> wrote:
>>=20
>> Hi Robert,
>>=20
>> Robert Vollmert <rob@HIDDEN> writes:
>>=20
>>> * module/system/repl/debug.scm (print-frame): Print full object if
>>> width keyword is #f.
>>> * libguile/backtrace.c (display_backtrace_body): Call print-frames
>>> with #:width #f.
>>> ---
>>>=20
>>> This change was prompted by recent discussion on the Guix lists:
>>> https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
>>> In Guix, the truncation of stack traces frequently obscures
>>> important information due to the long filenames.
>>=20
>> I'm sympathetic to this problem, but simply disabling the truncated
>> printing during backtraces is not workable.  It is quite often the =
case
>> that some of the structures printed in backtraces are *huge*, or even
>> cyclic.
>>=20
>> Have you tried setting the COLUMNS environment variable to a larger
>> value?  I'd prefer a solution along those lines, where the user can =
set
>> an environment variable to ask for less truncation in backtraces.
>=20
> Defaulting to something longer than 80 might be workable, say 250?
>=20
> I don=E2=80=99t think that it should be necessary to set an =
environment variable
> to get usable stack traces=E2=80=A6

I=E2=80=99d like to add that the current code to determine terminal =
width
seems to be broken. COLUMNS is a bash-local variable, it=E2=80=99s not =
typically
set anywhere as an environment variable.

Some ways to get actual terminal size:

$ tput cols  # from ncurses
80
$ stty size  # from coreutils
25 80

Though it=E2=80=99s unclear how these work in non-interactive =
situations.





Information forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.

Message received at 36677 <at> debbugs.gnu.org:


Received: (at 36677) by debbugs.gnu.org; 17 Jul 2019 18:11:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 17 14:11:46 2019
Received: from localhost ([127.0.0.1]:52973 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hnoP3-0003KU-V6
	for submit <at> debbugs.gnu.org; Wed, 17 Jul 2019 14:11:46 -0400
Received: from mx1.mailbox.org ([80.241.60.212]:10582)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rob@HIDDEN>) id 1hnoP1-0003KG-Ec
 for 36677 <at> debbugs.gnu.org; Wed, 17 Jul 2019 14:11:44 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241])
 (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits))
 (No client certificate requested)
 by mx1.mailbox.org (Postfix) with ESMTPS id 9303A4D92E;
 Wed, 17 Jul 2019 20:11:37 +0200 (CEST)
X-Virus-Scanned: amavisd-new at heinlein-support.de
Received: from smtp2.mailbox.org ([80.241.60.241])
 by spamfilter05.heinlein-hosting.de (spamfilter05.heinlein-hosting.de
 [80.241.56.123]) (amavisd-new, port 10030)
 with ESMTP id Nu9ws54Bo4Kz; Wed, 17 Jul 2019 20:11:27 +0200 (CEST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Subject: Re: bug#36677: [PATCH] Don't truncate backtraces
From: Robert Vollmert <rob@HIDDEN>
In-Reply-To: <87ef2ownkf.fsf@HIDDEN>
Date: Wed, 17 Jul 2019 20:11:24 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <827D6B68-7E10-47BD-9419-A8471C9A0090@HIDDEN>
References: <20190715202918.92925-1-rob@HIDDEN> <87ef2ownkf.fsf@HIDDEN>
To: Mark H Weaver <mhw@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 36677
Cc: 36677 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)



> On 17. Jul 2019, at 19:57, Mark H Weaver <mhw@HIDDEN> wrote:
>=20
> Hi Robert,
>=20
> Robert Vollmert <rob@HIDDEN> writes:
>=20
>> * module/system/repl/debug.scm (print-frame): Print full object if
>> width keyword is #f.
>> * libguile/backtrace.c (display_backtrace_body): Call print-frames
>> with #:width #f.
>> ---
>>=20
>> This change was prompted by recent discussion on the Guix lists:
>>  https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
>> In Guix, the truncation of stack traces frequently obscures
>> important information due to the long filenames.
>=20
> I'm sympathetic to this problem, but simply disabling the truncated
> printing during backtraces is not workable.  It is quite often the =
case
> that some of the structures printed in backtraces are *huge*, or even
> cyclic.
>=20
> Have you tried setting the COLUMNS environment variable to a larger
> value?  I'd prefer a solution along those lines, where the user can =
set
> an environment variable to ask for less truncation in backtraces.

Defaulting to something longer than 80 might be workable, say 250?

I don=E2=80=99t think that it should be necessary to set an environment =
variable
to get usable stack traces=E2=80=A6





Information forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.

Message received at 36677 <at> debbugs.gnu.org:


Received: (at 36677) by debbugs.gnu.org; 17 Jul 2019 18:00:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 17 14:00:00 2019
Received: from localhost ([127.0.0.1]:52938 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hnoDg-000308-DM
	for submit <at> debbugs.gnu.org; Wed, 17 Jul 2019 14:00:00 -0400
Received: from world.peace.net ([64.112.178.59]:55604)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1hnoDf-0002zu-6m
 for 36677 <at> debbugs.gnu.org; Wed, 17 Jul 2019 13:59:59 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89)
 (envelope-from <mhw@HIDDEN>)
 id 1hnoDY-0001EJ-NQ; Wed, 17 Jul 2019 13:59:52 -0400
From: Mark H Weaver <mhw@HIDDEN>
To: Robert Vollmert <rob@HIDDEN>
Subject: Re: bug#36677: [PATCH] Don't truncate backtraces
References: <20190715202918.92925-1-rob@HIDDEN>
Date: Wed, 17 Jul 2019 13:57:41 -0400
In-Reply-To: <20190715202918.92925-1-rob@HIDDEN> (Robert Vollmert's
 message of "Mon, 15 Jul 2019 22:29:19 +0200")
Message-ID: <87ef2ownkf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36677
Cc: 36677 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Robert,

Robert Vollmert <rob@HIDDEN> writes:

> * module/system/repl/debug.scm (print-frame): Print full object if
> width keyword is #f.
> * libguile/backtrace.c (display_backtrace_body): Call print-frames
> with #:width #f.
> ---
>
> This change was prompted by recent discussion on the Guix lists:
>   https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
> In Guix, the truncation of stack traces frequently obscures
> important information due to the long filenames.

I'm sympathetic to this problem, but simply disabling the truncated
printing during backtraces is not workable.  It is quite often the case
that some of the structures printed in backtraces are *huge*, or even
cyclic.

Have you tried setting the COLUMNS environment variable to a larger
value?  I'd prefer a solution along those lines, where the user can set
an environment variable to ask for less truncation in backtraces.

     Thanks,
       Mark




Information forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Jul 2019 20:32:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 15 16:32:18 2019
Received: from localhost ([127.0.0.1]:49240 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hn7dy-0001QZ-Fi
	for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 16:32:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:56142)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rob@HIDDEN>) id 1hn7du-0001QR-SL
 for submit <at> debbugs.gnu.org; Mon, 15 Jul 2019 16:32:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:60724)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <rob@HIDDEN>) id 1hn7dt-0006lU-LG
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 16:32:14 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,URIBL_BLOCKED
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rob@HIDDEN>) id 1hn7ds-00083W-Cv
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 16:32:13 -0400
Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:23474)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <rob@HIDDEN>) id 1hn7ds-0007yj-5l
 for bug-guile@HIDDEN; Mon, 15 Jul 2019 16:32:12 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org
 [IPv6:2001:67c:2050:105:465:1:2:0])
 (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits))
 (No client certificate requested)
 by mx1.mailbox.org (Postfix) with ESMTPS id BCCA95064E;
 Mon, 15 Jul 2019 22:32:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at heinlein-support.de
Received: from smtp2.mailbox.org ([80.241.60.241])
 by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de
 [80.241.56.115]) (amavisd-new, port 10030)
 with ESMTP id 860isLs0iTBf; Mon, 15 Jul 2019 22:31:58 +0200 (CEST)
From: Robert Vollmert <rob@HIDDEN>
To: bug-guile@HIDDEN
Subject: [PATCH] Don't truncate backtraces
Date: Mon, 15 Jul 2019 22:29:19 +0200
Message-Id: <20190715202918.92925-1-rob@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2001:67c:2050:104:0:1:25:1
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
Cc: Robert Vollmert <rob@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

* module/system/repl/debug.scm (print-frame): Print full object if
width keyword is #f.
* libguile/backtrace.c (display_backtrace_body): Call print-frames
with #:width #f.
---

This change was prompted by recent discussion on the Guix lists:
  https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00207.html
In Guix, the truncation of stack traces frequently obscures
important information due to the long filenames.

Apologies if this misses some obvious things, I'm not particularly
at home in the Guile sources. Let me know, happy to adapt!

Cheers
Robert

 libguile/backtrace.c         |  6 ++++--
 module/system/repl/debug.scm | 13 +++++++++----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/libguile/backtrace.c b/libguile/backtrace.c
index 4a19d4b8a..4d0b4ab94 100644
--- a/libguile/backtrace.c
+++ b/libguile/backtrace.c
@@ -77,6 +77,7 @@ boot_print_exception (SCM port, SCM frame, SCM key, SCM=
 args)
 static SCM print_exception_var;
 static SCM print_frame_var;
 static SCM kw_count;
+static SCM kw_width;
 static SCM print_frames_var;
 static SCM frame_to_stack_vector_var;
=20
@@ -99,6 +100,7 @@ static void
 init_print_frames_var_and_frame_to_stack_vector_var (void)
 {
   kw_count =3D scm_from_latin1_keyword ("count");
+  kw_width =3D scm_from_latin1_keyword ("width");
   print_frames_var =3D
     scm_c_public_variable ("system repl debug", "print-frames");
   frame_to_stack_vector_var =3D
@@ -236,8 +238,8 @@ display_backtrace_body (struct display_backtrace_args=
 *a)
                        scm_stack_ref (a->stack, a->first));
=20
   /* FIXME: highlight_objects */
-  scm_call_4 (scm_variable_ref (print_frames_var), frames, a->port,
-              kw_count, a->depth);
+  scm_call_6 (scm_variable_ref (print_frames_var), frames, a->port,
+              kw_count, a->depth, kw_width, SCM_BOOL_F);
  =20
   return SCM_UNSPECIFIED;
 }
diff --git a/module/system/repl/debug.scm b/module/system/repl/debug.scm
index 383d37921..7422bf980 100644
--- a/module/system/repl/debug.scm
+++ b/module/system/repl/debug.scm
@@ -135,10 +135,15 @@
          (col (and=3D> source source:column)))
     (if (and file (not (equal? file (source:pretty-file last-source))))
         (format port "~&In ~a:~&" file))
-    (format port "~9@a~:[~*~3_~;~3d~] ~v:@y~%"
-            (if line (format #f "~a:~a" line col) "")
-            index index width
-            (frame-call-representation frame #:top-frame? (zero? index))=
)
+    (if width
+      (format port "~9@a~:[~*~3_~;~3d~] ~v:@y~%"
+              (if line (format #f "~a:~a" line col) "")
+              index index width
+              (frame-call-representation frame #:top-frame? (zero? index=
)))
+      (format port "~9@a~:[~*~3_~;~3d~] ~a~%"
+              (if line (format #f "~a:~a" line col) "")
+              index index
+              (frame-call-representation frame #:top-frame? (zero? index=
))))
     (if full?
         (print-locals frame #:width width
                       #:per-line-prefix "     "))))
--=20
2.20.1 (Apple Git-117)





Acknowledgement sent to Robert Vollmert <rob@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#36677; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 22 Jul 2019 00:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.