guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WSDD Service Module


From: Simon Streit
Subject: Re: WSDD Service Module
Date: Tue, 25 Jan 2022 13:56:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello, thanks for your reply.

Ludovic Courtès <ludo@gnu.org> writes:
> My understanding is that you intend the ‘interface’ field to be either
> #f or a string, is that right?

I think it rather be a list of strings, since wsdd takes the list of
interfaces to listen to.  So it should expand to --interface eth0
--interface eth1, etc.

> When you write:
>
>   (interface)
>
> that means: “call the procedure bound to ‘interface’, passing it zero
> arguments”.  However, if ‘interface’ is a string, you cannot call it, so
> you get a wrong-type-to-apply error.
>
> Likewise, ‘for-each’ expects its second argument to be a list.  But
> here, ‘interface’ is supposedly a string, not a list, so if you do:
>
>   (for-each (lambda …) interface)
>
> you’ll get a wrong-type-argument error.

So I changed it, that interface is usually an empty list now, and with
for-each I'd like to have it expanded.  Good thing is, I've gotten at
least a step further, but only after hard coding the list as an argument
in the for-each expression.  So it should work?  It still doesn't.  And
I still don't understand how it is somehow not passed as a list
properly.

One thing I noticed, after hard coding the argument, the procedure is
not properly expanded in the constructor.  How come?  This is the output
in the service file:
--8<---------------cut here---------------start------------->8---
(make-forkexec-constructor
 (list "/gnu/store/6jpn21wnnyz59ii634hfbk34yy48nxrq-wsdd-0.6.4/bin/wsdd" 
"--hoplimit" "1" for-each
       (lambda
           (arg)
         (format #t "--interface ~s "
                 (arg)))
       (interface)
       "--workgroup" "WORKGROUP")
 #:user "wsdd" #:group "wsdd" #:log-file "/var/log/wsdd.log")
--8<---------------cut here---------------end--------------->8---

My for-each procedure and list works in my REPL, but it fails in Guix.
It might have to do with me trying to get on with
make-forkexec-constructor.  So this constructor needs a list of strings?
I put interfaces into a let*, and would call it in the constructor.
Unfortunately this results into an invalid G-expression.


Thanks for you help.  It is taking its time to get comfortable with
Guile.

I've attached the current state of the service too.

Attachment: wsdd.scm
Description: Binary data


Kind regards
Simon

reply via email to

[Prev in Thread] Current Thread [Next in Thread]