Skip to content

Commit 518ce0f

Browse files
authored
CDRIVER-4766 replace %ld with %zu in TRACEs (#1465)
* add 32-bit Debian package build * CDRIVER-4766 replace %ld with %zu in TRACEs This fixes compilation failure when %ld format specifier is used on 32-bit platforms. Ref: https://bugs.debian.org/1055264
1 parent e93bd88 commit 518ce0f

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

.evergreen/scripts/debian_package_build.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ set -o errexit
1010

1111
on_exit () {
1212
if [ -e ./unstable-chroot/debootstrap/debootstrap.log ]; then
13-
echo "Dumping debootstrap.log"
13+
echo "Dumping debootstrap.log (64-bit)"
1414
cat ./unstable-chroot/debootstrap/debootstrap.log
1515
fi
16+
if [ -e ./unstable-i386-chroot/debootstrap/debootstrap.log ]; then
17+
echo "Dumping debootstrap.log (32-bit)"
18+
cat ./unstable-i386-chroot/debootstrap/debootstrap.log
19+
fi
1620
}
1721
trap on_exit EXIT
1822

@@ -66,3 +70,31 @@ sudo chroot ./unstable-chroot /bin/bash -c "(\
6670
rm -f example-client && \
6771
git status --ignored && \
6872
dpkg-buildpackage -b && dpkg-buildpackage -S )"
73+
74+
# And now do it all again for 32-bit
75+
sudo -E ./debootstrap.git/debootstrap --arch i386 unstable ./unstable-i386-chroot/ http://cdn-aws.deb.debian.org/debian
76+
cp -a mongoc ./unstable-i386-chroot/tmp/
77+
sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
78+
apt-get install -y build-essential git-buildpackage fakeroot debhelper cmake libssl-dev pkg-config python3-sphinx python3-sphinx-design zlib1g-dev libsasl2-dev libsnappy-dev libzstd-dev libmongocrypt-dev libjs-mathjax libutf8proc-dev furo && \
79+
chown -R root:root /tmp/mongoc && \
80+
cd /tmp/mongoc && \
81+
git clean -fdx && \
82+
git reset --hard HEAD && \
83+
python3 build/calc_release_version.py > VERSION_CURRENT && \
84+
python3 build/calc_release_version.py -p > VERSION_RELEASED && \
85+
git add --force VERSION_CURRENT VERSION_RELEASED && \
86+
git commit VERSION_CURRENT VERSION_RELEASED -m 'Set current/released versions' && \
87+
LANG=C /bin/bash ./debian/build_snapshot.sh && \
88+
debc ../*.changes && \
89+
dpkg -i ../*.deb && \
90+
gcc -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -o example-client src/libmongoc/examples/example-client.c -lmongoc-1.0 -lbson-1.0 )"
91+
92+
[ -e ./unstable-i386-chroot/tmp/mongoc/example-client ] || (echo "Example was not built!" ; exit 1)
93+
(cd ./unstable-i386-chroot/tmp/ ; tar zcvf ../../deb.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb)
94+
95+
# Build a second time, to ensure a "double build" works
96+
sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
97+
cd /tmp/mongoc && \
98+
rm -f example-client && \
99+
git status --ignored && \
100+
dpkg-buildpackage -b && dpkg-buildpackage -S )"

src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ _fgets_wrapper (char *buffer, size_t buffer_size, FILE *f)
6767
* This protects us from files like:
6868
* aaaaa...DISTRIB_ID=nasal demons
6969
*/
70-
TRACE ("Found line of length %ld, bailing out", len);
70+
TRACE ("Found line of length %zu, bailing out", len);
7171
return 0;
7272
}
7373

src/libmongoc/src/mongoc/mongoc-socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ _mongoc_socket_try_sendv (mongoc_socket_t *sock, /* IN */
13131313
#else
13141314
0);
13151315
#endif
1316-
TRACE ("Send %ld out of %ld bytes", ret, iov->iov_len);
1316+
TRACE ("Send %zu out of %zu bytes", ret, iov->iov_len);
13171317
#endif
13181318

13191319

src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,14 +342,14 @@ _mongoc_stream_tls_openssl_writev (mongoc_stream_t *stream,
342342
child_ret =
343343
_mongoc_stream_tls_openssl_write (tls, to_write, to_write_len);
344344
if (bson_cmp_not_equal_su (child_ret, to_write_len)) {
345-
TRACE ("Got child_ret: %ld while to_write_len is: %ld",
345+
TRACE ("Got child_ret: %zu while to_write_len is: %zu",
346346
child_ret,
347347
to_write_len);
348348
}
349349

350350
if (child_ret < 0) {
351-
TRACE ("Returning what I had (%ld) as apposed to the error "
352-
"(%ld, errno:%d)",
351+
TRACE ("Returning what I had (%zu) as apposed to the error "
352+
"(%zu, errno:%d)",
353353
ret,
354354
child_ret,
355355
errno);

0 commit comments

Comments
 (0)