The branch, master has been updated
       via  fe467c2f8a5 heimdal build clang 20: compile lex generated code
       via  b473ad76f80 heimdal build: pass c flags in HEIMDAL_BINARY
       via  5b664e51166 Fix clang 20 format-nonliteral warnings
       via  b6fede171eb Fix clang 20 format-truncation warnings
       via  1940b5efa65 Fix clang 20 unused-function warnings
       via  73931e45af7 Fix clang 20 unused-but-set-variables warnings
       via  1369a038e8f Fix clang 20 sometimes-uninitialized warnings
       via  02713eaeda1 nsswitch wbinfo: fix uninitialised return value on error
       via  eb76e600c43 Fix clang 20 shadows variable in global scope warning
       via  8cd91721a94 build: Allow developer builds with clang 20
      from  9b9fc589e55 smbd: use fsp->name_hash in check_parent_access_fsp()

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit fe467c2f8a5541ee9f651a875f6764b3a54af5d3
Author: Gary Lockyer <[email protected]>
Date:   Wed May 21 09:21:17 2025 +1200

    heimdal build clang 20: compile lex generated code
    
    The lex/flex generated code in the heimdal build triggers:
       strict-prototype and implicit-fallthrough errors
    
    Rather that blanket disabling the warnings, try to disable them only
    when compiling lex/flex generated code
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>
    
    Autobuild-User(master): Douglas Bagnall <[email protected]>
    Autobuild-Date(master): Thu May 29 00:19:50 UTC 2025 on atb-devel-224

commit b473ad76f805f08be59436381c8ba5a3f9e187c9
Author: Gary Lockyer <[email protected]>
Date:   Wed May 21 09:13:48 2025 +1200

    heimdal build: pass c flags in HEIMDAL_BINARY
    
    HEIMDAL_CFLAGS clears the cflags variable,
    so we need to pass cflags_end to HEIMDAL_SUBSYSTEM to ensure the
    subsystem files get built with the intended flags
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 5b664e511669db2e30f90427235ac79bf129af5c
Author: Gary Lockyer <[email protected]>
Date:   Wed May 21 09:10:28 2025 +1200

    Fix clang 20 format-nonliteral warnings
    
    Fix:
      /source3/utils/smbcacls.c:1619:35 error:
        format string is not a string literal
        [-Werror -Wformat-non-literal]
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit b6fede171ebd228539a3d879ec9d55d9b8901d89
Author: Gary Lockyer <[email protected]>
Date:   Tue May 20 10:00:26 2025 +1200

    Fix clang 20 format-truncation warnings
    
    Fix:
      lib/replace/tests/testsuite.c:387:6: error:
        'snprintf' will always be truncated; specified size is 3,
        but format string expands to at least 5 [-Werror,-Wformat-truncation]
      387 |         if (snprintf(tmp, 3, "foo%d", 9) != 4) {
          |             ^
    
    As this is an explicit test of snprintf's truncation behaviour
    the warning can be safely suppressed.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 1940b5efa65f5bdcf6b9b39f80bbe330fcc8d90c
Author: Gary Lockyer <[email protected]>
Date:   Mon May 19 16:32:22 2025 +1200

    Fix clang 20 unused-function warnings
    
    Remove unused function:
      static inline struct ldb_val talloc_steal_ldb_val(TALLOC_CTX *mem_ctx, 
struct ldb_val val)
    From source4/kdc/ad_claims.c
    1 error generated.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 73931e45af782b32573c11db1cb938d883489e86
Author: Gary Lockyer <[email protected]>
Date:   Mon May 19 16:15:27 2025 +1200

    Fix clang 20 unused-but-set-variables warnings
    
    Suppress error: variable 'yynerrs' set but not used 
[-Werror,-Wunused-but-set-variable]
                    for the code generated from the yacc files.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 1369a038e8f37cb597818f920f425a6c9753636c
Author: Gary Lockyer <[email protected]>
Date:   Thu May 22 10:34:23 2025 +1200

    Fix clang 20 sometimes-uninitialized warnings
    
    Fix clang 20:
      variable '' is uninitialized where 'if' condition is true
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 02713eaeda18f416cf034f11ace268f9ff4f595c
Author: Gary Lockyer <[email protected]>
Date:   Thu May 22 10:32:50 2025 +1200

    nsswitch wbinfo: fix uninitialised return value on error
    
    In wbinfo_lookup_sids ret was not initialised and was not set in
    the error return paths. Returning an uninitialised value in the
    event of an error, and in all probability something that evaluated to
    true, so would not have signalled the error to the caller.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit eb76e600c4346a92528c701c76a5300cbbd0bf74
Author: Gary Lockyer <[email protected]>
Date:   Mon May 19 14:35:43 2025 +1200

    Fix clang 20 shadows variable in global scope warning
    
    Fixes:
    
     [4822/4916] Compiling source3/torture/torture.c
     ../../source3/torture/torture.c:685:6: error: declaration shadows a 
variable in the global scope [-Werror,-Wshadow]
      685 |         int timezone = smb1cli_conn_server_time_zone(cli->conn);
          |             ^
     /usr/include/time.h:234:17: note: previous declaration is here
      234 | extern long int timezone;
          |                 ^
     1 error generated.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 8cd91721a94c02f42edbeefc184789313610ccb1
Author: Gary Lockyer <[email protected]>
Date:   Mon May 19 13:56:10 2025 +1200

    build: Allow developer builds with clang 20
    
    Disable clang warnings to allow samba to be compiled with clang 20.
    
    Subsequent commits will fix the offending code and re-enable the
    warnings.
    
    Signed-off-by: Gary Lockyer <[email protected]>
    Reviewed-by: Douglas Bagnall <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba_autoconf.py       |  4 ++++
 lib/replace/tests/testsuite.c               |  6 ++++++
 libcli/security/wscript_build               |  6 ++++++
 libcli/wsp/wscript_build                    |  5 +++++
 nsswitch/wbinfo.c                           |  2 +-
 source3/torture/torture.c                   |  8 ++++----
 source3/utils/smbcacls.c                    |  3 +--
 source4/kdc/ad_claims.c                     |  6 ------
 source4/torture/smb2/timestamps.c           |  2 +-
 third_party/heimdal_build/wscript_build     | 23 ++++++++++++++++++-----
 third_party/heimdal_build/wscript_configure |  8 ++++++++
 11 files changed, 54 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_autoconf.py 
b/buildtools/wafsamba/samba_autoconf.py
index d4e27e156e6..a0ca191f465 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -836,10 +836,14 @@ int main(void) {
         if CHECK_CFLAGS(conf, ["-Wno-error=declaration-after-statement"]):
             conf.define('HAVE_WNO_ERROR_DECLARATION_AFTER_STATEMENT', 1)
 
+        if CHECK_CFLAGS(conf, ["-Wno-error=unused-but-set-variable"]):
+            conf.define('HAVE_WNO_ERROR_UNUSED_BUT_SET_VARIABLE', 1)
+
         if not Options.options.disable_warnings_as_errors:
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror 
-Wno-error=deprecated-declarations', testflags=True)
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', 
'-Wno-error=tautological-compare', testflags=True)
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-align', 
testflags=True)
+            conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=cast-qual', 
testflags=True)
 
     if Options.options.fatal_errors:
         conf.ADD_CFLAGS('-Wfatal-errors', testflags=True)
diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c
index 7c9195b4753..624b1687b4f 100644
--- a/lib/replace/tests/testsuite.c
+++ b/lib/replace/tests/testsuite.c
@@ -380,6 +380,11 @@ static int test_asprintf(void)
        return true;
 }
 
+/* This test explicitly triggers truncation, so we need to
+ * suppress the warning
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-truncation"
 static int test_snprintf(void)
 {
        char tmp[10];
@@ -397,6 +402,7 @@ static int test_snprintf(void)
        printf("success: snprintf\n");
        return true;
 }
+#pragma GCC diagnostic pop
 
 static int test_vasprintf(void)
 {
diff --git a/libcli/security/wscript_build b/libcli/security/wscript_build
index 945e5c3c846..62a22cc151e 100644
--- a/libcli/security/wscript_build
+++ b/libcli/security/wscript_build
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 
 
+parser_cflags = ''
+if bld.CONFIG_SET('HAVE_WNO_UNUSED_BUT_SET_VARIABLE'):
+    # Suppress error: variable 'yynerrs' set but not used 
[-Werror,-Wunused-but-set-variable]
+    #                 for the generated code.
+    parser_cflags += ' -Wno-error=unused-but-set-variable'
 bld.SAMBA_LIBRARY('samba-security',
                   source=['dom_sid.c',
                           'display_sec.c', 'secace.c', 'secacl.c',
@@ -13,6 +18,7 @@ bld.SAMBA_LIBRARY('samba-security',
                           'claims_transformation.l',
                           'claims_transformation.y',
                   ],
+                  cflags=parser_cflags,
                   private_library=True,
                   deps='stable_sort talloc ndr NDR_SECURITY 
NDR_CONDITIONAL_ACE')
 
diff --git a/libcli/wsp/wscript_build b/libcli/wsp/wscript_build
index 2d34879a68f..d19f8249ccf 100644
--- a/libcli/wsp/wscript_build
+++ b/libcli/wsp/wscript_build
@@ -20,6 +20,11 @@ parser_cflags=''
 if bld.CONFIG_SET('HAVE_WNO_STRICT_OVERFLOW'):
     parser_cflags += ' -Wno-strict-overflow'
 
+if bld.CONFIG_SET('HAVE_WNO_UNUSED_BUT_SET_VARIABLE'):
+    # Suppress error: variable 'yynerrs' set but not used 
[-Werror,-Wunused-but-set-variable]
+    #                 for the generated code.
+    parser_cflags += ' -Wno-error=unused-but-set-variable'
+
 bld.SAMBA_SUBSYSTEM('LIBSAMBA_WSP_PARSER',
        source='wsp_aqs_parser.y',
        deps='talloc wsp_flex',
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index 93caa96f66c..1b3fb41b2d8 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1519,7 +1519,7 @@ static bool wbinfo_lookup_sids(const char *arg)
        int i, num_sids;
        const char *p;
        wbcErr wbc_status;
-       bool ret;
+       bool ret = false;
 
        num_sids = 0;
        sids = NULL;
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index f70f5c575b1..4864535ebd1 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -682,7 +682,7 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
                        off_t *size,
                        uint32_t *pattr)
 {
-       int timezone = smb1cli_conn_server_time_zone(cli->conn);
+       int tz = smb1cli_conn_server_time_zone(cli->conn);
        time_t (*date_fn)(const void *buf, int serverzone) = NULL;
        uint8_t *rdata = NULL;
        uint32_t num_rdata;
@@ -706,13 +706,13 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli,
        }
 
        if (change_time) {
-               *change_time = date_fn(rdata + 0, timezone);
+               *change_time = date_fn(rdata + 0, tz);
        }
        if (access_time) {
-               *access_time = date_fn(rdata + 4, timezone);
+               *access_time = date_fn(rdata + 4, tz);
        }
        if (write_time) {
-               *write_time = date_fn(rdata + 8, timezone);
+               *write_time = date_fn(rdata + 8, tz);
        }
        if (size) {
                *size = PULL_LE_U32(rdata, 12);
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 31065957355..430ee0b5974 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -1567,7 +1567,6 @@ static int write_dacl(struct dump_context *ctx,
 {
        struct security_descriptor *sd = NULL;
        char *str = NULL;
-       const char *output_fmt = "%s\r\n%s\r\n";
        const char *tmp = NULL;
        char *out_str = NULL;
        uint8_t *dest = NULL;
@@ -1616,7 +1615,7 @@ static int write_dacl(struct dump_context *ctx,
        if (tmp[0] == '\\') {
                tmp++;
        }
-       out_str = talloc_asprintf(frame, output_fmt, tmp, str);
+       out_str = talloc_asprintf(frame, "%s\r\n%s\r\n", tmp, str);
 
        if (out_str == NULL) {
                result = EXIT_FAILED;
diff --git a/source4/kdc/ad_claims.c b/source4/kdc/ad_claims.c
index 1f3df007f36..f2fd6b4a5fb 100644
--- a/source4/kdc/ad_claims.c
+++ b/source4/kdc/ad_claims.c
@@ -654,12 +654,6 @@ static int get_assigned_silo(struct ldb_context *ldb,
        return LDB_SUCCESS;
 }
 
-static inline struct ldb_val talloc_steal_ldb_val(TALLOC_CTX *mem_ctx, struct 
ldb_val val)
-{
-       val.data = talloc_steal(mem_ctx, val.data);
-       return val;
-}
-
 static uint32_t claim_get_value_count(const struct CLAIM_ENTRY *claim)
 {
        switch (claim->type) {
diff --git a/source4/torture/smb2/timestamps.c 
b/source4/torture/smb2/timestamps.c
index 47d645eacf2..54dea8dbc95 100644
--- a/source4/torture/smb2/timestamps.c
+++ b/source4/torture/smb2/timestamps.c
@@ -1164,7 +1164,7 @@ static bool getinfo_both(struct torture_context *tctx,
        union smb_fileinfo finfo;
        union smb_fileinfo pinfo;
        struct smb2_create cr;
-       struct smb2_handle h2;
+       struct smb2_handle h2 = {0};
        NTSTATUS status;
        bool ret = true;
 
diff --git a/third_party/heimdal_build/wscript_build 
b/third_party/heimdal_build/wscript_build
index 59fb2758f91..801f3277f41 100644
--- a/third_party/heimdal_build/wscript_build
+++ b/third_party/heimdal_build/wscript_build
@@ -277,7 +277,7 @@ def HEIMDAL_BINARY(binname, source,
                       source         = source,
                       deps           = deps,
                       includes       = includes,
-                      cflags         = cflags,
+                      cflags         = cflags_end,
                       group          = group,
                       use_hostcc     = use_hostcc,
                       use_global_deps= use_global_deps)
@@ -295,6 +295,16 @@ def HEIMDAL_BINARY(binname, source,
                      install_path   = None,
                      install        = install)
 
+def HEIMDAL_LEX_CFLAGS():
+    lex_cflags = []
+    if bld.CONFIG_SET('HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS'):
+        lex_cflags.append('-Wno-strict-overflow')
+    if bld.CONFIG_SET('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS'):
+        lex_cflags.append('-Wno-error=strict-prototypes')
+    if bld.CONFIG_SET('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS'):
+        lex_cflags.append('-Wno-error=implicit-fallthrough')
+    return lex_cflags
+
 
 if not bld.CONFIG_SET('USING_SYSTEM_ROKEN'):
 
@@ -1009,7 +1019,7 @@ if not bld.CONFIG_SET("USING_SYSTEM_HX509"):
         HEIMDAL_HX509_OBJH_SOURCE + ' lib/hx509/sel-lex.l 
lib/hx509/sel-gram.y',
         includes='../heimdal/lib/hx509',
         deps='roken com_err asn1 hcrypto asn1 HEIMDAL_OCSP_ASN1 
HEIMDAL_PKCS8_ASN1 HEIMDAL_PKCS9_ASN1 HEIMDAL_PKCS12_ASN1 HEIMDAL_PKCS10_ASN1 
wind heimbase',
-        cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS,
+        cflags=' '.join(HEIMDAL_LEX_CFLAGS()),
         version_script='lib/hx509/version-script.map',
         )
 
@@ -1086,7 +1096,7 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
                       'lib/asn1/gen.c',
                       includes='../heimdal/lib/asn1',
                       group='hostcc_build_main',
-                      
cflags=bld.env.HEIMDAL_UNPICKY_WNO_STRICT_OVERFLOW_CFLAGS,
+                      cflags=HEIMDAL_LEX_CFLAGS(),
                       deps='ROKEN_HOSTCC HEIMBASE_HOSTCC',
                       use_global_deps=False,
                       use_hostcc=True)
@@ -1104,11 +1114,13 @@ if not bld.CONFIG_SET('USING_SYSTEM_ASN1_COMPILE'):
         group='hostcc_build_main',
         deps='ROKEN_HOSTCC HEIMBASE_HOSTCC LIBREPLACE_HOSTCC 
HEIMDAL_VERS_HOSTCC '
              'HEIMDAL_ASN1_GEN_HOSTCC',
-        install=False
+        install=False,
+        cflags=' '.join(HEIMDAL_LEX_CFLAGS())
     )
     bld.env['ASN1_COMPILE'] = os.path.join(bld.bldnode.parent.abspath(), 
'asn1_compile')
 
 
+
 if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
     HEIMDAL_BINARY('compile_et',
         'lib/com_err/parse.y lib/com_err/lex.l lib/com_err/compile_et.c',
@@ -1117,7 +1129,8 @@ if not bld.CONFIG_SET('USING_SYSTEM_COMPILE_ET'):
         includes='../heimdal/lib/com_err',
         group='hostcc_base_build_main',
         deps='ROKEN_HOSTCC LIBREPLACE_HOSTCC HEIMDAL_VERS_HOSTCC',
-        install=False
+        install=False,
+        cflags=' '.join(HEIMDAL_LEX_CFLAGS())
         )
     bld.env['COMPILE_ET'] = os.path.join(bld.bldnode.parent.abspath(), 
'compile_et')
 
diff --git a/third_party/heimdal_build/wscript_configure 
b/third_party/heimdal_build/wscript_configure
index db3995b9fa2..4ab8d5034a4 100644
--- a/third_party/heimdal_build/wscript_configure
+++ b/third_party/heimdal_build/wscript_configure
@@ -94,6 +94,14 @@ 
conf.ADD_NAMED_CFLAGS('HEIMDAL_UNPICKY_WNO_FREE_NOHEAP_OBJECT_CFLAGS',
                       '-Wno-error=free-nonheap-object',
                       testflags=True)
 
+conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_IMPLICIT_FALLTHROUGH_CFLAGS',
+                      '-Wno-error=implicit-fallthrough',
+                      testflags=True)
+
+conf.ADD_NAMED_CFLAGS('HEIMDAL_LEX_WNO_STRICT_PROTOTYPES_CFLAGS',
+                      '-Wno-error=strict-prototypes',
+                      testflags=True)
+
 if len(bld.env.HEIMDAL_NO_ERROR_CFLAGS) == len(heimdal_no_error_flags):
     Logs.info("Most warnings in Heimdal code will "
               "error due to -Werror (good)")


-- 
Samba Shared Repository

Reply via email to