Accepting request 1073044 from devel:languages:perl

OBS-URL: https://build.opensuse.org/request/show/1073044
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/perl-Date-Calc?expand=0&rev=25
This commit is contained in:
Dominique Leuenberger 2023-03-22 21:28:50 +00:00 committed by Git OBS Bridge
commit b037445a12
4 changed files with 43 additions and 2 deletions

View File

@ -4,8 +4,8 @@ description_paragraphs: 3
#sources: #sources:
# - source1 # - source1
# - source2 # - source2
#patches: patches:
# foo.patch: -p1 fix2038.patch: -p1
# bar.patch: # bar.patch:
#preamble: |- #preamble: |-
# BuildRequires: gcc-c++ # BuildRequires: gcc-c++

34
fix2038.patch Normal file
View File

@ -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--;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Mar 17 07:14:06 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add fix2038.patch to handle dates beyond year 2038
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Apr 16 19:56:35 UTC 2015 - coolo@suse.com Thu Apr 16 19:56:35 UTC 2015 - coolo@suse.com

View File

@ -26,6 +26,7 @@ Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Date-Calc/ Url: http://search.cpan.org/dist/Date-Calc/
Source0: http://www.cpan.org/authors/id/S/ST/STBEY/%{cpan_name}-%{version}.tar.gz Source0: http://www.cpan.org/authors/id/S/ST/STBEY/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml Source1: cpanspec.yml
Patch0: fix2038.patch
BuildArch: noarch BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl BuildRequires: perl
@ -46,6 +47,7 @@ Recommends: perl(Date::Calc::XS) >= 6.4
%prep %prep
%setup -q -n %{cpan_name}-%{version} %setup -q -n %{cpan_name}-%{version}
%patch0 -p1
%build %build
%{__perl} Makefile.PL INSTALLDIRS=vendor %{__perl} Makefile.PL INSTALLDIRS=vendor