Subject: [bug#77266] [PATCH v4 1/2] gnu: Merge xorg configurations when extending.

From: Ian Eure <[email-masked]>
Date: Mon, 12 May 2025 07:09:25 -0700

Ludovic Courtès <[email-masked]> writes:

> Hi Ian,
>
> Ian Eure <[email-masked]> writes:
>
>> +(define (merge-xorg-configurations a b)
>> +  (let ((configs (list b a)))           ; Prefer later 
>> configurations.
>> +    (xorg-configuration
>> +     (modules
>> +      (delete-duplicates (append-map 
>> xorg-configuration-modules configs)))
>> +     (fonts
>> +      (delete-duplicates (append-map xorg-configuration-fonts 
>> configs)))
>> +     (drivers
>> +      (delete-duplicates (append-map 
>> xorg-configuration-drivers configs)))
>> +     (resolutions
>> +      (delete-duplicates (append-map 
>> xorg-configuration-resolutions configs)))
>
> As I mentioned before, since ‘equal?’ cannot be meaningfully 
> applied
> here on file-like objects in general, all these 
> ‘delete-duplicates’
> calls should be removed.

Hmm, I thought your previous comment was about the `extra-config' 
field specifically, and I did update that one.  I agree that’s a 
problem, but I’m not sure about the other ones, ex. `drivers' is 
documented as containing a "list of strings."  I can see an 
argument for consistent behavior of deduplication here, and having 
it all in one place.

>>  (define (xorg-configuration->file config)
>>    "Compute an Xorg configuration file corresponding to CONFIG, 
>>    an
>>  <xorg-configuration> record."
>> @@ -334,9 +362,12 @@ (define (expand modules)
>>                             port)
>>                    (newline port)))
>>  
>> -              (for-each (lambda (config)
>> -                          (display config port))
>> -                        '#$(xorg-configuration-extra-config 
>> config))))))
>> +              (for-each
>> +               (lambda (config)
>> +                 (display config port)
>> +                 (newline port))
>> +               (delete-duplicates
>> +                '#$(xorg-configuration-extra-config 
>> config)))))))
>
> As I wrote before, in ‘xorg-configuration->file’, 
> ‘delete-duplicates’
> should be used for drivers, modules, and fonts, but not for
> ‘extra-config’ (which is merely a string).
>
> Could you update it accordingly?

Can’t `extra-config' be a file-like?

  -- Ian