[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1040519: bookworm-pu: package samba/2:4.17.9+dfsg-0+deb12u1



09.07.2023 01:45, Adrian Bunk wrote:
On Sun, Jul 09, 2023 at 01:13:55AM +0300, Michael Tokarev wrote:
09.07.2023 01:01, Adrian Bunk wrote:
This does apparently need the -latomic workaround from 2:4.18.3+dfsg-3:
https://buildd.debian.org/status/package.php?p=samba&suite=bookworm

Sigh!
This is the kerberos in-kernel tickets.. :(

I haven't realized until now that atomic8 thing come into the game after
I enabled the in-kernel kerberos tickets.  I was sure it was due to some
toolchain changes.

FTR, the underlying toolchain bug is not new:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358

Now I know why we weren't able to reproduce this issue
with upstream, - because it happens in the code which is enabled by this
change.
...

The error message is a bit cryptic, but it basically says in which lines
in krcache.c the 64bit loads/stores are for which the CPU has no
instructions and needs libatomic.

Not linking with libatomic automatically for C11 atomics is the gcc bug.

Yeah, I know this is a gcc issue (though I haven't found the gcc bugreport
about this, - thank you for the link! - updated comments now).  I just didn't
connect the dots when it happened, - I didn't think my kerberos changes in
samba were the trigger for this issue to pop up, I thought it was somehting
else outside of samba (as you can see, the comments in d/rules in sid samba
package refers to this same place in source), - instead of realizing it is
due to me enabling new code which weren't used in samba before.

Now after thought about all this in the morning, I think the following should
do it:

diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+samba (2:4.17.9+dfsg-0+deb12u2) bookworm; urgency=medium
+
+  * link with -latomic explicitly on a few architectures where gcc misses it
+    (notable armel & mipsel), to fix FTBFS there, - the same as on sid.
+    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
+
+ -- Michael Tokarev <mjt@tls.msk.ru>  Sun, 09 Jul 2023 09:44:29 +0300
+
 samba (2:4.17.9+dfsg-0+deb12u1) bookworm-proposed-updates; urgency=medium

   * d/copyright: filter out autogenerated manpages from the upstream source
diff --git a/debian/rules b/debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -103,6 +103,20 @@ with-ceph =
 with-glusterfs =
 endif

+ifneq (,$(filter armel mipsel m68k powerpc sh4,${DEB_HOST_ARCH}))
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
+# on these platforms gcc does not link with -latomic, resulting in
+#   third_party/heimdal/lib/krb5/krcache.c.55.o: in function `krcc_get_principal':
+#   third_party/heimdal/lib/krb5/krcache.c:1395: undefined reference to `__atomic_load_8'
+#     ids.krcu_cache_and_princ_id = heim_base_atomic_load(&data->krc_cache_and_principal_id);
+#   third_party/heimdal/lib/base/heimbase-atomics.h:
+#     #include <stdatomic.h>
+#     #define heim_base_atomic_load(x)        atomic_load((x))
+# include a workaround for now
+# (-latomic and <stdatomic.h> comes from gcc, --as-needed is already in use)
+LDFLAGS := ${LDFLAGS} -latomic
+endif
+
 config-args += $(if ${with-ceph},\
          --enable-cephfs --enable-ceph-reclock,\
          --disable-cephfs)

(this is the same changes as on sid, *plus* a bit more, which updates the comment
with the gcc bug reference and drops -Wl,--no-as-needed, - since this one is already
enabled).

I'm building it on a mipsel qemu chroot right now to verify, and think it's a
better fix than to revert  kerberos keyring changes for deb12u2.

BTW, I'm not sure why dch used "bookworm" in the Distribution field in d/changelog
when I run `dch -r' - the previous distribution was bookworm-p-u.  Now I'm a bit
confused which value should be used there.

Thank you Adrian for all the help!

/mjt


Reply to: