crigler / dtach

A simple program that emulates the detach feature of screen
GNU General Public License v2.0
492 stars 50 forks source link

rpmlint warning: dtach uses __DATE and __TIME__ when it should not #8

Closed okurz closed 7 years ago

okurz commented 7 years ago

observation

rpmlint warning:

W: file-contains-date-and-time /usr/bin/dtach
Your file uses  __DATE and __TIME__ this causes the package to rebuild when
not needed

suggestion

consider if https://reproducible-builds.org/specs/source-date-epoch/ is a viable alternative

okurz commented 7 years ago

maybe just remove it like this

diff -Naur dtach-v0.9+2.748020b.orig/main.c dtach-v0.9+2.748020b/main.c
--- dtach-v0.9+2.748020b.orig/main.c    2017-03-06 02:08:33.000000000 +0100
+++ dtach-v0.9+2.748020b/main.c 2017-03-09 16:43:13.585759017 +0100
@@ -49,7 +49,7 @@
 usage()
 {
    printf(
-       "dtach - version %s, compiled on %s at %s.\n"
+       "dtach - version %s\n"
        "Usage: dtach -a <socket> <options>\n"
        "       dtach -A <socket> <options> <command...>\n"
        "       dtach -c <socket> <options> <command...>\n"
@@ -79,7 +79,7 @@
        "\t\t    winch: Send a WINCH signal to the program.\n"
        "  -z\t\tDisable processing of the suspend key.\n"
        "\nReport any bugs to <" PACKAGE_BUGREPORT ">.\n",
-       PACKAGE_VERSION, __DATE__, __TIME__);
+       PACKAGE_VERSION);
    exit(0);
 }

@@ -99,8 +99,8 @@
            usage();
        else if (strncmp(*argv, "--version", strlen(*argv)) == 0)
        {
-           printf("dtach - version %s, compiled on %s at %s.\n",
-               PACKAGE_VERSION, __DATE__, __TIME__);
+           printf("dtach - version %s\n",
+               PACKAGE_VERSION);
            return 0;
        }
crigler commented 7 years ago

That rpmlint warning is outdated now that distributions are patching GCC to set __DATE__ and __TIME__ from the SOURCE_DATE_EPOCH environment variable.

See:

  1. https://wiki.debian.org/ReproducibleBuilds/TimestampsFromCPPMacros
  2. https://lists.opensuse.org/opensuse-packaging/2016-06/msg00083.html
  3. https://build.opensuse.org/package/view_file/SUSE:SLE-12-SP1:GA/gcc6/gcc6-SOURCE_DATE_EPOCH.patch?expand=1
okurz commented 7 years ago

I'm not yet sure if the gcc used for all the distribution versions has this patch included but sure, it's a valid alternative.