[PATCH] gnu: guile-smc: Update to 0.5.0

  • Done
  • quality assurance status badge
Details
3 participants
  • Maxime Devos
  • Mathieu Othacehe
  • Artyom V. Poptsov
Owner
unassigned
Submitted by
Artyom V. Poptsov
Severity
normal

Debbugs page

Artyom V. Poptsov wrote 3 years ago
(address . guix-patches@gnu.org)
87pmgqsss3.fsf@gmail.com
Hello,

this patch updates Guile-SMC[1] to 0.5.0.
From 048da8ec39829ed1e03c8256fb3e4b44d22ebd51 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Tue, 23 Aug 2022 21:10:13 +0300
Subject: [PATCH 1/2] gnu: guile-smc: Update to 0.5.0.

* gnu/packages/guile-xyz.scm (guile-smc): Update to 0.5.0.
---
gnu/packages/guile-xyz.scm | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index a85c7e0fc4..69f629638b 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4796,7 +4796,7 @@ (define-public guile-gitlab
(define-public guile-smc
(package
(name "guile-smc")
- (version "0.3.0")
+ (version "0.5.0")
(source
(origin
(method git-fetch)
@@ -4806,7 +4806,7 @@ (define-public guile-smc
(file-name (string-append name "-" version))
(sha256
(base32
- "0szkjmasi70m1vppck7nhdxg4lnxzjq6mihi6r1552s8sxm5z008"))))
+ "03imz9bfvvj8xnwxjaw7b26capvlwq921kqq5yzlzv15ngidky72"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
@@ -4829,12 +4829,11 @@ (define-public guile-smc
(format #f
"#:init-value \"~a/bin/logger\""
(assoc-ref inputs "inetutils")))
- (("\\(add-handler! %logger %syslog\\)")
- (string-append
- "(add-handler! %logger\n"
- " (make <rotating-log>\n"
- " #:file-name \"smc.log\"))\n")))
- #t))
+ (("\\(add-handler! %logger %syslog\\)")
+ (string-append
+ "(add-handler! %logger\n"
+ " (make <port-log/us>\n"
+ " #:port (open-file \"/tmp/smc.log\" \"a+\")))\n")))))
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -4854,12 +4853,12 @@ (define-public guile-smc
,(string-append guile-lib go)))))
#t)))))
(native-inputs
- (list autoconf automake pkg-config texinfo))
+ (list autoconf automake pkg-config texinfo help2man))
(inputs
- `(("bash" ,bash-minimal)
- ("guile" ,guile-3.0)
- ("guile-lib" ,guile-lib)
- ("inetutils" ,inetutils)))
+ (list bash-minimal
+ guile-3.0
+ guile-lib
+ inetutils))
(home-page "https://github.com/artyom-poptsov/guile-smc")
(synopsis "GNU Guile state machine compiler")
(description
--
2.34.1
- Artyom

References:

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmMFIEwZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigL2O9CAC21dAXL89hj7xYFOPY9Arw
MhRktVMKGNDr2lcKYVhRK1Ixwp+jvX8u3GIBS+CCRislb0C2wakHGKXn5SGv8RQI
0jyD17ExZ39t4BWa8AYY/yiDoGDl+bNzwDQZPirYWeLpIiujHBo+q7rnugDlfhHN
KGQukP6WdNbb9PiuPrrHttJ85iPofCy9lZJGp13Teard5CS1Z3qPlELCV4/l1HZW
kX5qtWoAuXHLGezvkGax1JfN1es4mkZBX1a+a3BeePStyBzA/3l06MKTsHVnDc48
SLjbNpGDzKuyAJByJA6EWnxZsFH6Ehk2zMkPU8olUtr4ZYzUOgUBoUpCFy3nQ8XX
=fbx4
-----END PGP SIGNATURE-----

Mathieu Othacehe wrote 3 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 57365@debbugs.gnu.org)
874jxzyvpv.fsf@gnu.org
Hey Artyom,

Toggle quote (11 lines)
> - (string-append
> - "(add-handler! %logger\n"
> - " (make <rotating-log>\n"
> - " #:file-name \"smc.log\"))\n")))
> - #t))
> + (("\\(add-handler! %logger %syslog\\)")
> + (string-append
> + "(add-handler! %logger\n"
> + " (make <port-log/us>\n"
> + " #:port (open-file \"/tmp/smc.log\" \"a+\")))\n")))))

What is this patch about? Can't it be upstreamed?

Toggle quote (2 lines)
> + (list autoconf automake pkg-config texinfo help2man))

You need to describe it in the commit message:

[native-inputs]: Add help2man.

Toggle quote (5 lines)
> + (list bash-minimal
> + guile-3.0
> + guile-lib
> + inetutils))

Ditto:

[inputs]: Use the new inputs style.

Can you send an updated patch?

Thanks,

Mathieu
Artyom V. Poptsov wrote 3 years ago
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 57365@debbugs.gnu.org)
871qt2v0k0.fsf@gmail.com
Hello Mathieu,

Thanks for my patch review!

Toggle quote (2 lines)
> What is this patch about? Can't it be upstreamed?

As you can see from the package description of Guile-SMC 0.3.0 there was
already a problem with logging; I just tried to fix that patch for the
current release.

Guile-SMC tries to log to the syslog by default but it seems that this
option is not working in Guix, so we need another way to log the
messages. Or it may be that I just overlooked something.

I wasn't able to use "<rotating-log>" anymore as Guile-SMC now uses
custom microsecond-resolution logging backend (which is required for the
FSM profiler to work properly.) The problem is that this backend does
not work well with "<rotating-log>". With the new snipped Guile-SMC
uses its "<port-log/us>" class to log the messages to
"/tmp/smc.log.<number>" file.

I wish we had more advanced logging functionality in GNU Guile core
modules but that a discussion for another thread I think.

For now I agree that this snipped looks a bit hacky but that is the
solution a I came up with trying to fix things fast.

If you have any ideas on how to improve the snippet (or the logging in
Guile-SMC for that matter), I'm all ears.

Meanwhile I try to do something with Guile-SMC logging myself.

Toggle quote (8 lines)
> You need to describe it in the commit message:
>
> [native-inputs]: Add help2man.

> Ditto:
>
> [inputs]: Use the new inputs style.

Done.

Here's the updated patch.
From be2605d82a44f22391b831a7090ff3ae5956d545 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Tue, 23 Aug 2022 21:10:13 +0300
Subject: [PATCH 1/2] gnu: guile-smc: Update to 0.5.0.

* gnu/packages/guile-xyz.scm (guile-smc): Update to 0.5.0.
[native-inputs]: Add help2man.
[inputs]: Use the new inputs style.
---
gnu/packages/guile-xyz.scm | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index a85c7e0fc4..69f629638b 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4796,7 +4796,7 @@ (define-public guile-gitlab
(define-public guile-smc
(package
(name "guile-smc")
- (version "0.3.0")
+ (version "0.5.0")
(source
(origin
(method git-fetch)
@@ -4806,7 +4806,7 @@ (define-public guile-smc
(file-name (string-append name "-" version))
(sha256
(base32
- "0szkjmasi70m1vppck7nhdxg4lnxzjq6mihi6r1552s8sxm5z008"))))
+ "03imz9bfvvj8xnwxjaw7b26capvlwq921kqq5yzlzv15ngidky72"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
@@ -4829,12 +4829,11 @@ (define-public guile-smc
(format #f
"#:init-value \"~a/bin/logger\""
(assoc-ref inputs "inetutils")))
- (("\\(add-handler! %logger %syslog\\)")
- (string-append
- "(add-handler! %logger\n"
- " (make <rotating-log>\n"
- " #:file-name \"smc.log\"))\n")))
- #t))
+ (("\\(add-handler! %logger %syslog\\)")
+ (string-append
+ "(add-handler! %logger\n"
+ " (make <port-log/us>\n"
+ " #:port (open-file \"/tmp/smc.log\" \"a+\")))\n")))))
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -4854,12 +4853,12 @@ (define-public guile-smc
,(string-append guile-lib go)))))
#t)))))
(native-inputs
- (list autoconf automake pkg-config texinfo))
+ (list autoconf automake pkg-config texinfo help2man))
(inputs
- `(("bash" ,bash-minimal)
- ("guile" ,guile-3.0)
- ("guile-lib" ,guile-lib)
- ("inetutils" ,inetutils)))
+ (list bash-minimal
+ guile-3.0
+ guile-lib
+ inetutils))
(home-page "https://github.com/artyom-poptsov/guile-smc")
(synopsis "GNU Guile state machine compiler")
(description
--
2.34.1
- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmMJjHAZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigL2hUB/9SKnV5eZftUSX4ai9kyqmv
VjGc16D1IUJavBJ/5wAAdfJQpFUTXVT17QKOkG4TlaMI2iOAMDD+ko9EVQnkoxx5
HCYxjdzL4LcNsLclFl6DZksTSc7jTntK0wU0crn7VagX4Y8KtnuMc0F2iWaTUK5J
Gx2gGgJbtMUPeQpKjU3PupdrN+pPBiMchyiXwoDZ18GRrBFpIqLA8mVXQgGDWwCc
YsCcKTBRhZeYDUbwTo6fbzbzgSEGmeRPmDghB8t/+bzdGI22iTFAHe7xX+8U7N6c
isAeN7CbTyZE8kfSTDLVVJbbK0KB62EFqJS728CmSe+OBRGX64Gv1AiRUNHcverR
=f2bP
-----END PGP SIGNATURE-----

Maxime Devos wrote 3 years ago
Re: [bug#57365] [PATCH] gnu: guile-smc: Update to 0.5.0
(address . 57365@debbugs.gnu.org)
13f03fda-ca68-59d1-c6ec-b4b67fee14a6@telenet.be
On 26-08-2022 15:34, Mathieu Othacehe wrote:
Toggle quote (5 lines)
> + (("\\(add-handler! %logger %syslog\\)")
> + (string-append
> + "(add-handler! %logger\n"
> + " (make <port-log/us>\n"
> + " #:port (open-file \"/tmp/smc.log\" \"a+\")))\n")))))
When is this /tmp/smc.log used? When compiling guile-smc or when running
guile-smc?
If the latter, an attacker on a multi-user system could use it to make
you append to files the attacker ordinarily doesn't have access to --
consider guile-smc being in a process as root and the attacker creating
/tmp/smc.log as a symlink to /etc/passwd first, depending on what was
logged, there is now an additional entry in there or its corrupted,
preventing booting.
Toggle quote (3 lines)
> Guile-SMC tries to log to the syslog by default but it seems that this
> option is not working in Guix, so we need another way to log the
> messages. Or it may be that I just overlooked something.
I do think it works, at least there are plenty of mentions of 'syslog'
in the Guix repository. However, possibly the build container forbids
access (unverified), maybe for running tests you need a different logger.
Greetings,
Maxime.
Attachment: OpenPGP_signature
Artyom V. Poptsov wrote 3 years ago
Re: bug#57365: [PATCH] gnu: guile-smc: Update to 0.5.0
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 57365@debbugs.gnu.org)
871qsuwb4y.fsf@gmail.com
Hello,

I released Guile-SMC 0.5.2:

And Guile-INI 0.5.1:

So I updated both Guile-SMC and Guile-INI package definitions
accordingly.

Not sure if I should create a new thread in the mailing list for this.

For now please find updated patches attached below.
From 44c116ba5935b925fe976a720283a19f53128906 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Tue, 23 Aug 2022 21:10:13 +0300
Subject: [PATCH 1/2] gnu: guile-smc: Update to 0.5.2.

* gnu/packages/guile-xyz.scm (guile-smc): Update to 0.5.2.
[native-inputs]: Add "help2man" and "which".
[inputs]: Use the new inputs style.
---
gnu/packages/guile-xyz.scm | 31 +++++++------------------------
1 file changed, 7 insertions(+), 24 deletions(-)

Toggle diff (66 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 8ba38c87d8..11fa92d08a 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4864,7 +4864,7 @@ (define-public guile-gitlab
(define-public guile-smc
(package
(name "guile-smc")
- (version "0.3.0")
+ (version "0.5.2")
(source
(origin
(method git-fetch)
@@ -4874,7 +4874,7 @@ (define-public guile-smc
(file-name (string-append name "-" version))
(sha256
(base32
- "0szkjmasi70m1vppck7nhdxg4lnxzjq6mihi6r1552s8sxm5z008"))))
+ "05q20vi59whjs7jb8bgcxnnfy6c3wx26m5ps2fwlsz52nggarxzb"))))
(build-system gnu-build-system)
(arguments
`(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
@@ -4886,23 +4886,6 @@ (define-public guile-smc
#:phases
(modify-phases %standard-phases
(delete 'strip)
- (add-after 'configure 'patch
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (substitute* "modules/smc/core/log.scm"
- ((" #:use-module \\(logging logger\\)")
- (string-append
- " #:use-module (logging logger)\n"
- " #:use-module (logging rotating-log)"))
- (("#:init-value \"logger\"")
- (format #f
- "#:init-value \"~a/bin/logger\""
- (assoc-ref inputs "inetutils")))
- (("\\(add-handler! %logger %syslog\\)")
- (string-append
- "(add-handler! %logger\n"
- " (make <rotating-log>\n"
- " #:file-name \"smc.log\"))\n")))
- #t))
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -4922,12 +4905,12 @@ (define-public guile-smc
,(string-append guile-lib go)))))
#t)))))
(native-inputs
- (list autoconf automake pkg-config texinfo))
+ (list autoconf automake pkg-config texinfo help2man which))
(inputs
- `(("bash" ,bash-minimal)
- ("guile" ,guile-3.0)
- ("guile-lib" ,guile-lib)
- ("inetutils" ,inetutils)))
+ (list bash-minimal
+ guile-3.0
+ guile-lib
+ inetutils))
(home-page "https://github.com/artyom-poptsov/guile-smc")
(synopsis "GNU Guile state machine compiler")
(description
--
2.34.1
From a9eff226c36bf0a8a1356da17f5ca1434fa9d593 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Tue, 23 Aug 2022 21:41:47 +0300
Subject: [PATCH 2/2] gnu: guile-ini: Update to 0.5.1.

* gnu/packages/guile-xyz.scm (guile-ini): Update to 0.5.1.
---
gnu/packages/guile-xyz.scm | 45 +++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 20 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 11fa92d08a..7df3012568 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -4931,28 +4931,33 @@ (define-public guile-smc
(define-public guile-ini
(package
(name "guile-ini")
- (version "0.3.0")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/artyom-poptsov/guile-ini")
- (commit (string-append "v" version))))
- (file-name (string-append name "-" version))
- (sha256
- (base32
- "0injn60530valhx3gsmdp72g6z886yf0n08hscky21h3dafm14kc"))))
+ (version "0.5.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/artyom-poptsov/guile-ini")
+ (commit (string-append "v" version))))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "0ky7sffxywc2p84q5kdsphr99q0g5gy45rj0vx7f77hwpfm2093x"))))
(build-system gnu-build-system)
(arguments
- `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
- (native-inputs
- (list autoconf automake pkg-config texinfo))
- (inputs
- `(("bash" ,bash-minimal)
- ("guile" ,guile-3.0)
- ("guile-lib" ,guile-lib)))
- (propagated-inputs
- (list guile-smc))
+ `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
+ #:phases (modify-phases %standard-phases
+ (delete 'strip)
+ (add-before 'build 'generate-fsm-context
+ ;; Make sure the intermediate FSM context is present
+ ;; before the build.
+ (lambda _
+ (let ((cwd (getcwd)))
+ (chdir "modules/ini/")
+ (invoke "make" "GUILE_AUTO_COMPILE=0"
+ "fsm-context.scm")
+ (chdir cwd)))))))
+ (native-inputs (list autoconf automake pkg-config texinfo))
+ (inputs (list bash-minimal guile-3.0 guile-lib))
+ (propagated-inputs (list guile-smc))
(home-page "https://github.com/artyom-poptsov/guile-ini")
(synopsis "Guile library for INI format support")
(description
--
2.34.1
Thanks,

- Artyom
--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQFNBAEBCgA3FiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmMRoJ0ZHHBvcHRzb3Yu
YXJ0eW9tQGdtYWlsLmNvbQAKCRDpxaLZCJigLx/LB/93aapUJ/WWUwF7el3yCoMB
63qNi9H7RwE/uMub2/DW4UpV3jjHo3+96e3my5ZBL5sFYTXR1wD3xu6zMAI0Y6sI
N9ztQc4eP5hMeIZ4AkBfRPWa+DEy3NGoc299Yxa0DPn8OrU9CtqWsqmqHrRM3Q/C
26FUiudjuSz75cBEC0YvPTs4e40t0gS8OXSB7hqYw6vgwZYaxfvuSli3KWHFa903
Zh2zuADOPDSrDC5O9X1dWjzeq5h4xI47FHsJ3ot6BT9GI5Nca1D9mZPi7hPVdMUn
L1eCD0JKY8Vu7G8jomWbyDcpJLMHRRzP4j7+159EWQ5Iwg1vC+zEokYrJm7SOjxq
=35Ez
-----END PGP SIGNATURE-----

Mathieu Othacehe wrote 3 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 57365-done@debbugs.gnu.org)
877d2mb508.fsf@gnu.org
Hey Artyom,

Toggle quote (4 lines)
> Not sure if I should create a new thread in the mailing list for this.
>
> For now please find updated patches attached below.

It's great that you found a way to deal with logging. Guile-SMC looks
fun, can't wait to test it :).

Pushed both patches.

Thanks,

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 57365@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57365
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help