Bug#860369: unblock: datefudge/1.22
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock
Please consider unblocking version 1.22 of datefudge, which has been in
unstable for last two months without new bugs reported.
It uses time_t instad of int for internal representation of date
and (conditionally) atoll() instead of atoi() for conversions to
fix an issue with dates wrapping on 64-bit systems (for
example `datefudge 2100-12-12 date` now works correctly, while
the version 1.21 shows a date in November 1964).
Note that there is a minor typo in changelog: it should mention
standards-version 3.9.8, instead of 3.9.6.
diff -Nru datefudge-1.21/debian/changelog datefudge-1.22/debian/changelog
--- datefudge-1.21/debian/changelog 2016-02-13 15:19:54.000000000 +0100
+++ datefudge-1.22/debian/changelog 2017-02-04 22:59:11.000000000 +0100
@@ -1,3 +1,16 @@
+datefudge (1.22) unstable; urgency=medium
+
+ * datefudge.c: Apply the following fixes from Thorsten Glaser
+ (closes: #853724):
+ + Operate more efficiently, especially if fudging to the epoch.
+ + Fix running on 32-bit systems with 64-bit time_t (such as x32).
+ * datefudge.man: Document that datefudge might be affected by the
+ Y2K38 problem on some systems.
+ * Use https in Vcs-Git and switch Vcs-Browser to cgit.
+ * Standards-Version: 3.9.6 (no changes).
+
+ -- Robert Luberda <robert@debian.org> Sat, 04 Feb 2017 22:59:11 +0100
+
datefudge (1.21) unstable; urgency=medium
* datefudge.sh: don't fail when its date argument happens to be equal
@@ -83,7 +96,7 @@
* New maintainer (closes: #429467).
* Standards-Version: 3.7.3 (no changes).
* Use debhelper v7 and its minimised rules file.
- * datefudge.c: override clock_gettime(2) called with CLOCK_REALTIME
+ * datefudge.c: override clock_gettime(2) called with CLOCK_REALTIME
argument to make it possible to fake `date' command (closes: #416175).
* Update man page, add a simple example.
@@ -189,4 +202,3 @@
* BitKeeper file /var/tmp/b.s.10098/ChangeSet
-- Matthias Urlichs <smurf@noris.de> 14 Mar 2002 12:12:31 +0200
-
diff -Nru datefudge-1.21/debian/control datefudge-1.22/debian/control
--- datefudge-1.21/debian/control 2016-02-13 15:19:54.000000000 +0100
+++ datefudge-1.22/debian/control 2017-02-04 22:59:11.000000000 +0100
@@ -2,10 +2,10 @@
Section: devel
Priority: optional
Maintainer: Robert Luberda <robert@debian.org>
-Standards-Version: 3.9.6
+Standards-Version: 3.9.8
Build-Depends: debhelper (>= 9)
-Vcs-Git: git://anonscm.debian.org/users/robert/datefudge.git
-Vcs-Browser: https://anonscm.debian.org/gitweb/?p=users/robert/datefudge.git;a=summary
+Vcs-Git: https://anonscm.debian.org/git/users/robert/datefudge.git
+Vcs-Browser: https://anonscm.debian.org/cgit/users/robert/datefudge.git/
Package: datefudge
Architecture: any
diff -Nru datefudge-1.21/datefudge.c datefudge-1.22/datefudge.c
--- datefudge-1.21/datefudge.c 2016-02-13 15:19:54.000000000 +0100
+++ datefudge-1.22/datefudge.c 2017-02-04 22:59:11.000000000 +0100
@@ -15,22 +15,25 @@
#include <dlfcn.h>
#include <assert.h>
#include <features.h>
+#include <stdbool.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
-static int fudge = 0;
-static int dostatic = 0;
+static time_t fudge = 0;
+static bool dostatic = false;
+static bool fudge_set = false;
-static void init_fudge (void) {
- const char *fud;
-
- if(fudge)return;
-
- fud = getenv("DATEFUDGE");
+static void init_fudge (void)
+{
+ const char * const fud = getenv("DATEFUDGE");
if(fud == NULL) return;
- fudge = atoi(fud);
+ if (sizeof(time_t) <= sizeof(int))
+ fudge = atoi(fud);
+ else
+ fudge = atoll(fud);
dostatic = getenv("DATEFUDGE_DOSTATIC") != NULL;
+ fudge_set = true;
}
static void set_fudge(time_t *seconds)
@@ -38,7 +41,8 @@
if (!seconds)
return;
- init_fudge();
+ if (!fudge_set)
+ init_fudge();
if (dostatic)
*seconds = fudge;
@@ -74,8 +78,8 @@
return 0;
}
-int gettimeofday(struct timeval *x, struct timezone *y) {
- return __gettimeofday(x,y);
+int gettimeofday(struct timeval *x, struct timezone *y) {
+ return __gettimeofday(x,y);
}
#ifndef __GNU__
diff -Nru datefudge-1.21/datefudge.man datefudge-1.22/datefudge.man
--- datefudge-1.21/datefudge.man 2016-02-13 15:19:54.000000000 +0100
+++ datefudge-1.22/datefudge.man 2017-02-04 22:59:11.000000000 +0100
@@ -1,5 +1,5 @@
.\" vim:ft=nroff
-.TH DATEFUDGE "1" "February 13th, 2016" "datefudge @VERSION@" Debian
+.TH DATEFUDGE "1" "February 4th, 2017" "datefudge @VERSION@" Debian
.SH NAME
datefudge \- pretend the system time is different
.SH SYNOPSIS
@@ -50,10 +50,17 @@
.SH BUGS
There is no attempt to make this change undetectable by the program.
In particular, file modification times are \fBnot\fR modified.
+.PP
+On systems using 32-bit representation of time, \fBdatefudge\fR is affected by the year
+2038 problem, which might cause dates to be wrapped around, for instance:
+.nf
+\fI$ TZ=UTC datefudge "\fB2038\fR\fI\-01\-19 03:14:07" sh \-c "sleep 1; date \-R"\fR
+Fri Dec 13 20:45:53 UTC \fB1901\fR
+.fi
.SH COPYRIGHT
Copyright \(co 2003 by Matthias Urlichs.
.br
-Copyright \(co 2008-2016 by Robert Luberda.
+Copyright \(co 2008-2017 by Robert Luberda.
.PP
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. You may redistribute copies of datefudge under the
unblock datefudge/1.22
-- System Information:
Debian Release: 9.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Reply to: