guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 1970abfeb9771157454510bafcda1a94184826e5
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sat Sep 6 21:49:31 2025 +0200

    daemon: Avoid comparison of integers of different signs.
    
    Fixes guix/guix#1173.
    
    * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Cast ‘st_size’ as
    unsigned.
    
    Reported-by: Congcong Kuo <[email protected]>
    Change-Id: Ibe4674bcef186befe8a0e536278c87458b098c9d
---
 nix/libstore/gc.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 08638b5115..77a2a7027d 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -608,7 +608,8 @@ void LocalStore::removeUnusedLinks(const GCState & state)
 
        /* Drop links for files smaller than 'deduplicationMinSize', even if
           they have more than one hard link.  */
-        if (st.st_nlink != 1 && st.st_size >= deduplicationMinSize) {
+        if (st.st_nlink != 1
+           && ((unsigned long long) st.st_size) >= deduplicationMinSize) {
             actualSize += st.st_size;
             unsharedSize += (st.st_nlink - 1) * st.st_size;
             continue;

Reply via email to