(home-)on-first-login script broken when no gexps are added

  • Done
  • quality assurance status badge
Details
5 participants
  • Carlo Zancanaro
  • Clément Lassieur
  • Ludovic Courtès
  • Nils Landt
  • Rostislav Svoboda
Owner
unassigned
Submitted by
Nils Landt
Severity
normal
N
N
Nils Landt wrote on 21 Oct 2023 08:14
(name . bug-guix@gnu.org)(address . bug-guix@gnu.org)
1084731920.55297.1697868845432@office.mailbox.org
Error message:

ice-9/psyntax.scm:2824:12: In procedure syntax-violation:
Syntax error:
/home/nl/.guix-home/on-first-login:3:1233: source expression failed to match any pattern in form (when (claim-first-run flag-file-path))

As you can see, there is no body in the "when" expression.

Code in gnu/home/services.scm:438 :

(if (file-exists? xdg-runtime-dir)
(when (claim-first-run flag-file-path)
#$@gexps)

In my case, it appears that gexps is empty, resulting in the invalid syntax.

Broken by b92235ea8b06e304072bad55ae006593ea673568
C
C
Carlo Zancanaro wrote on 21 Oct 2023 11:27
(name . Nils Landt)(address . nils@landt.email)(address . 66659@debbugs.gnu.org)
87pm18codq.fsf@zancanaro.id.au
On Sat, Oct 21 2023, Nils Landt wrote:
Toggle quote (11 lines)
> ...
> As you can see, there is no body in the "when" expression.
>
> Code in gnu/home/services.scm:438 :
>
> (if (file-exists? xdg-runtime-dir)
> (when (claim-first-run flag-file-path)
> #$@gexps)
>
> In my case, it appears that gexps is empty, resulting in the invalid syntax.

Ah, yep, that's an issue. That issue was introduced in 6b0a32196982a0a2f4dbb59d35e55833a5545ac6.

I guess this raises a question about how to resolve this: if we have no gexps, do we still want to claim the first run?

If yes: we can add #t (or whatever) to the end of the "when" form to make sure it's never empty.

If no: we can generate an empty on-first-login script that does nothing.

The previous behaviour was to still claim the first run, so I'll send through a patch that does that.

Carlo
C
C
Carlo Zancanaro wrote on 21 Oct 2023 11:39
[PATCH] home: services: Don't crash on-first-login when nothing to do
(address . 66659@debbugs.gnu.org)
c965aedf13b5146e2491aabae3ca823f8e089c9c.1697881003.git.carlo@zancanaro.id.au
* gnu/home/services.scm (compute-on-first-login-script): Ensure that WHEN is
syntactically valid in expansion.
---
gnu/home/services.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (20 lines)
diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 651c068f79..3f018e3893 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -435,7 +435,10 @@ (define (compute-on-first-login-script _ gexps)
;; after complete logout/reboot.
(if (file-exists? xdg-runtime-dir)
(when (claim-first-run flag-file-path)
- #$@gexps)
+ #$@gexps
+ ;; An empty WHEN body is not syntactically valid, so we put an
+ ;; arbitrary form here to ensure it's not empty.
+ #t)
;; TRANSLATORS: 'on-first-login' is the name of a service and
;; shouldn't be translated
(warning (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login script

base-commit: 80c8f5b57aa3699445fab29e0f75f5955e697509
--
2.41.0
L
L
Ludovic Courtès wrote on 21 Oct 2023 16:15
Re: bug#66659: (home-)on-first-login script broken when no gexps are added
(name . Carlo Zancanaro)(address . carlo@zancanaro.id.au)
87o7gsqcyc.fsf@gnu.org
Hi Carlo & Nils,

Carlo Zancanaro <carlo@zancanaro.id.au> skribis:

Toggle quote (22 lines)
> On Sat, Oct 21 2023, Nils Landt wrote:
>> ...
>> As you can see, there is no body in the "when" expression.
>>
>> Code in gnu/home/services.scm:438 :
>>
>> (if (file-exists? xdg-runtime-dir)
>> (when (claim-first-run flag-file-path)
>> #$@gexps)
>>
>> In my case, it appears that gexps is empty, resulting in the invalid syntax.
>
> Ah, yep, that's an issue. That issue was introduced in 6b0a32196982a0a2f4dbb59d35e55833a5545ac6.
>
> I guess this raises a question about how to resolve this: if we have no gexps, do we still want to claim the first run?
>
> If yes: we can add #t (or whatever) to the end of the "when" form to make sure it's never empty.
>
> If no: we can generate an empty on-first-login script that does nothing.
>
> The previous behaviour was to still claim the first run, so I'll send through a patch that does that.

I’ve just pushed something similar to what you provided, Carlo, in
commit e098ba2f499bbddfea50c85058e4077e39b85513.

We should be good now.

Thank you!

Ludo’.
Closed
N
N
Nils Landt wrote on 24 Oct 2023 12:05
Re: bug#66659: closed (Re: bug#66659: (home-)on-first-login script broken when no gexps are added)
(address . 66659@debbugs.gnu.org)
1963527562.259546.1698141941111@office.mailbox.org
Toggle quote (24 lines)
> help-debbugs@gnu.org hat am 21.10.2023 16:16 CEST geschrieben:
>
>
> Your bug report
>
> #66659: (home-)on-first-login script broken when no gexps are added
>
> which was filed against the guix package, has been closed.
>
> The explanation is attached below, along with your original report.
> If you require more details, please reply to 66659@debbugs.gnu.org.
>
> --
> 66659: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66659
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems
> Hi Carlo & Nils,
>

> I’ve just pushed something similar to what you provided, Carlo, in
> commit e098ba2f499bbddfea50c85058e4077e39b85513.
>
> We should be good now.

I'm afraid this did not fix the issue. It results in
(when (claim-first-run flag-file-path) (begin))

which leads to the new error message "Syntax error:
/home/nl/.guix-home/on-first-login:3:1272: sequence of zero expressions in form (begin)"
R
R
Rostislav Svoboda wrote on 24 Oct 2023 16:17
Re: (home-)on-first-login script broken when no gexps are added
(address . 66659@debbugs.gnu.org)
CAEtmmey7R=aD=nm_2yKUNXw0iMH2d6m-QjxE3GeuoaJ4GJurYQ@mail.gmail.com
Toggle quote (11 lines)
> > I've just pushed something similar to what you provided, Carlo, in
> > commit e098ba2f499bbddfea50c85058e4077e39b85513.
> >
> > We should be good now.
>
> I'm afraid this did not fix the issue. It results in
> (when (claim-first-run flag-file-path) (begin))
>
> which leads to the new error message "Syntax error:
> /home/nl/.guix-home/on-first-login:3:1272: sequence of zero expressions in form (begin)"

Adding *unspecified* works for me. I.e.:

(when (claim-first-run flag-file-path)
;; GEXPS can be empty, hence 'begin *unspecified*'. Having just
;; 'begin' without '*unspecified*' leads to
;; "Syntax error: ... sequence of zero expressions in form (begin)"
(begin *unspecified* #$@gexps))

The patch is in the attachment.

Cheers Bost
From 96da848ddeec11f207dabec64a5d314c28e6c46f Mon Sep 17 00:00:00 2001
Message-ID: <96da848ddeec11f207dabec64a5d314c28e6c46f.1698156887.git.Rostislav.Svoboda@gmail.com>
From: Rostislav Svoboda <Rostislav.Svoboda@gmail.com>
Date: Tue, 24 Oct 2023 16:08:10 +0200
Subject: [PATCH] =?UTF-8?q?home:=20services:=20Fix=20regression=20in=20gen?=
=?UTF-8?q?erated=20=E2=80=98on-first-login=E2=80=99=20script.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Fixes a regression introduced in 6b0a32196982a0a2f4dbb59d35e55833a5545ac6. The
first attempt in e098ba2f499bbddfea50c85058e4077e39b85513 to fix this issue didn't work.

* gnu/home/services.scm (compute-on-first-login-script): Add
‘begin *unspecified*’ around #$@gexps.

Change-Id: I14339ad684ffe93e692e507b57dcd221d96210ef
---
gnu/home/services.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (20 lines)
diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 282fed74c1..44f585aff5 100644
--- a/gnu/home/services.scm
+++ b/gnu/home/services.scm
@@ -435,7 +435,10 @@ (define (compute-on-first-login-script _ gexps)
;; after complete logout/reboot.
(if (file-exists? xdg-runtime-dir)
(when (claim-first-run flag-file-path)
- (begin #$@gexps)) ;GEXPS can be empty, hence 'begin'
+ ;; GEXPS can be empty, hence 'begin *unspecified*'. Having just
+ ;; 'begin' without '*unspecified*' leads to
+ ;; "Syntax error: ... sequence of zero expressions in form (begin)"
+ (begin *unspecified* #$@gexps))
;; TRANSLATORS: 'on-first-login' is the name of a service and
;; shouldn't be translated
(warning (G_ "XDG_RUNTIME_DIR doesn't exists, on-first-login script

base-commit: d22d2a05c389207f8cdcf824be7738b1499a987c
--
2.41.0
C
C
Clément Lassieur wrote on 25 Oct 2023 01:19
Re: bug#66659: (home-)on-first-login script broken when no gexps are added
(name . Nils Landt)(address . nils@landt.email)
875y2v38x8.fsf_-_@lassieur.org
Nils Landt <nils@landt.email> writes:

Toggle quote (11 lines)
>> I’ve just pushed something similar to what you provided, Carlo, in
>> commit e098ba2f499bbddfea50c85058e4077e39b85513.
>>
>> We should be good now.
>
> I'm afraid this did not fix the issue. It results in
> (when (claim-first-run flag-file-path) (begin))
>
> which leads to the new error message "Syntax error:
> /home/nl/.guix-home/on-first-login:3:1272: sequence of zero expressions in form (begin)"

Hi,

I just ran into the same issue.

Thanks,
Clément
C
C
Clément Lassieur wrote on 27 Oct 2023 16:53
(name . Rostislav Svoboda)(address . rostislav.svoboda@gmail.com)(address . 66659-done@debbugs.gnu.org)
87wmv8yv4o.fsf@lassieur.org
On Tue, Oct 24 2023, Rostislav Svoboda wrote:

Toggle quote (23 lines)
>> > I've just pushed something similar to what you provided, Carlo, in
>> > commit e098ba2f499bbddfea50c85058e4077e39b85513.
>> >
>> > We should be good now.
>>
>> I'm afraid this did not fix the issue. It results in
>> (when (claim-first-run flag-file-path) (begin))
>>
>> which leads to the new error message "Syntax error:
>> /home/nl/.guix-home/on-first-login:3:1272: sequence of zero expressions in form (begin)"
>
> Adding *unspecified* works for me. I.e.:
>
> (when (claim-first-run flag-file-path)
> ;; GEXPS can be empty, hence 'begin *unspecified*'. Having just
> ;; 'begin' without '*unspecified*' leads to
> ;; "Syntax error: ... sequence of zero expressions in form (begin)"
> (begin *unspecified* #$@gexps))
>
> The patch is in the attachment.
>
> Cheers Bost

Applied as 2de30042674197fe451c220745186e36465d06e2, thanks!
Clément
Closed
L
L
Ludovic Courtès wrote on 28 Oct 2023 00:22
(address . 66659@debbugs.gnu.org)
87lebnaeoq.fsf_-_@gnu.org
Hi,

Nils Landt <nils@landt.email> skribis:

Toggle quote (6 lines)
> I'm afraid this did not fix the issue. It results in
> (when (claim-first-run flag-file-path) (begin))
>
> which leads to the new error message "Syntax error:
> /home/nl/.guix-home/on-first-login:3:1272: sequence of zero expressions in form (begin)"

Oops, my bad. (I did check at the REPL that (begin) was fine but forgot
that I was checking the top-level ‘begin’ form, which is not the same as
the sequencing ‘begin’ form…)

Rostislav Svoboda <rostislav.svoboda@gmail.com> skribis:

Toggle quote (10 lines)
> Adding *unspecified* works for me. I.e.:
>
> (when (claim-first-run flag-file-path)
> ;; GEXPS can be empty, hence 'begin *unspecified*'. Having just
> ;; 'begin' without '*unspecified*' leads to
> ;; "Syntax error: ... sequence of zero expressions in form (begin)"
> (begin *unspecified* #$@gexps))
>
> The patch is in the attachment.

Thanks Rostislav and everyone, and apologies for not replying earlier!

Ludo’.
?