From 699100ebee664bba0c9db2fc8595ebbfdf9a6d6c4f9512a5694b275d6a45492d Mon Sep 17 00:00:00 2001 From: Pedro Monreal Gonzalez Date: Mon, 20 Mar 2023 07:52:50 +0000 Subject: [PATCH] Accepting request 1072525 from home:bmwiedemann:branches:devel:languages:perl Add fix2038.patch to handle dates beyond year 2038 OBS-URL: https://build.opensuse.org/request/show/1072525 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Date-Calc?expand=0&rev=29 --- cpanspec.yml | 4 ++-- fix2038.patch | 34 ++++++++++++++++++++++++++++++++++ perl-Date-Calc.changes | 5 +++++ perl-Date-Calc.spec | 2 ++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 fix2038.patch diff --git a/cpanspec.yml b/cpanspec.yml index c61f43d..ad00513 100644 --- a/cpanspec.yml +++ b/cpanspec.yml @@ -4,8 +4,8 @@ description_paragraphs: 3 #sources: # - source1 # - source2 -#patches: -# foo.patch: -p1 +patches: + fix2038.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ diff --git a/fix2038.patch b/fix2038.patch new file mode 100644 index 0000000..e1e7af2 --- /dev/null +++ b/fix2038.patch @@ -0,0 +1,34 @@ +Date: 2023-03-17 +Author: Bernhard M. Wiedemann + +Fix year2038 issue + +https://rt.cpan.org/Public/Bug/Display.html?id=102495 + +Index: Date-Calc-6.4/lib/Date/Calc/PP.pm +=================================================================== +--- Date-Calc-6.4.orig/lib/Date/Calc/PP.pm ++++ Date-Calc-6.4/lib/Date/Calc/PP.pm +@@ -2057,21 +2057,13 @@ sub DateCalc_mktime + { + return 0 if + ( +- ($year < 1970) or ($year > 2038) or ++ ($year < 1970) or + ($month < 1) or ($month > 12) or + ($day < 1) or ($day > 31) or + ($hour < 0) or ($hour > 23) or + ($min < 0) or ($min > 59) or + ($sec < 0) or ($sec > 59) + ); +- return 0 if +- ( +- ($year == 2038) and ( ($month > 1) or +- ( ($month == 1) and ( ($day > 19) or +- ( ($day == 19) and ( ($hour > 3) or +- ( ($hour == 3) and ( ($min > 14) or +- ( ($min == 14) and ($sec > 7) ) ))))))) +- ); + } + $year -= 1900; + $month--; diff --git a/perl-Date-Calc.changes b/perl-Date-Calc.changes index 3c7a049..d001871 100644 --- a/perl-Date-Calc.changes +++ b/perl-Date-Calc.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Mar 17 07:14:06 UTC 2023 - Bernhard Wiedemann + +- Add fix2038.patch to handle dates beyond year 2038 + ------------------------------------------------------------------- Thu Apr 16 19:56:35 UTC 2015 - coolo@suse.com diff --git a/perl-Date-Calc.spec b/perl-Date-Calc.spec index 7ae941d..d9883de 100644 --- a/perl-Date-Calc.spec +++ b/perl-Date-Calc.spec @@ -26,6 +26,7 @@ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Date-Calc/ Source0: http://www.cpan.org/authors/id/S/ST/STBEY/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml +Patch0: fix2038.patch BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl @@ -46,6 +47,7 @@ Recommends: perl(Date::Calc::XS) >= 6.4 %prep %setup -q -n %{cpan_name}-%{version} +%patch0 -p1 %build %{__perl} Makefile.PL INSTALLDIRS=vendor