From 6e733b0544e9d9c4d549c4eb71104158bf69455b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 17 Jul 2025 12:38:53 +0200 Subject: [PATCH 1/4] Fix SIZE_MAX undefined warning in fchmodat2-compat.hh Include to ensure SIZE_MAX is defined --- src/libstore/linux/fchmodat2-compat.hh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstore/linux/fchmodat2-compat.hh b/src/libstore/linux/fchmodat2-compat.hh index 42b3f3a35..907695c31 100644 --- a/src/libstore/linux/fchmodat2-compat.hh +++ b/src/libstore/linux/fchmodat2-compat.hh @@ -1,4 +1,5 @@ #include "store-config-private.hh" +#include /* * Determine the syscall number for `fchmodat2`. From 4ba3b15a101735b4d75215145b59a12366aafcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 17 Jul 2025 12:38:21 +0200 Subject: [PATCH 2/4] Fix s3.hh to include public config header The s3.hh public header was incorrectly including store-config-private.hh instead of the public config.hh. Since NIX_WITH_S3_SUPPORT is defined in the public config, this caused clang-tidy to report it as undefined. --- src/libstore/include/nix/store/s3.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/include/nix/store/s3.hh b/src/libstore/include/nix/store/s3.hh index 9c159ba0f..e017b7c6b 100644 --- a/src/libstore/include/nix/store/s3.hh +++ b/src/libstore/include/nix/store/s3.hh @@ -1,6 +1,6 @@ #pragma once ///@file -#include "store-config-private.hh" +#include "nix/store/config.hh" #if NIX_WITH_S3_SUPPORT #include "nix/util/ref.hh" From 6bf940d6366cb800b402ab070ee0fbcff1a9460f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 17 Jul 2025 11:36:55 +0200 Subject: [PATCH 3/4] Fix clang-tidy uninitialized value warning in derivation-options.cc Make lambda capture explicit to avoid clang-analyzer-core.CallAndMessage warning --- src/libstore/derivation-options.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/derivation-options.cc b/src/libstore/derivation-options.cc index f6bac2868..40c4e6d15 100644 --- a/src/libstore/derivation-options.cc +++ b/src/libstore/derivation-options.cc @@ -138,7 +138,7 @@ DerivationOptions::fromStructuredAttrs(const StringMap & env, const StructuredAt if (auto maxClosureSize = get(output, "maxClosureSize")) checks.maxClosureSize = maxClosureSize->get(); - auto get_ = [&](const std::string & name) -> std::optional { + auto get_ = [&output = output](const std::string & name) -> std::optional { if (auto i = get(output, name)) { StringSet res; for (auto j = i->begin(); j != i->end(); ++j) { From 3c0cd73418433c85bc6410f646ac41b2a9720a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 17 Jul 2025 10:45:05 +0200 Subject: [PATCH 4/4] Fix uninitialized field in Attr constructor The default constructor for Attr was not initializing the value pointer, which could lead to undefined behavior when the uninitialized pointer is accessed. This was caught by clang-tidy's UninitializedObject check. This fixes the warning: 1 uninitialized field at the end of the constructor call [clang-analyzer-optin.cplusplus.UninitializedObject] --- src/libexpr/include/nix/expr/attr-set.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libexpr/include/nix/expr/attr-set.hh b/src/libexpr/include/nix/expr/attr-set.hh index 283786f4d..c44e8a6b9 100644 --- a/src/libexpr/include/nix/expr/attr-set.hh +++ b/src/libexpr/include/nix/expr/attr-set.hh @@ -23,7 +23,7 @@ struct Attr way we keep Attr size at two words with no wasted space. */ Symbol name; PosIdx pos; - Value * value; + Value * value = nullptr; Attr(Symbol name, Value * value, PosIdx pos = noPos) : name(name), pos(pos), value(value) { }; Attr() { };