Skip to content

Commit 4b25ec5

Browse files
authored
Merge branch 'main' into copilot/fix-6
2 parents ca87d78 + 81e9a19 commit 4b25ec5

6 files changed

Lines changed: 124 additions & 45 deletions

File tree

.github/workflows/docker_regression_testing.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,38 @@ jobs:
7272
fortran-branch: '${{ matrix.fortran-branch }}'
7373

7474
###
75+
# Testing some combinatorics for various options.
76+
###
77+
netcdf-test-matrix-oneoff:
78+
79+
needs: netcdf-test-matrix-serial
80+
81+
name: Docker-Based NetCDF-C, Fortran Regression Testing (tinyxml2-related one-off tests)
82+
runs-on: ubuntu-latest
83+
strategy:
84+
matrix:
85+
repo-type: [ 'c' ]
86+
h5ver: [ '1.14.6' ]
87+
c-compiler: [ 'gcc' ]
88+
fortran-branch: [ 'main' ]
89+
buildsystem: [ 'both' ]
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
- name: Pull and Run netCDF Regression Tests
94+
uses: WardF/netcdf-test-action@v1
95+
with:
96+
repo-type: '${{ matrix.repo-type }}'
97+
run-c: 'TRUE'
98+
build-system: '${{ matrix.buildsystem }}'
99+
hdf5-version: '${{ matrix.h5ver }}'
100+
ctest-repeat: 3
101+
c-compiler: '${{ matrix.c-compiler }}'
102+
run-fortran: 'TRUE'
103+
fortran-branch: '${{ matrix.fortran-branch }}'
104+
autotools-c-options: '--disable-dap --disable-dap4 --disable-libxml2 --disable-nczarr'
105+
cmake-c-options: '-DNETCDF_ENABLE_LIBXML2=OFF -DNETCDF_ENABLE_DAP4=OFF -DNETCDF_ENABLE_NCZARR=OFF'
106+
###
75107
# Parallel Testing
76108
###
77109
netcdf-test-matrix-parallel:

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,13 +1468,18 @@ endif()
14681468

14691469
if(NETCDF_ENABLE_DAP4)
14701470
add_subdirectory(libdap4)
1471-
add_subdirectory(libncxml)
14721471
else()
14731472
if(NETCDF_ENABLE_S3_INTERNAL)
14741473
add_subdirectory(libncxml)
14751474
endif()
14761475
endif()
14771476

1477+
if (NETCDF_ENABLE_DAP4 OR NETCDF_ENABLE_S3_INTERNAL OR NETCDF_ENABLE_NCZARR OR NETCDF_ENABLE_LIBXML2)
1478+
add_subdirectory(libncxml)
1479+
else()
1480+
set(XMLPARSER "none required")
1481+
endif()
1482+
14781483
if(NETCDF_ENABLE_PLUGINS)
14791484
add_subdirectory(libncpoco)
14801485
endif()

configure.ac

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -625,48 +625,6 @@ fi
625625
# End libcurl-related stanza
626626
###
627627

628-
###
629-
# Libxml2 control block.
630-
###
631-
632-
AC_MSG_CHECKING([whether to search for and use external libxml2])
633-
AC_ARG_ENABLE([libxml2],
634-
[AS_HELP_STRING([--disable-libxml2],
635-
[disable detection and use of libxml2 in favor of the bundled xml parser])])
636-
test "x$enable_libxml2" = xno || enable_libxml2=yes
637-
AC_MSG_RESULT([$enable_libxml2])
638-
639-
# We can optionally use libxml2 for DAP4 and nch5comms, if enabled
640-
have_libxml2=no
641-
if test "x$enable_libxml2" = xyes; then
642-
AC_CHECK_PROGS([NC_XML2_CONFIG], [xml2-config])
643-
if test -z "$NC_XML2_CONFIG"; then
644-
AC_MSG_ERROR([Cannot find xml2-config utility. Either install the libxml2 development package, or re-run configure with --disable-libxml2 to use the bundled xml2 parser])
645-
fi
646-
AC_CHECK_LIB([xml2],[xmlReadMemory],[have_libxml2=yes],[have_libxml2=no])
647-
if test "x$have_libxml2" = "xyes" ; then
648-
AC_SEARCH_LIBS([xmlReadMemory],[xml2 xml2.dll cygxml2.dll], [],[])
649-
fi
650-
if test "x$have_libxml2" = xyes; then
651-
XML2FLAGS=`xml2-config --cflags`
652-
AC_SUBST([XML2FLAGS],${XML2FLAGS})
653-
AC_DEFINE([HAVE_LIBXML2], [1], [if true, use libxml2])
654-
fi
655-
fi
656-
657-
if test "x$enable_libxml2" = xyes; then
658-
XMLPARSER="libxml2"
659-
else
660-
XMLPARSER="tinyxml2 (bundled)"
661-
fi
662-
663-
# Need a condition and subst for this
664-
AM_CONDITIONAL(NETCDF_ENABLE_LIBXML2, [test "x$enable_libxml2" = xyes])
665-
AC_SUBST([XMLPARSER],[${XMLPARSER}])
666-
667-
###
668-
# End Libxml2 block
669-
###
670628

671629
##
672630
# Should quantize be enabled?
@@ -787,6 +745,66 @@ if test "x$enable_nczarr" = xyes; then
787745
fi
788746
AM_CONDITIONAL(NETCDF_ENABLE_NCZARR, [test x$enable_nczarr = xyes])
789747

748+
749+
###
750+
# End nczarr, dap block
751+
###
752+
753+
###
754+
# Libxml2 control block.
755+
###
756+
757+
AC_MSG_CHECKING([whether to search for and use external libxml2])
758+
AC_ARG_ENABLE([libxml2],
759+
[AS_HELP_STRING([--disable-libxml2],
760+
[disable detection and use of libxml2 in favor of the bundled xml parser])])
761+
test "x$enable_libxml2" = xno || enable_libxml2=yes
762+
AC_MSG_RESULT([$enable_libxml2])
763+
764+
# We can optionally use libxml2 for DAP4 and nch5comms, if enabled
765+
have_libxml2=no
766+
if test "x$enable_libxml2" = xyes; then
767+
AC_CHECK_PROGS([NC_XML2_CONFIG], [xml2-config])
768+
if test -z "$NC_XML2_CONFIG"; then
769+
AC_MSG_ERROR([Cannot find xml2-config utility. Either install the libxml2 development package, or re-run configure with --disable-libxml2 to use the bundled xml2 parser])
770+
fi
771+
AC_CHECK_LIB([xml2],[xmlReadMemory],[have_libxml2=yes],[have_libxml2=no])
772+
if test "x$have_libxml2" = "xyes" ; then
773+
AC_SEARCH_LIBS([xmlReadMemory],[xml2 xml2.dll cygxml2.dll], [],[])
774+
fi
775+
if test "x$have_libxml2" = xyes; then
776+
XML2FLAGS=`xml2-config --cflags`
777+
AC_SUBST([XML2FLAGS],${XML2FLAGS})
778+
AC_DEFINE([HAVE_LIBXML2], [1], [if true, use libxml2])
779+
fi
780+
fi
781+
782+
###
783+
# See https://github.com/Unidata/netcdf-c/issues/2851
784+
# There is a condition where we can avoid compiling libxml2 *and* tinyxml2, if we don't need nczarr or DAP4.
785+
###
786+
XMLPARSER="none required"
787+
AM_CONDITIONAL(NETCDF_ENABLE_XML2,[test "$enable_nczarr" = yes || test "$enable_dap4" = yes || test "$enable_libxml2" = yes])
788+
if test "$enable_nczarr" = yes || test "$enable_dap4" = yes || test "$enable_libxml2" = yes ; then
789+
790+
if test "x$enable_libxml2" = xyes; then
791+
XMLPARSER="libxml2"
792+
else
793+
XMLPARSER="tinyxml2 (bundled)"
794+
fi
795+
fi
796+
797+
# Need a condition and subst for this
798+
AM_CONDITIONAL(NETCDF_ENABLE_LIBXML2, [test "x$enable_libxml2" = xyes])
799+
800+
AC_SUBST([XMLPARSER],[${XMLPARSER}])
801+
802+
###
803+
# End Libxml2 block
804+
###
805+
806+
807+
790808
##########
791809
# Look for Standardized libraries
792810
##########

docs/static-pages/software.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ <h2><a href="#freely">Freely Available Software</a></h2>
4141
<li>
4242
<a href="#ANDX">ANDX (ARM NetCDF Data eXtract) and ANAX (ARM NetCDF ASCII eXtract)</a>
4343
</li>
44+
<li>
45+
<a href="#ANIMATENC">Animate NetCDF (Generates images and animates from netCDF data)</a>
46+
</li>
4447
<li>
4548
<a href="#ANTS" >ANTS (ARM NetCDF Tool Suite)</a>
4649
</li>
@@ -417,6 +420,15 @@ <h2><a id="ANDX" name="ANDX">ANDX and ANAX</a></h2>
417420
designed to only extract ASCII data. All features of ANDX pertaining
418421
to non-graphic data extraction are included in ANAX.
419422
</p>
423+
424+
<h2><a id="ANIMATENC" name="ANIMATENC">Animate NetCDF</a></h2>
425+
<p>
426+
An open-source package developed to generate images (PNG) and animations (MP4)
427+
from NetCDF data, easily: <a href="https://pypi.org/project/animate-netcdf/"></a>.
428+
Create beautiful animations from NetCDF files with support for both single files
429+
and multiple files without concatenation. 75-87% faster than traditional concatenation methods.
430+
</p>
431+
420432

421433
<h2><a id="ANTS" name="ANTS">ANTS</a></h2>
422434
<p>

libdispatch/dstring.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,12 @@ NC_string *
231231
new_NC_string(size_t slen, const char *str)
232232
{
233233
NC_string *ncstrp;
234-
size_t sz = M_RNDUP(sizeof(NC_string)) + slen + 1;
234+
size_t sz;
235+
236+
if (slen > SIZE_MAX - M_RNDUP(sizeof(NC_string)) - 1)
237+
return NULL;
238+
239+
sz = M_RNDUP(sizeof(NC_string)) + slen + 1;
235240

236241
#if 0
237242
sz = _RNDUP(sz, X_ALIGN);

libncxml/Makefile.am

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
include $(top_srcdir)/lib_flags.am
1313

14+
EXTRA_DIST = CMakeLists.txt license.txt
15+
16+
# True if DAP4 and/or NCZARR are enabled
17+
if NETCDF_ENABLE_XML2
18+
1419
if NETCDF_ENABLE_LIBXML2
1520
AM_CPPFLAGS += ${XML2FLAGS}
1621
endif
@@ -27,7 +32,7 @@ AM_CXXFLAGS = -std=c++11
2732
libncxml_la_SOURCES = ncxml_tinyxml2.cpp tinyxml2.cpp tinyxml2.h
2833
endif
2934

30-
EXTRA_DIST = CMakeLists.txt license.txt
35+
3136

3237
# Download and massage the tinyxml2 source
3338
REPO = https://github.com/leethomason/tinyxml2.git
@@ -52,3 +57,5 @@ tinyxml2::
5257
| tr -d '\r' \
5358
| cat > ./tinyxml2.cpp
5459
rm -fr tinyxml2
60+
61+
endif

0 commit comments

Comments
 (0)