Skip to content

CDRIVER-4766 cast size_t/ssize_t to long #1465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion .evergreen/scripts/debian_package_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ set -o errexit

on_exit () {
if [ -e ./unstable-chroot/debootstrap/debootstrap.log ]; then
echo "Dumping debootstrap.log"
echo "Dumping debootstrap.log (64-bit)"
cat ./unstable-chroot/debootstrap/debootstrap.log
fi
if [ -e ./unstable-i386-chroot/debootstrap/debootstrap.log ]; then
echo "Dumping debootstrap.log (32-bit)"
cat ./unstable-i386-chroot/debootstrap/debootstrap.log
fi
}
trap on_exit EXIT

Expand Down Expand Up @@ -66,3 +70,31 @@ sudo chroot ./unstable-chroot /bin/bash -c "(\
rm -f example-client && \
git status --ignored && \
dpkg-buildpackage -b && dpkg-buildpackage -S )"

# And now do it all again for 32-bit
sudo -E ./debootstrap.git/debootstrap --arch i386 unstable ./unstable-i386-chroot/ http://cdn-aws.deb.debian.org/debian
cp -a mongoc ./unstable-i386-chroot/tmp/
sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
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 && \
chown -R root:root /tmp/mongoc && \
cd /tmp/mongoc && \
git clean -fdx && \
git reset --hard HEAD && \
python3 build/calc_release_version.py > VERSION_CURRENT && \
python3 build/calc_release_version.py -p > VERSION_RELEASED && \
git add --force VERSION_CURRENT VERSION_RELEASED && \
git commit VERSION_CURRENT VERSION_RELEASED -m 'Set current/released versions' && \
LANG=C /bin/bash ./debian/build_snapshot.sh && \
debc ../*.changes && \
dpkg -i ../*.deb && \
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 )"

[ -e ./unstable-i386-chroot/tmp/mongoc/example-client ] || (echo "Example was not built!" ; exit 1)
(cd ./unstable-i386-chroot/tmp/ ; tar zcvf ../../deb.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb)

# Build a second time, to ensure a "double build" works
sudo chroot ./unstable-i386-chroot /bin/bash -c "(\
cd /tmp/mongoc && \
rm -f example-client && \
git status --ignored && \
dpkg-buildpackage -b && dpkg-buildpackage -S )"
2 changes: 1 addition & 1 deletion src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ _fgets_wrapper (char *buffer, size_t buffer_size, FILE *f)
* This protects us from files like:
* aaaaa...DISTRIB_ID=nasal demons
*/
TRACE ("Found line of length %ld, bailing out", len);
TRACE ("Found line of length %zu, bailing out", len);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libmongoc/src/mongoc/mongoc-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ _mongoc_socket_try_sendv (mongoc_socket_t *sock, /* IN */
#else
0);
#endif
TRACE ("Send %ld out of %ld bytes", ret, iov->iov_len);
TRACE ("Send %zu out of %zu bytes", ret, iov->iov_len);
#endif


Expand Down
6 changes: 3 additions & 3 deletions src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ _mongoc_stream_tls_openssl_writev (mongoc_stream_t *stream,
child_ret =
_mongoc_stream_tls_openssl_write (tls, to_write, to_write_len);
if (bson_cmp_not_equal_su (child_ret, to_write_len)) {
TRACE ("Got child_ret: %ld while to_write_len is: %ld",
TRACE ("Got child_ret: %zu while to_write_len is: %zu",
child_ret,
to_write_len);
}

if (child_ret < 0) {
TRACE ("Returning what I had (%ld) as apposed to the error "
"(%ld, errno:%d)",
TRACE ("Returning what I had (%zu) as apposed to the error "
"(%zu, errno:%d)",
ret,
child_ret,
errno);
Expand Down