diff --git a/.cirrus.yml b/.cirrus.yml index a1c965e25..c0eed47b1 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -35,22 +35,22 @@ compile_template: &COMPILE if test "$USE_CONFIG" = "yes"; then MAKE_OPTS= autoreconf -i - eval ./configure --enable-plugins --enable-werror $CONFIG_OPTS CFLAGS=\"-g -O3 $CFLAGS\" || \ + eval ./configure --enable-plugins --enable-werror $CONFIG_OPTS CFLAGS=\"$CFLAGS\" || \ ( cat config.log; false ) else MAKE_OPTS=-e fi - make cc-version + make cc-version $MAKE_OPTS if test "x$DO_MAINTAINER_CHECKS" = "xyes"; then - make maintainer-check + make maintainer-check $MAKE_OPTS fi make -j 4 $MAKE_OPTS test_template: &TEST test_script: | - make test-shlib-exports - make test - if test "x$DO_UNTRACKED_FILE_CHECK" = "xyes"; then make check-untracked ; fi + make test-shlib-exports $MAKE_OPTS + make test $MAKE_OPTS + if test "x$DO_UNTRACKED_FILE_CHECK" = "xyes"; then make check-untracked $MAKE_OPTS ; fi #-------------------------------------------------- # Task: linux builds. @@ -76,7 +76,7 @@ gcc_task: - environment: USE_CONFIG: yes # ubsan is incompatible with some -Wformat opts so we do that on clang. - CFLAGS: -fsanitize=address,undefined -DHTS_ALLOW_UNALIGNED=0 -Wno-format-truncation -Wno-format-overflow + CFLAGS: -g -O3 -fsanitize=address,undefined -DHTS_ALLOW_UNALIGNED=0 -Wno-format-truncation -Wno-format-overflow LDFLAGS: -fsanitize=address,undefined USE_LIBDEFLATE: yes UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1 @@ -110,11 +110,12 @@ ubuntu_task: matrix: - environment: USE_CONFIG: yes + CFLAGS: -g -O3 DO_UNTRACKED_FILE_CHECK: yes - environment: # Cirrus-CI's clang isn't installed with ubsan, so we do that in gcc USE_CONFIG: yes - CFLAGS: -std=c99 -pedantic -Wformat -Wformat=2 -g -Wall -O3 + CFLAGS: -g -O3 -std=c99 -pedantic -Wall -Wformat -Wformat=2 USE_LIBDEFLATE: yes # NB: we could consider building a docker image with these @@ -142,7 +143,7 @@ rocky_task: LC_ALL: C CIRRUS_CLONE_DEPTH: 1 USE_CONFIG: yes - CFLAGS: -g -O3 -std=gnu90 -Wformat -Wformat=2 -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers -Wno-empty-body + CFLAGS: -g -O3 -std=gnu90 -Wall -Wformat -Wformat=2 -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers # NB: we could consider building a docker image with these # preinstalled and specifying that instead, to speed up testing. @@ -187,11 +188,10 @@ arm_ubuntu_task: macosx_task: name: macosx + clang macos_instance: - image: ghcr.io/cirruslabs/macos-ventura-base:latest + image: ghcr.io/cirruslabs/macos-sonoma-base:latest environment: CC: clang - CFLAGS: "-Wall -arch arm64 -arch x86_64" LDFLAGS: "-arch arm64 -arch x86_64" LIBDEFLATE_CFLAGS: "-arch arm64 -arch x86_64" LC_ALL: C @@ -200,9 +200,11 @@ macosx_task: matrix: - environment: USE_CONFIG: no + CFLAGS: "-g -O3 -Wall -Werror -arch arm64 -arch x86_64" - environment: USE_CONFIG: yes USE_LIBDEFLATE: yes + CFLAGS: "-g -O3 -Wall -arch arm64 -arch x86_64" package_install_script: | HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool xz git \ diff --git a/bgzip.c b/bgzip.c index 740aef117..687b29d47 100644 --- a/bgzip.c +++ b/bgzip.c @@ -362,8 +362,7 @@ int main(int argc, char **argv) } else { ret = 2; //explicit N - no overwrite, continue and return 2 - if (hclose(f_src) < 0) - ; //ignoring return value + hclose_abruptly(f_src); free(name); continue; } diff --git a/htslib/bgzf.h b/htslib/bgzf.h index 4325d8e1c..87d4c6a3b 100644 --- a/htslib/bgzf.h +++ b/htslib/bgzf.h @@ -182,7 +182,8 @@ static inline ssize_t bgzf_read_small(BGZF *fp, void *data, size_t length) { */ static inline ssize_t bgzf_write_small(BGZF *fp, const void *data, size_t length) { - if (fp->is_compressed && BGZF_BLOCK_SIZE - fp->block_offset > length) { + if (fp->is_compressed + && (size_t) (BGZF_BLOCK_SIZE - fp->block_offset) > length) { // Short cut the common and easy mode memcpy((uint8_t *)fp->uncompressed_block + fp->block_offset, data, length);