Subject: Re: bug#20037: 'guix system reconfigure' without 'gnu/system/linux.go' fails with duplicates login pam-service
From: [email-masked] (Ludovic Courtès)
To: 宋文武 <[email-masked]>
Cc: [email-masked]
Date: Tue, 10 Mar 2015 18:13:23 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

宋文武 <[email-masked]> skribis:

> I can reproduce the issue Tomáš Čech (Sleep_Walker) reported at IRC,
> but only when reconfigure under 'pre-inst-env' and without 'gnu/system/linux.go':

Thanks a lot for finding it out, it’s an interesting bug!

The problem was that ‘pam-service->directory’ would get a different list
of objects depending on whether (gnu packages linux) is evaluated or
running from bytecode: when evaluated, the list would contain duplicate
services, leading to the build error you reported, but when running from
bytecode, the list is deduplicated.

This is because (gnu system) would call ‘delete-duplicates’ on the list
of PAM services, thereby using ‘equal?’ to compare them.  But since
<pam-service> include gexps, which include closures, ‘equal?’ could
return #t when running the compiled code (because in effect the gexps in
‘unix-pam-service’ would not lead to the allocation of fresh closures at
each call, so the gexps would be ‘eq?’), whereas with the evaluated
code, it would systematically return #f (we get fresh closures at each
‘unix-pam-service’ call.)

Commit 11dddd8 fixes that.

Thanks to both of you!

Ludo’.