Subject: bug#24320: closed (Re: bug#24320: Error when printing foreign functions)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 03 Sep 2016 01:39:02 +0000

Your bug report

#24320: Error when printing foreign functions

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
24320: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24320
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#24320: Error when printing foreign functions
From: Robin Templeton <[email-masked]>
To: Andy Wingo <[email-masked]>
Cc: [email-masked]
Date: Fri, 02 Sep 2016 21:38:06 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Andy Wingo <[email-masked]> writes:

> On Sat 27 Aug 2016 20:05, Robin Templeton <[email-masked]> writes:
>
>> The following program causes `(@ (system vm program) print-program)' to
>> throw an exception when run in Guile 2.1.3.104-8f2f8:
>
> LGTM, please apply!

Thanks, now fixed in master

-- 
Inteligenta persono lernas la lingvon Esperanton rapide kaj facile.
Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla,
belsona, Esperanto estas la praktika solvo de la problemo de universala
interkompreno. Lernu la interlingvon Esperanton!

Subject: Error when printing foreign functions
From: Robin Templeton <[email-masked]>
To: [email-masked]
Date: Sat, 27 Aug 2016 14:05:25 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

The following program causes `(@ (system vm program) print-program)' to
throw an exception when run in Guile 2.1.3.104-8f2f8:

(use-modules (system foreign))
(format #t "~S~%"
 (pointer->procedure double
                     (dynamic-func "sqrt" (dynamic-link))
                     (list double)))

print-program tries to access fields of the procedure's debug info
record even if find-program-debug-info fails and returns #f. The
following patch fixes the problem.

>From 0ec7bff9e71f1c1c46fa3c1d2bdbc43f5db3588c Mon Sep 17 00:00:00 2001
From: Robin Templeton <[email-masked]>
Date: Sat, 27 Aug 2016 13:42:10 -0400
Subject: [PATCH] Check for missing debug info in print-program

* module/system/vm/program.scm (print-program): Check the return value
  of find-program-debug-info.
---
 module/system/vm/program.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index 9f5b764..32c96f2 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -265,7 +265,7 @@ lists."
          ;; It could be the procedure had its name property set via the
          ;; procedure property interface.
          (name (or (and program (procedure-name program))
-                   (program-debug-info-name pdi)))
+                   (and pdi (program-debug-info-name pdi))))
          (source (match (find-program-sources addr)
                    (() #f)
                    ((source . _) source)))
-- 
2.9.3