unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* How to get better stack trace from a script executed via shebang?
@ 2023-02-02 16:11 Wolf
  2023-02-02 16:35 ` Fabrizio Bianchi
  2023-02-02 16:39 ` Jean Abou Samra
  0 siblings, 2 replies; 7+ messages in thread
From: Wolf @ 2023-02-02 16:11 UTC (permalink / raw)
  To: guile-user

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

Hello,

I'm having a problem of getting borderline useless stack traces from a script
executed via a shebang. For example, let's consider following script:

    $ cat /tmp/x.scm 
    #!/bin/sh
    exec guile --no-auto-compile -e main -s "$0" "$@"
    !#
    
    (define (main args)
      (foo))
    
    (define (foo)
      (bar))
    
    (define (bar)
      (error "x"))

When I execute it directly, the error message is not great:

    $ /tmp/x.scm
    Backtrace:
    In ice-9/boot-9.scm:
      1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
    In unknown file:
               3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
    In ice-9/boot-9.scm:
        724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
    In ice-9/eval.scm:
        619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
    In ice-9/boot-9.scm:
       2007:7  0 (error _ . _)
    
    ice-9/boot-9.scm:2007:7: In procedure error:
    x

The /tmp/x.scm file is not even mentioned once in the output. Can this be
somehow (command line arguments, changing the exec line, ...) improved?
Currently it's not very useful when I need to find out what the problem was.

Thank you,
W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:11 How to get better stack trace from a script executed via shebang? Wolf
@ 2023-02-02 16:35 ` Fabrizio Bianchi
  2023-02-02 16:39   ` Fabrizio Bianchi
                     ` (2 more replies)
  2023-02-02 16:39 ` Jean Abou Samra
  1 sibling, 3 replies; 7+ messages in thread
From: Fabrizio Bianchi @ 2023-02-02 16:35 UTC (permalink / raw)
  To: guile-user

salve. Ho letto il vostro messaggio.
Purtroppo non capisco quale sia il problema.
Provi a sentire la community. Ho installato dal sito FSF.org il guile 3.0.9
bianchi fabrizio


Il giorno gio 2 feb 2023 alle ore 17:13 Wolf <wolf@wolfsden.cz> ha scritto:

> Hello,
>
> I'm having a problem of getting borderline useless stack traces from a
> script
> executed via a shebang. For example, let's consider following script:
>
>     $ cat /tmp/x.scm
>     #!/bin/sh
>     exec guile --no-auto-compile -e main -s "$0" "$@"
>     !#
>
>     (define (main args)
>       (foo))
>
>     (define (foo)
>       (bar))
>
>     (define (bar)
>       (error "x"))
>
> When I execute it directly, the error message is not great:
>
>     $ /tmp/x.scm
>     Backtrace:
>     In ice-9/boot-9.scm:
>       1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type
> _)
>     In unknown file:
>                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
>     In ice-9/boot-9.scm:
>         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at
> ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
>     In ice-9/eval.scm:
>         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
>     In ice-9/boot-9.scm:
>        2007:7  0 (error _ . _)
>
>     ice-9/boot-9.scm:2007:7: In procedure error:
>     x
>
> The /tmp/x.scm file is not even mentioned once in the output. Can this be
> somehow (command line arguments, changing the exec line, ...) improved?
> Currently it's not very useful when I need to find out what the problem
> was.
>
> Thank you,
> W.
>
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:11 How to get better stack trace from a script executed via shebang? Wolf
  2023-02-02 16:35 ` Fabrizio Bianchi
@ 2023-02-02 16:39 ` Jean Abou Samra
  2023-02-02 16:51   ` wolf
  1 sibling, 1 reply; 7+ messages in thread
From: Jean Abou Samra @ 2023-02-02 16:39 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 1547 bytes --]

On 02/02/2023 17:11, Wolf wrote:
> Hello,
> 
> I'm having a problem of getting borderline useless stack traces from a script
> executed via a shebang. For example, let's consider following script:
> 
>     $ cat /tmp/x.scm 
>     #!/bin/sh
>     exec guile --no-auto-compile -e main -s "$0" "$@"
>     !#
>     
>     (define (main args)
>       (foo))
>     
>     (define (foo)
>       (bar))
>     
>     (define (bar)
>       (error "x"))
> 
> When I execute it directly, the error message is not great:
> 
>     $ /tmp/x.scm
>     Backtrace:
>     In ice-9/boot-9.scm:
>       1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
>     In unknown file:
>                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
>     In ice-9/boot-9.scm:
>         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
>     In ice-9/eval.scm:
>         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
>     In ice-9/boot-9.scm:
>        2007:7  0 (error _ . _)
>     
>     ice-9/boot-9.scm:2007:7: In procedure error:
>     x
> 
> The /tmp/x.scm file is not even mentioned once in the output. Can this be
> somehow (command line arguments, changing the exec line, ...) improved?
> Currently it's not very useful when I need to find out what the problem was.



This is a known issue for code that is evaluated, as opposed
to being compiled. Consider leaving out --no-auto-compile.

Best,
Jean



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:35 ` Fabrizio Bianchi
@ 2023-02-02 16:39   ` Fabrizio Bianchi
  2023-02-02 16:46   ` Fabrizio Bianchi
  2023-02-02 16:52   ` wolf
  2 siblings, 0 replies; 7+ messages in thread
From: Fabrizio Bianchi @ 2023-02-02 16:39 UTC (permalink / raw)
  To: guile-user

Dal terminale ho eseguito il seguente comando  apt-get install guile-3.0.
bianchi fabrizio


Il giorno gio 2 feb 2023 alle ore 17:35 Fabrizio Bianchi <
fabriziobianchi51@gmail.com> ha scritto:

> salve. Ho letto il vostro messaggio.
> Purtroppo non capisco quale sia il problema.
> Provi a sentire la community. Ho installato dal sito FSF.org il guile 3.0.9
> bianchi fabrizio
>
>
> Il giorno gio 2 feb 2023 alle ore 17:13 Wolf <wolf@wolfsden.cz> ha
> scritto:
>
>> Hello,
>>
>> I'm having a problem of getting borderline useless stack traces from a
>> script
>> executed via a shebang. For example, let's consider following script:
>>
>>     $ cat /tmp/x.scm
>>     #!/bin/sh
>>     exec guile --no-auto-compile -e main -s "$0" "$@"
>>     !#
>>
>>     (define (main args)
>>       (foo))
>>
>>     (define (foo)
>>       (bar))
>>
>>     (define (bar)
>>       (error "x"))
>>
>> When I execute it directly, the error message is not great:
>>
>>     $ /tmp/x.scm
>>     Backtrace:
>>     In ice-9/boot-9.scm:
>>       1752:10  4 (with-exception-handler _ _ #:unwind? _
>> #:unwind-for-type _)
>>     In unknown file:
>>                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
>>     In ice-9/boot-9.scm:
>>         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at
>> ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
>>     In ice-9/eval.scm:
>>         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
>>     In ice-9/boot-9.scm:
>>        2007:7  0 (error _ . _)
>>
>>     ice-9/boot-9.scm:2007:7: In procedure error:
>>     x
>>
>> The /tmp/x.scm file is not even mentioned once in the output. Can this be
>> somehow (command line arguments, changing the exec line, ...) improved?
>> Currently it's not very useful when I need to find out what the problem
>> was.
>>
>> Thank you,
>> W.
>>
>> --
>> There are only two hard things in Computer Science:
>> cache invalidation, naming things and off-by-one errors.
>>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:35 ` Fabrizio Bianchi
  2023-02-02 16:39   ` Fabrizio Bianchi
@ 2023-02-02 16:46   ` Fabrizio Bianchi
  2023-02-02 16:52   ` wolf
  2 siblings, 0 replies; 7+ messages in thread
From: Fabrizio Bianchi @ 2023-02-02 16:46 UTC (permalink / raw)
  To: guile-user

$ sudo apt-get install guile-3.0
bianchi fabrizio


Il giorno gio 2 feb 2023 alle ore 17:35 Fabrizio Bianchi <
fabriziobianchi51@gmail.com> ha scritto:

> salve. Ho letto il vostro messaggio.
> Purtroppo non capisco quale sia il problema.
> Provi a sentire la community. Ho installato dal sito FSF.org il guile 3.0.9
> bianchi fabrizio
>
>
> Il giorno gio 2 feb 2023 alle ore 17:13 Wolf <wolf@wolfsden.cz> ha
> scritto:
>
>> Hello,
>>
>> I'm having a problem of getting borderline useless stack traces from a
>> script
>> executed via a shebang. For example, let's consider following script:
>>
>>     $ cat /tmp/x.scm
>>     #!/bin/sh
>>     exec guile --no-auto-compile -e main -s "$0" "$@"
>>     !#
>>
>>     (define (main args)
>>       (foo))
>>
>>     (define (foo)
>>       (bar))
>>
>>     (define (bar)
>>       (error "x"))
>>
>> When I execute it directly, the error message is not great:
>>
>>     $ /tmp/x.scm
>>     Backtrace:
>>     In ice-9/boot-9.scm:
>>       1752:10  4 (with-exception-handler _ _ #:unwind? _
>> #:unwind-for-type _)
>>     In unknown file:
>>                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
>>     In ice-9/boot-9.scm:
>>         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at
>> ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
>>     In ice-9/eval.scm:
>>         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
>>     In ice-9/boot-9.scm:
>>        2007:7  0 (error _ . _)
>>
>>     ice-9/boot-9.scm:2007:7: In procedure error:
>>     x
>>
>> The /tmp/x.scm file is not even mentioned once in the output. Can this be
>> somehow (command line arguments, changing the exec line, ...) improved?
>> Currently it's not very useful when I need to find out what the problem
>> was.
>>
>> Thank you,
>> W.
>>
>> --
>> There are only two hard things in Computer Science:
>> cache invalidation, naming things and off-by-one errors.
>>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:39 ` Jean Abou Samra
@ 2023-02-02 16:51   ` wolf
  0 siblings, 0 replies; 7+ messages in thread
From: wolf @ 2023-02-02 16:51 UTC (permalink / raw)
  To: Jean Abou Samra; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 2480 bytes --]

On 2023-02-02 17:39:50 +0100, Jean Abou Samra wrote:
> On 02/02/2023 17:11, Wolf wrote:
> > Hello,
> > 
> > I'm having a problem of getting borderline useless stack traces from a script
> > executed via a shebang. For example, let's consider following script:
> > 
> >     $ cat /tmp/x.scm 
> >     #!/bin/sh
> >     exec guile --no-auto-compile -e main -s "$0" "$@"
> >     !#
> >     
> >     (define (main args)
> >       (foo))
> >     
> >     (define (foo)
> >       (bar))
> >     
> >     (define (bar)
> >       (error "x"))
> > 
> > When I execute it directly, the error message is not great:
> > 
> >     $ /tmp/x.scm
> >     Backtrace:
> >     In ice-9/boot-9.scm:
> >       1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
> >     In unknown file:
> >                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
> >     In ice-9/boot-9.scm:
> >         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
> >     In ice-9/eval.scm:
> >         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
> >     In ice-9/boot-9.scm:
> >        2007:7  0 (error _ . _)
> >     
> >     ice-9/boot-9.scm:2007:7: In procedure error:
> >     x
> > 
> > The /tmp/x.scm file is not even mentioned once in the output. Can this be
> > somehow (command line arguments, changing the exec line, ...) improved?
> > Currently it's not very useful when I need to find out what the problem was.
> 
> 
> 
> This is a known issue for code that is evaluated, as opposed
> to being compiled. Consider leaving out --no-auto-compile.

Oh, I was not aware of that. You suggestion does indeed make it better, thank
you.

    ;;; note: source file /mnt/shared/system/./run
    ;;;       newer than compiled /root/.cache/guile/ccache/3.0-LE-8-4.6/mnt/shared/system/run.go
    ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
    ;;;       or pass the --no-auto-compile argument to disable.
    ;;; compiling /mnt/shared/system/./run
    ;;; compiled /root/.cache/guile/ccache/3.0-LE-8-4.6/mnt/shared/system/run.go

Now there is this output that as far as I know cannot be suppressed (that was
the reason for --no-auto-compile), but that seems like lesser of two evils
here.

So, thanks :)

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to get better stack trace from a script executed via shebang?
  2023-02-02 16:35 ` Fabrizio Bianchi
  2023-02-02 16:39   ` Fabrizio Bianchi
  2023-02-02 16:46   ` Fabrizio Bianchi
@ 2023-02-02 16:52   ` wolf
  2 siblings, 0 replies; 7+ messages in thread
From: wolf @ 2023-02-02 16:52 UTC (permalink / raw)
  To: Fabrizio Bianchi; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 2143 bytes --]

On 2023-02-02 17:35:33 +0100, Fabrizio Bianchi wrote:
> salve. Ho letto il vostro messaggio.
> Purtroppo non capisco quale sia il problema.
> Provi a sentire la community. Ho installato dal sito FSF.org il guile 3.0.9
> bianchi fabrizio

Sorry, I don't speak Italian(?), so I have no idea what this message says.

> 
> 
> Il giorno gio 2 feb 2023 alle ore 17:13 Wolf <wolf@wolfsden.cz> ha scritto:
> 
> > Hello,
> >
> > I'm having a problem of getting borderline useless stack traces from a
> > script
> > executed via a shebang. For example, let's consider following script:
> >
> >     $ cat /tmp/x.scm
> >     #!/bin/sh
> >     exec guile --no-auto-compile -e main -s "$0" "$@"
> >     !#
> >
> >     (define (main args)
> >       (foo))
> >
> >     (define (foo)
> >       (bar))
> >
> >     (define (bar)
> >       (error "x"))
> >
> > When I execute it directly, the error message is not great:
> >
> >     $ /tmp/x.scm
> >     Backtrace:
> >     In ice-9/boot-9.scm:
> >       1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type
> > _)
> >     In unknown file:
> >                3 (apply-smob/0 #<thunk 7fdb1e7a2340>)
> >     In ice-9/boot-9.scm:
> >         724:2  2 (call-with-prompt ("prompt") #<procedure 7fdb1e7b2c80 at
> > ice-9/eval.scm:330:13 ()> #<procedure default-prompt-handler (k proc)>)
> >     In ice-9/eval.scm:
> >         619:8  1 (_ #(#(#<directory (guile-user) 7fdb1e7a5c80>)))
> >     In ice-9/boot-9.scm:
> >        2007:7  0 (error _ . _)
> >
> >     ice-9/boot-9.scm:2007:7: In procedure error:
> >     x
> >
> > The /tmp/x.scm file is not even mentioned once in the output. Can this be
> > somehow (command line arguments, changing the exec line, ...) improved?
> > Currently it's not very useful when I need to find out what the problem
> > was.
> >
> > Thank you,
> > W.
> >
> > --
> > There are only two hard things in Computer Science:
> > cache invalidation, naming things and off-by-one errors.
> >

W.

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-02 16:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 16:11 How to get better stack trace from a script executed via shebang? Wolf
2023-02-02 16:35 ` Fabrizio Bianchi
2023-02-02 16:39   ` Fabrizio Bianchi
2023-02-02 16:46   ` Fabrizio Bianchi
2023-02-02 16:52   ` wolf
2023-02-02 16:39 ` Jean Abou Samra
2023-02-02 16:51   ` wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).