GNU bug report logs - #35872
'guix upgrade' misdiagnoses upgrades in the presence of propagated inputs

Previous Next

Package: guix;

Reported by: Andy Tai <atai <at> atai.org>

Date: Thu, 23 May 2019 20:42:01 UTC

Severity: important

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35872 in the body.
You can then email your comments to 35872 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#35872; Package guix. (Thu, 23 May 2019 20:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andy Tai <atai <at> atai.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 23 May 2019 20:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andy Tai <atai <at> atai.org>
To: bug-guix <at> gnu.org
Subject: messages that are redundant can be eliminated?
Date: Thu, 23 May 2019 13:41:03 -0700
[Message part 1 (text/plain, inline)]
on my guix installation (on an Ubuntu system but that detail should not
matter)

after running

%guix pull && guix package -u

these were printed:
----
...
New in this revision:
  ...
hint: Run `guix pull --news' to view the complete list of package changes.

hint: After setting `PATH', run `hash guix' to make sure your shell refers
to `/home/.../.config/guix/current/bin/guix'.

guix package: warning: Consider running 'guix pull' followed by
'guix package -u' to get up-to-date packages and security updates.

The following packages will be upgraded:
   glibc-locales 2.28 → 2.28
/gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28
   meson 0.50.0 → 0.50.0
/gnu/store/zc6r8b1rx3q7lqd8kvvpnm38ky925kmj-meson-0.50.0
   guile 2.2.4 → 2.2.4
/gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4
   font-adobe-source-han-sans:cn 1.004 → 1.004
/gnu/store/zf59mg6g0afay9458aarh0rqcz852hhb-font-adobe-source-han-sans-1.004-cn
   fontconfig 2.13.1 → 2.13.1
/gnu/store/cnafj0dn09qzy23xnrrjsq5zcdj4739j-fontconfig-2.13.1
   epiphany 3.28.3.1 → 3.28.3.1
/gnu/store/n56bdjhqgq7a4a6ndqc3aymyrzvs12hl-epiphany-3.28.3.1
   gnome-terminal 3.28.2 → 3.28.2
/gnu/store/r6i61wji0qmv9fqdyk65kx73nzxw8v80-gnome-terminal-3.28.2

nothing to be done
----
Now there seems nothing to be done during the guix package -u step so these
messages
glibc-locales 2.28 → 2.28...
were confusing and probably not necessary?
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#35872; Package guix. (Fri, 24 May 2019 16:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 35872 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andy Tai <atai <at> atai.org>
Cc: 35872 <at> debbugs.gnu.org
Subject: Re: bug#35872: messages that are redundant can be eliminated?
Date: Fri, 24 May 2019 18:55:35 +0200
Hi Andy,

Andy Tai <atai <at> atai.org> skribis:

> %guix pull && guix package -u
>
> these were printed:
> ----
> ...
> New in this revision:
>   ...
> hint: Run `guix pull --news' to view the complete list of package changes.
>
> hint: After setting `PATH', run `hash guix' to make sure your shell refers
> to `/home/.../.config/guix/current/bin/guix'.

You should follow this advice, which would address this warning:

> guix package: warning: Consider running 'guix pull' followed by
> 'guix package -u' to get up-to-date packages and security updates.

:-)

> The following packages will be upgraded:
>    glibc-locales 2.28 → 2.28
> /gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28
>    meson 0.50.0 → 0.50.0
> /gnu/store/zc6r8b1rx3q7lqd8kvvpnm38ky925kmj-meson-0.50.0
>    guile 2.2.4 → 2.2.4
> /gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4
>    font-adobe-source-han-sans:cn 1.004 → 1.004
> /gnu/store/zf59mg6g0afay9458aarh0rqcz852hhb-font-adobe-source-han-sans-1.004-cn
>    fontconfig 2.13.1 → 2.13.1
> /gnu/store/cnafj0dn09qzy23xnrrjsq5zcdj4739j-fontconfig-2.13.1
>    epiphany 3.28.3.1 → 3.28.3.1
> /gnu/store/n56bdjhqgq7a4a6ndqc3aymyrzvs12hl-epiphany-3.28.3.1
>    gnome-terminal 3.28.2 → 3.28.2
> /gnu/store/r6i61wji0qmv9fqdyk65kx73nzxw8v80-gnome-terminal-3.28.2
>
> nothing to be done

This is a bug where the presence of propagated inputs leads ‘guix
upgrade’ to assume something would be upgraded, even when that’s not the
case.  This can be reproduced with:

  guix install -p foo guile
  guix upgrade -p foo

I’ll see what can be done.

Thanks for reporting it,
Ludo’.




Changed bug title to ''guix upgrade' misdiagnoses upgrades in the presence of propagated inputs' from 'messages that are redundant can be eliminated?' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 24 May 2019 16:58:02 GMT) Full text and rfc822 format available.

Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 24 May 2019 16:58:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#35872; Package guix. (Tue, 24 Mar 2020 17:21:01 GMT) Full text and rfc822 format available.

Message #15 received at 35872 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andy Tai <atai <at> atai.org>
Cc: 35872 <at> debbugs.gnu.org
Subject: Re: bug#35872: messages that are redundant can be eliminated?
Date: Tue, 24 Mar 2020 18:20:38 +0100
Hi,

Ludovic Courtès <ludo <at> gnu.org> skribis:

>> The following packages will be upgraded:
>>    glibc-locales 2.28 → 2.28
>> /gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28
>>    meson 0.50.0 → 0.50.0
>> /gnu/store/zc6r8b1rx3q7lqd8kvvpnm38ky925kmj-meson-0.50.0
>>    guile 2.2.4 → 2.2.4
>> /gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4
>>    font-adobe-source-han-sans:cn 1.004 → 1.004
>> /gnu/store/zf59mg6g0afay9458aarh0rqcz852hhb-font-adobe-source-han-sans-1.004-cn
>>    fontconfig 2.13.1 → 2.13.1
>> /gnu/store/cnafj0dn09qzy23xnrrjsq5zcdj4739j-fontconfig-2.13.1
>>    epiphany 3.28.3.1 → 3.28.3.1
>> /gnu/store/n56bdjhqgq7a4a6ndqc3aymyrzvs12hl-epiphany-3.28.3.1
>>    gnome-terminal 3.28.2 → 3.28.2
>> /gnu/store/r6i61wji0qmv9fqdyk65kx73nzxw8v80-gnome-terminal-3.28.2
>>
>> nothing to be done
>
> This is a bug where the presence of propagated inputs leads ‘guix
> upgrade’ to assume something would be upgraded, even when that’s not the
> case.  This can be reproduced with:
>
>   guix install -p foo guile
>   guix upgrade -p foo

With commit 3e5ab0a7a9399bb098b9ced46bf3cbf4085c6bab, ‘guix upgrade’
writes “(dependencies changed)” instead of “2.28 → 2.28”, which should
already be less confusing.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35872; Package guix. (Tue, 24 Mar 2020 17:37:02 GMT) Full text and rfc822 format available.

Message #18 received at 35872 <at> debbugs.gnu.org (full text, mbox):

From: Andy Tai <atai <at> atai.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35872 <at> debbugs.gnu.org
Subject: Re: bug#35872: messages that are redundant can be eliminated?
Date: Tue, 24 Mar 2020 10:36:08 -0700
[Message part 1 (text/plain, inline)]
Great, thanks.  Minor thing but good for end user experience.

On Tue, Mar 24, 2020 at 10:20 AM Ludovic Courtès <ludo <at> gnu.org> wrote:

> Hi,
>
> Ludovic Courtès <ludo <at> gnu.org> skribis:
>
> >> The following packages will be upgraded:
> >>    glibc-locales 2.28 → 2.28
> >> /gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28
> >>    meson 0.50.0 → 0.50.0
> >> /gnu/store/zc6r8b1rx3q7lqd8kvvpnm38ky925kmj-meson-0.50.0
> >>    guile 2.2.4 → 2.2.4
> >> /gnu/store/9alic3caqhay3h8mx4iihpmyj6ymqpcx-guile-2.2.4
> >>    font-adobe-source-han-sans:cn 1.004 → 1.004
> >>
> /gnu/store/zf59mg6g0afay9458aarh0rqcz852hhb-font-adobe-source-han-sans-1.004-cn
> >>    fontconfig 2.13.1 → 2.13.1
> >> /gnu/store/cnafj0dn09qzy23xnrrjsq5zcdj4739j-fontconfig-2.13.1
> >>    epiphany 3.28.3.1 → 3.28.3.1
> >> /gnu/store/n56bdjhqgq7a4a6ndqc3aymyrzvs12hl-epiphany-3.28.3.1
> >>    gnome-terminal 3.28.2 → 3.28.2
> >> /gnu/store/r6i61wji0qmv9fqdyk65kx73nzxw8v80-gnome-terminal-3.28.2
> >>
> >> nothing to be done
> >
> > This is a bug where the presence of propagated inputs leads ‘guix
> > upgrade’ to assume something would be upgraded, even when that’s not the
> > case.  This can be reproduced with:
> >
> >   guix install -p foo guile
> >   guix upgrade -p foo
>
> With commit 3e5ab0a7a9399bb098b9ced46bf3cbf4085c6bab, ‘guix upgrade’
> writes “(dependencies changed)” instead of “2.28 → 2.28”, which should
> already be less confusing.
>
> Ludo’.
>


-- 
Andy Tai, atai <at> atai.org, Skype: licheng.tai, Line: andy_tai, WeChat:
andytai1010
Year 2019 民國108年
自動的精神力是信仰與覺悟
自動的行為力是勞動與技能
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#35872; Package guix. (Tue, 24 Mar 2020 22:03:01 GMT) Full text and rfc822 format available.

Message #21 received at 35872 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andy Tai <atai <at> atai.org>
Cc: 35872 <at> debbugs.gnu.org, Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: bug#35872: messages that are redundant can be eliminated?
Date: Tue, 24 Mar 2020 23:02:48 +0100
[Message part 1 (text/plain, inline)]
(+Cc: Efraim following our discussion on IRC.)

Ludovic Courtès <ludo <at> gnu.org> skribis:

> This is a bug where the presence of propagated inputs leads ‘guix
> upgrade’ to assume something would be upgraded, even when that’s not the
> case.  This can be reproduced with:
>
>   guix install -p foo guile
>   guix upgrade -p foo

I came up with an actual fix for that (attached), nice and clean, which
would allow ‘guix upgrade’ to correctly determine whether something is
going to be upgraded.

But then I realized that this cannot work in the presence of grafts:
first because ‘-n’ currently implies ‘--no-grafts’, so this is an apple
to orange comparison, and then because computing the output file name of
a grafted package can require building the package (grafts are “dynamic
dependencies”.)

So I’m willing to punt for now.

I wonder if there’s a UI trick we could use to avoid displaying too many
“(dependencies changed)” though.

Thoughts?

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 20a2973579..cb95969926 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2013 Nikita Karetnikov <nikita <at> karetnikov.org>
 ;;; Copyright © 2014, 2016 Alex Kost <alezost <at> gmail.com>
 ;;; Copyright © 2015 Mark H Weaver <mhw <at> netris.org>
@@ -87,6 +87,7 @@
             manifest-entry-search-paths
             manifest-entry-parent
             manifest-entry-properties
+            manifest-entry=?
 
             manifest-pattern
             manifest-pattern?
@@ -216,6 +217,32 @@
   (output       manifest-pattern-output           ; string | #f
                 (default "out")))
 
+(define (list=? = lst1 lst2)
+  "Return true if LST1 and LST2 have the same length and their elements are
+pairwise equal per =."
+  (match lst1
+    (()
+     (null? lst2))
+    ((head1 . tail1)
+     (match lst2
+       ((head2 . tail2)
+        (and (= head1 head2) (list=? = tail1 tail2)))
+       (()
+        #f)))))
+
+(define (manifest-entry=? entry1 entry2)
+  "Return true if ENTRY1 is equivalent to ENTRY2."
+  (match entry1
+    (($ <manifest-entry> name1 version1 output1 item1 dependencies1 paths1)
+     (match entry2
+       (($ <manifest-entry> name2 version2 output2 item2 dependencies2 paths2)
+        (and (string=? name1 name2)
+             (string=? version1 version2)
+             (string=? output1 output2)
+             (equal? item1 item2)      ;XXX: could be <package> vs. store item
+             (equal? paths1 paths2)
+             (list=? manifest-entry=? dependencies1 dependencies2)))))))
+
 (define (manifest-transitive-entries manifest)
   "Return the entries of MANIFEST along with their propagated inputs,
 recursively."
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index b5d16acec0..0650ec965c 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -200,6 +200,19 @@ non-zero relevance score."
                                 (package-full-name package2))
                       (> score1 score2))))))))))
 
+(define (lower-manifest-entry store entry)
+  "Lower entry by replacing its package objects with their corresponding store
+item, recursively."
+  (let* ((output (manifest-entry-output entry))
+         (item   (derivation->output-path
+                  (package-derivation store (manifest-entry-item entry))
+                  output)))
+    (manifest-entry
+      (inherit entry)
+      (item item)
+      (dependencies (map (cut lower-manifest-entry store <>)
+                         (manifest-entry-dependencies entry))))))
+
 (define (transaction-upgrade-entry store entry transaction)
   "Return a variant of TRANSACTION that accounts for the upgrade of ENTRY, a
 <manifest-entry>."
@@ -215,40 +228,37 @@ non-zero relevance score."
         (output (manifest-entry-output old)))
       transaction)))
 
-  (match (if (manifest-transaction-removal-candidate? entry transaction)
-             'dismiss
-             entry)
-    ('dismiss
-     transaction)
-    (($ <manifest-entry> name version output (? string? path))
-     (match (find-best-packages-by-name name #f)
-       ((pkg . rest)
-        (let ((candidate-version (package-version pkg)))
-          (match (package-superseded pkg)
-            ((? package? new)
-             (supersede entry new))
-            (#f
-             (case (version-compare candidate-version version)
-               ((>)
-                (manifest-transaction-install-entry
-                 (package->manifest-entry* pkg output)
-                 transaction))
-               ((<)
-                transaction)
-               ((=)
-                (let ((candidate-path (derivation->output-path
-                                       (package-derivation store pkg))))
-                  ;; XXX: When there are propagated inputs, assume we need to
-                  ;; upgrade the whole entry.
-                  (if (and (string=? path candidate-path)
-                           (null? (package-propagated-inputs pkg)))
-                      transaction
-                      (manifest-transaction-install-entry
-                       (package->manifest-entry* pkg output)
-                       transaction)))))))))
-       (()
-        (warning (G_ "package '~a' no longer exists~%") name)
-        transaction)))))
+  (define (upgrade entry)
+    (match entry
+      (($ <manifest-entry> name version output (? string? path))
+       (match (find-best-packages-by-name name #f)
+         ((pkg . rest)
+          (let ((candidate-version (package-version pkg)))
+            (match (package-superseded pkg)
+              ((? package? new)
+               (supersede entry new))
+              (#f
+               (case (version-compare candidate-version version)
+                 ((>)
+                  (manifest-transaction-install-entry
+                   (package->manifest-entry* pkg output)
+                   transaction))
+                 ((<)
+                  transaction)
+                 ((=)
+                  (let* ((new (package->manifest-entry* pkg output)))
+                    (if (manifest-entry=? (lower-manifest-entry store new)
+                                          entry)
+                        transaction
+                        (manifest-transaction-install-entry
+                         new transaction)))))))))
+         (()
+          (warning (G_ "package '~a' no longer exists~%") name)
+          transaction)))))
+
+  (if (manifest-transaction-removal-candidate? entry transaction)
+      entry
+      (upgrade entry)))
 
 
 ;;;

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 30 Mar 2020 22:13:01 GMT) Full text and rfc822 format available.

Notification sent to Andy Tai <atai <at> atai.org>:
bug acknowledged by developer. (Mon, 30 Mar 2020 22:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 35872-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Andy Tai <atai <at> atai.org>
Cc: 35872-done <at> debbugs.gnu.org, Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: bug#35872: messages that are redundant can be eliminated?
Date: Tue, 31 Mar 2020 00:12:00 +0200
Hi!

Ludovic Courtès <ludo <at> gnu.org> skribis:

> (+Cc: Efraim following our discussion on IRC.)
>
> Ludovic Courtès <ludo <at> gnu.org> skribis:
>
>> This is a bug where the presence of propagated inputs leads ‘guix
>> upgrade’ to assume something would be upgraded, even when that’s not the
>> case.  This can be reproduced with:
>>
>>   guix install -p foo guile
>>   guix upgrade -p foo
>
> I came up with an actual fix for that (attached), nice and clean, which
> would allow ‘guix upgrade’ to correctly determine whether something is
> going to be upgraded.
>
> But then I realized that this cannot work in the presence of grafts:
> first because ‘-n’ currently implies ‘--no-grafts’, so this is an apple
> to orange comparison, and then because computing the output file name of
> a grafted package can require building the package (grafts are “dynamic
> dependencies”.)

I saw the light :-) and came up with a simple solution to this in commit
a357849f5b1314c2a35efeee237645b9b08c39f5.  Basically, we do the complete
manifest entry comparison as in the patch I posted earlier, but we punt
if doing so would require building things (for grafts).

Anecdotal data: on my 288-item profile, “guix upgrade -n” would
previously report that 124 things need to be upgraded, and now it
reports 97 instead.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Apr 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.