From 7e8b63eca4ac47e0b03fa078892e239b3912d713 Mon Sep 17 00:00:00 2001 From: Sergey Kolosov Date: Mon, 13 Apr 2026 20:15:05 +0200 Subject: [PATCH] CI Tests: add Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when This test was originally missing during the import from Fedora test plan. RPM-Changelog: - RPM-Skip-Release: yes --- .../main.fmf | 18 +++++++ .../runtest.sh | 54 +++++++++++++++++++ .../tst-mktime.c | 24 +++++++++ 3 files changed, 96 insertions(+) create mode 100644 tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/main.fmf create mode 100755 tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/runtest.sh create mode 100644 tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/tst-mktime.c diff --git a/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/main.fmf b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/main.fmf new file mode 100644 index 0000000..b4a5b47 --- /dev/null +++ b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/main.fmf @@ -0,0 +1,18 @@ +summary: Test for BZ#2110357 (glibc mktime() fails with -EOVERFLOW when) +description: | + Bug summary: glibc: mktime() fails with -EOVERFLOW when tm_isdst=1 and a neighboring DST boundary is far from tm_year + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=2110357 +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=2110357 +contact: Sergey Kolosov +component: + - glibc +test: ./runtest.sh +framework: beakerlib +recommend: + - glibc + - glibc-devel + - gcc +duration: 10m +extra-summary: /tools/glibc/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when +extra-task: /tools/glibc/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when diff --git a/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/runtest.sh b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/runtest.sh new file mode 100755 index 0000000..77aaf34 --- /dev/null +++ b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/runtest.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/glibc/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when +# Description: Test for BZ#2110357 (glibc mktime() fails with -EOVERFLOW when) +# Author: Sergey Kolosov +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2022 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="glibc" +TESTPROG="tst-mktime" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + PACKNVR=$(rpm -q ${PACKAGE}.`arch`) + rlRun "TESTTMPDIR=$(mktemp -d)" + rlRun "cp ${TESTPROG}.c $TESTTMPDIR" + rlRun "pushd $TESTTMPDIR" + rlPhaseEnd + + rlPhaseStartTest + rlRun -c "gcc ${TESTPROG}.c -o $TESTPROG" + rlAssertExists "$TESTPROG" + rlRun -c "./${TESTPROG}" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TESTTMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/tst-mktime.c b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/tst-mktime.c new file mode 100644 index 0000000..d73c97d --- /dev/null +++ b/tests/Regression/bz2110357-glibc-mktime-fails-with-EOVERFLOW-when/tst-mktime.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + time_t t; + struct tm tm; + + setenv("TZ", "Asia/Tokyo", 1); + + memset(&tm, 0, sizeof(tm)); + tm.tm_mday = 1; + tm.tm_mon = 1; + tm.tm_year = 2023; + tm.tm_isdst = 1; + + t = mktime(&tm); + printf("mktime(&tm) = %d\n", t); + if (t < 0) + exit(1); + + return 0; +}