Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libmseed for openSUSE:Factory checked in at 2026-03-30 18:31:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libmseed (Old) and /work/SRC/openSUSE:Factory/.libmseed.new.1999 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libmseed" Mon Mar 30 18:31:52 2026 rev:13 rq:1343539 version:3.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libmseed/libmseed.changes 2026-01-26 11:06:13.543784392 +0100 +++ /work/SRC/openSUSE:Factory/.libmseed.new.1999/libmseed.changes 2026-03-30 18:35:15.264979421 +0200 @@ -1,0 +2,12 @@ +Sun Mar 29 20:14:47 UTC 2026 - Andreas Stieger <[email protected]> + +- update to 3.3.0: + * Add ms3_msfp_init() to initialized MS3FileParam with start/end + offsets + * Avoid closing I/O streams not opened by the library when + reading or writing miniSEED, specifically stdin and stdout or a + provided descriptor. Behavior change: I/O streams provided by + the caller, such as stdin and stdout, are no longer closed by + the library. + +------------------------------------------------------------------- Old: ---- libmseed-3.2.4.tar.gz New: ---- libmseed-3.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libmseed.spec ++++++ --- /var/tmp/diff_new_pack.J6LZu7/_old 2026-03-30 18:35:16.201018555 +0200 +++ /var/tmp/diff_new_pack.J6LZu7/_new 2026-03-30 18:35:16.201018555 +0200 @@ -18,7 +18,7 @@ %define sover 3 Name: libmseed -Version: 3.2.4 +Version: 3.3.0 Release: 0 Summary: MiniSEED data format library License: Apache-2.0 ++++++ libmseed-3.2.4.tar.gz -> libmseed-3.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/.github/workflows/build-test.yml new/libmseed-3.3.0/.github/workflows/build-test.yml --- old/libmseed-3.2.4/.github/workflows/build-test.yml 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/.github/workflows/build-test.yml 2026-03-29 21:55:41.000000000 +0200 @@ -29,7 +29,7 @@ steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install dependencies (Linux) if: runner.os == 'Linux' @@ -59,7 +59,7 @@ run: ctest --output-on-failure - name: Upload library artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: libmseed-${{ matrix.os }}-${{ matrix.arch }} path: | @@ -85,10 +85,10 @@ steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup MSVC - uses: ilammy/msvc-dev-cmd@v1 + uses: TheMrMilchmann/setup-msvc-dev@v4 with: arch: ${{ matrix.cmake_arch }} @@ -112,7 +112,7 @@ run: ctest -C Release --output-on-failure - name: Upload library artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v6 with: name: libmseed-Windows-${{ matrix.arch }} path: | @@ -126,7 +126,7 @@ steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup MSYS2/MinGW uses: msys2/setup-msys2@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/ChangeLog new/libmseed-3.3.0/ChangeLog --- old/libmseed-3.2.4/ChangeLog 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/ChangeLog 2026-03-29 21:55:41.000000000 +0200 @@ -1,3 +1,12 @@ +2026.088: v3.3.0 + - Add `ms3_msfp_init()` to initialized MS3FileParam with start/end offsets. + - Avoid closing I/O streams not opened by the library when reading or + writing miniSEED, specifically stdin and stdout or a provided descriptor. + - Update GitHub Actions dependencies for Node 24 changes. + +NOTE Behavior change: I/O streams provided by the caller, such as stdin +and stdout, are no longer closed by the library. + 2026.024: v3.2.4 - Add ms_rlog_pop() to return messages from the error/warning log registry - Fix return value from ms_rlog_emit() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/fileutils.c new/libmseed-3.3.0/fileutils.c --- old/libmseed-3.2.4/fileutils.c 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/fileutils.c 2026-03-29 21:55:41.000000000 +0200 @@ -62,8 +62,11 @@ * (file descriptor). * * The ::MS3FileParam should be used with ms3_readmsr_r() or - * ms3_readmsr_selection(). Once all data has been read from the - * stream, it will be closed during the cleanup call of those routines. + * ms3_readmsr_selection(). + * + * Note: the specified file descriptor will _not_ be closed during cleanup + * of the MS3FileParam. The caller is responsible for closing the file + * descriptor when it is no longer needed. * * @param[in] fd File descriptor for input reading * @@ -74,6 +77,37 @@ MS3FileParam * ms3_msfp_init_fd (int fd) { + return ms3_msfp_init (0, 0, fd); +} + +/** ************************************************************************ + * @brief Initialize ::MS3FileParam parameters + * + * Initialize a ::MS3FileParam for reading from a specified @p startoffset, + * @p endoffset and/or @p fd (file descriptor). + * + * The ::MS3FileParam should be used with ms3_readmsr_r() or + * ms3_readmsr_selection(). Once all data has been read from the + * stream, it will be closed during the cleanup call of those routines. + * + * Note: the specified file descriptor will _not_ be closed during cleanup + * of the MS3FileParam. The caller is responsible for closing the file + * descriptor when it is no longer needed. + * + * @param[in] startoffset Start offset in input stream if > 0 + * @param[in] endoffset End offset in input stream if > 0 + * @param[in] fd File descriptor for input reading if >= 0 + * + * @returns Allocated ::MS3FileParam on success and NULL on error. + * + * @see ms3_readmsr_r() + * @see ms3_readmsr_selection() + * + * @ref MessageOnError - this function logs a message on error + ***************************************************************************/ +MS3FileParam * +ms3_msfp_init (int64_t startoffset, int64_t endoffset, int fd) +{ MS3FileParam *msfp; /* Initialize the read parameters if needed */ @@ -87,14 +121,38 @@ *msfp = (MS3FileParam)MS3FileParam_INITIALIZER; - msfp->input.type = LMIO_FD; - msfp->input.handle = fdopen (fd, "rb"); + /* Set the start and end offsets if provided */ + if (startoffset > 0) + { + msfp->startoffset = startoffset; + } - if (msfp->input.handle == NULL) + if (endoffset > 0) { - ms_log (2, "%s(): Cannot open file descriptor %d\n", __func__, fd); - libmseed_memory.free (msfp); - return NULL; + msfp->endoffset = endoffset; + } + + /* Initialize the input handle if a file descriptor is provided */ + if (fd >= 0) + { + msfp->input.type = LMIO_FD; + + int myfd = dup (fd); + if (myfd < 0) + { + ms_log (2, "%s(): Cannot dup file descriptor %d\n", __func__, fd); + libmseed_memory.free (msfp); + return NULL; + } + + msfp->input.handle = fdopen (myfd, "rb"); + if (msfp->input.handle == NULL) + { + ms_log (2, "%s(): Cannot fdopen file descriptor %d\n", __func__, fd); + close (myfd); + libmseed_memory.free (msfp); + return NULL; + } } return msfp; @@ -251,8 +309,22 @@ if (strcmp (mspath, "-") == 0) { + int myfd = dup (fileno (stdin)); + if (myfd < 0) + { + ms_log (2, "Cannot dup stdin\n"); + msr3_free (ppmsr); + return MS_GENERROR; + } + msfp->input.type = LMIO_FD; - msfp->input.handle = stdin; + msfp->input.handle = fdopen (myfd, "rb"); + if (msfp->input.handle == NULL) + { + close (myfd); + msr3_free (ppmsr); + return MS_GENERROR; + } } else { @@ -949,7 +1021,8 @@ msr3_pack_free (&packer, NULL); /* Close file and return record count */ - fclose (ofp); + if (ofp != stdout) + fclose (ofp); return packedrecords; } /* End of msr3_writemseed() */ @@ -1031,7 +1104,8 @@ verbose, NULL); /* Close file and return record count */ - fclose (ofp); + if (ofp != stdout) + fclose (ofp); return packedrecords; } /* End of mstl3_writemseed() */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/libmseed.h new/libmseed-3.3.0/libmseed.h --- old/libmseed-3.2.4/libmseed.h 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/libmseed.h 2026-03-29 21:55:41.000000000 +0200 @@ -29,8 +29,8 @@ { #endif -#define LIBMSEED_VERSION "3.2.4" //!< Library version -#define LIBMSEED_RELEASE "2026.024" //!< Library release date +#define LIBMSEED_VERSION "3.3.0" //!< Library version +#define LIBMSEED_RELEASE "2026.088" //!< Library release date /** @defgroup io-functions File and URL I/O */ /** @defgroup miniseed-record Record Handling */ @@ -79,6 +79,7 @@ #include <sys/timeb.h> #include <sys/types.h> #include <windows.h> +#include <io.h> /* Re-define print conversion for size_t values */ #undef PRIsize_t @@ -115,6 +116,9 @@ #define vsnprintf _vsnprintf #define strtoull _strtoui64 #define fileno _fileno +#define dup _dup +#define dup2 _dup2 +#define close _close #define fdopen _fdopen #endif @@ -132,6 +136,7 @@ /* All other platforms */ #include <inttypes.h> #include <sys/time.h> +#include <unistd.h> #endif #define MINRECLEN 40 //!< Minimum miniSEED record length supported @@ -843,8 +848,9 @@ extern int64_t mstl3_writemseed (MS3TraceList *mstl, const char *mspath, int8_t overwrite, int maxreclen, int8_t encoding, uint32_t flags, int8_t verbose); extern int libmseed_url_support (void); +extern MS3FileParam *ms3_msfp_init (int64_t startoffset, int64_t endoffset, int fd); extern MS3FileParam *ms3_msfp_init_fd (int fd); -/* Backwards compatibility alias for ms3_msfp_init_fd() */ +/* Backwards compatibility alias for misnamed ms3_msfp_init_fd() */ #define ms3_mstl_init_fd(fd) ms3_msfp_init_fd(fd) /** @} */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/test/test-read.c new/libmseed-3.3.0/test/test-read.c --- old/libmseed-3.2.4/test/test-read.c 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/test/test-read.c 2026-03-29 21:55:41.000000000 +0200 @@ -3,6 +3,15 @@ #include "testdata.h" +/* Handle binary mode for Windows specifically */ +#if defined(LMP_WIN) + #include <io.h> + #include <fcntl.h> + #define SET_BINARY_MODE(fd) _setmode(fd, _O_BINARY) +#else + #define SET_BINARY_MODE(fd) ((void)0) +#endif + extern int cmpint32s (int32_t *arrayA, int32_t *arrayB, size_t length); extern int cmpfloats (float *arrayA, float *arrayB, size_t length); extern int cmpdoubles (double *arrayA, double *arrayB, size_t length); @@ -377,6 +386,78 @@ ms3_readmsr(&msr, NULL, flags, 0); } +TEST (read, byterange_init) +{ + MS3FileParam *msfp = NULL; + MS3Record *msr = NULL; + nstime_t nstime; + uint32_t flags = MSF_UNPACKDATA; + int rv; + + nstime = ms_timestr2nstime ("2010-02-27T06:51:04.069539Z"); + + /* Read byte range 9428-9967 from V3 format file */ + msfp = ms3_msfp_init (9428, 9967, -1); + REQUIRE (msfp != NULL, "ms3_msfp_init() did not return expected MS3FileParam"); + rv = ms3_readmsr_r (&msfp, &msr, "data/testdata-oneseries-mixedlengths-mixedorder.mseed3", flags, 0); + REQUIRE (rv == MS_NOERROR, "ms3_readmsr_r() did not return expected MS_NOERROR"); + CHECK (msr->numsamples == 112, "Byte range read, unexpected number of decoded samples"); + CHECK (msr->starttime == nstime, "Byte range read, unexpected record start time"); + ms3_readmsr(&msr, NULL, flags, 0); + + // /* Read byte range 9344-9855 from V2 format file */ + msfp = ms3_msfp_init (9344, 9855, -1); + REQUIRE (msfp != NULL, "ms3_msfp_init() did not return expected MS3FileParam"); + rv = ms3_readmsr_r (&msfp, &msr, "data/testdata-oneseries-mixedlengths-mixedorder.mseed2", flags, 0); + REQUIRE (rv == MS_NOERROR, "ms3_readmsr_r() did not return expected MS_NOERROR"); + CHECK (msr->numsamples == 112, "Byte range read, unexpected number of decoded samples"); + CHECK (msr->starttime == nstime, "Byte range read, unexpected record start time"); + ms3_readmsr(&msr, NULL, flags, 0); +} + +TEST (read, stdin_no_close) +{ + MS3Record *msr = NULL; + uint32_t flags = MSF_UNPACKDATA; + int rv; + int stdin_fd = fileno (stdin); + int orig_stdin_copy; + FILE *test_data_fp; + + /* Save the original stdin descriptor to restore later */ + orig_stdin_copy = dup (stdin_fd); + REQUIRE (orig_stdin_copy >= 0, "Failed to duplicate stdin"); + + /* Redirect stdin to our test data file */ + test_data_fp = fopen ("data/testdata-3channel-signal.mseed3", "rb"); + REQUIRE (test_data_fp != NULL, "Cannot open test data file"); + + REQUIRE (dup2 (fileno (test_data_fp), stdin_fd) >= 0, "Failed to redirect stdin"); + fclose (test_data_fp); /* Close FILE* wrapper; fd is now duplicated onto stdin */ + SET_BINARY_MODE (stdin_fd); + + /* Read a record from stdin via "-" */ + rv = ms3_readmsr (&msr, "-", flags, 0); + CHECK (rv == MS_NOERROR, "ms3_readmsr() failed to read from stdin"); + REQUIRE (msr != NULL, "ms3_readmsr() did not populate 'msr'"); + CHECK (msr->numsamples == 135, "stdin read, unexpected number of decoded samples"); + CHECK_STREQ (msr->sid, "FDSN:IU_COLA_00_L_H_1"); + + /* Trigger cleanup, where the descriptor was previously erroneously closed */ + ms3_readmsr (&msr, NULL, flags, 0); + CHECK (msr == NULL, "ms3_readmsr() cleanup failed to nullify pointer"); + + /* Verify stdin was NOT closed by libmseed cleanup */ + int check_fd = dup (stdin_fd); + CHECK (check_fd >= 0, "stdin was closed by libmseed cleanup!"); + if (check_fd >= 0) + close (check_fd); + + /* Restore original stdin */ + dup2 (orig_stdin_copy, stdin_fd); + close (orig_stdin_copy); +} + TEST (read, selection) { MS3Record *msr = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libmseed-3.2.4/test/test-tracelist.c new/libmseed-3.3.0/test/test-tracelist.c --- old/libmseed-3.2.4/test/test-tracelist.c 2026-01-25 00:20:43.000000000 +0100 +++ new/libmseed-3.3.0/test/test-tracelist.c 2026-03-29 21:55:41.000000000 +0200 @@ -205,7 +205,7 @@ /* This test reads miniSEED from a file into a MS3TraceList while using the * MSF_PPUPDATETIME flag to set the segment prvtptr to the update time of the * record. The expected value of the segment prvtptr is verified to be within - * 1 second of the system time. + * 10 seconds of the system time. */ TEST (tracelist, ms3_readtracelist_ppupdatetime) { @@ -236,10 +236,10 @@ CHECK (id->first->prvtptr != NULL, "id->first->prvtptr is not populated"); - /* Check that update time is within 1 second of system time */ + /* Check that update time is within 10 seconds of system time */ difference = *(nstime_t *)id->first->prvtptr - (nstime_t)timeval * NSTMODULUS; - CHECK (difference < 1 * NSTMODULUS, "update time at id->first->prvtptr is not within 1 second of system time"); + CHECK (difference < 10 * NSTMODULUS, "update time at id->first->prvtptr is not within 10 seconds of system time"); mstl3_free (&mstl, 1); }
