Bug 1515352 - From 12:30:00 to 12:30:59, as indicated by localtime(), man will return "gimme gimme gimme"
Summary: From 12:30:00 to 12:30:59, as indicated by localtime(), man will return "gimm...
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: man-db   
(Show other bugs)
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Nikola Forró
QA Contact: Anna Khaitovich
Marie Dolezelova
URL:
Whiteboard:
Keywords: Patch
Depends On:
Blocks: 1549619
TreeView+ depends on / blocked
 
Reported: 2017-11-20 16:20 UTC by Kyle Walker
Modified: 2019-02-13 11:31 UTC (History)
10 users (show)

Fixed In Version: man-db-2.6.3-10.el7
Doc Type: Release Note
Doc Text:
The *man* utility no longer prints "gimme gimme gimme" after midnight Prior to this update, there was an Easter egg in the *man* utility that printed "gimme gimme gimme" in the standard error output at 00:30 local time. As a consequence, under certain circumstances the unexpected output misled automated tools. With this update, the Easter egg has been removed, and the described problem no longer occurs.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-10-30 08:03:07 UTC
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Stop Easter egg interfering with non-error cases (1.44 KB, patch)
2017-11-21 12:52 UTC, Nikola Forró
no flags Details | Diff
Remove easter egg interfering with non-error cases (974 bytes, patch)
2017-11-22 13:46 UTC, Nikola Forró
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3060 None None None 2018-10-30 08:03 UTC

Description Kyle Walker 2017-11-20 16:20:08 UTC
Description of problem:
 The upstream man-db project includes an easter egg where the following is returned to stderr:

    "gimme gimme gimme"


Version-Release number of selected component (if applicable):
    man-db-2.6.3-9.el7.x86_64


How reproducible:
    Easily

Steps to Reproduce:
1. Run the reproducer below:

    # ITER=5; date -s "00:29:58" 1>/dev/null && while true; do if [[ ! $((ITER--)) -le 0 ]]; then date; man -w 1>/dev/null; sleep 1; else break; fi; done


2. Verify output returned

Actual results:
    Mon Nov 20 00:29:58 EST 2017
    Mon Nov 20 00:29:59 EST 2017
    Mon Nov 20 00:30:00 EST 2017
    gimme gimme gimme
    Mon Nov 20 00:30:01 EST 2017
    gimme gimme gimme
    Mon Nov 20 00:30:02 EST 2017
    gimme gimme gimme


Expected results:
    Mon Nov 20 00:29:58 EST 2017
    Mon Nov 20 00:29:59 EST 2017
    Mon Nov 20 00:30:00 EST 2017
    Mon Nov 20 00:30:01 EST 2017
    Mon Nov 20 00:30:02 EST 2017


Additional info:
 This easter egg is documented in the upstream commit below.

commit 002a6339b1fe8f83f4808022a17e1aa379756d99
Author: Colin Watson <cjwatson@debian.org>
Date:   Mon Nov 7 16:09:08 2011 +0000

    Easter egg suggested by Thomas Thurman.

diff --git a/src/man.c b/src/man.c
index 1978329e..48af3c08 100644
--- a/src/man.c
+++ b/src/man.c
@@ -1154,8 +1154,16 @@ int main (int argc, char *argv[])
 
        debug ("\nusing %s as pager\n", pager);
 
-       if (first_arg == argc)
+       if (first_arg == argc) {
+               /* http://twitter.com/#!/marnanel/status/132280557190119424 */
+               time_t now = time (NULL);
+               struct tm *localnow = localtime (&now);
+               if (localnow &&
+                   localnow->tm_hour == 0 && localnow->tm_min == 1)
+                       fprintf (stderr, "gimme gimme gimme\n");
+
                gripe_no_name (NULL);
+       }
 
        section_list = get_section_list ();

Comment 4 Colin Watson 2017-11-21 12:35:48 UTC
Sorry about this.  Fix is here: https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=84bde8d8a9a357bd372793d25746ac6b49480525

(If there are any more problems with it I'll remove the Easter egg, but this one was easy to fix.)

Comment 5 Nikola Forró 2017-11-21 12:51:58 UTC
Thanks Colin. Patch backported.

Comment 6 Nikola Forró 2017-11-21 12:52 UTC
Created attachment 1356670 [details]
Stop Easter egg interfering with non-error cases

Comment 8 Michal Schmidt 2017-11-22 13:36:47 UTC
Nikola,
consider backporting the followup ("Remove Easter egg entirely"):
https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=b225d9e76fbb0a6a4539c0992fba88c83f0bd37e

Comment 9 Nikola Forró 2017-11-22 13:46 UTC
Created attachment 1357513 [details]
Remove easter egg interfering with non-error cases

Comment 17 Adam Kvitek 2018-09-04 14:38:34 UTC
Hello Nikola,

thank you! I have made few additional changes which may specify what was actually happening. But I am not sure by their technical accuracy. Could you please check again if I am not wrong?

----
The *man* utility no longer prints "gimme gimme gimme" after midnight

Prior to this update, there was an Easter egg in the *man* utility that printed "gimme gimme gimme" in the standard error output at 00:30 local time when "man -w" was used. As a consequence, under certain circumstances the unexpected output caused a wrong exit status which misled automated tools. With this update, the Easter egg has been removed, and the described problem no longer occurs.
----

Changes I am not sure of:

--> I tried to specify when exactly was the bug happening (when "man -w" was used). Was it just with this command?

-->  "the unexpected output caused a wrong exit status which misled automated tools" From what I understood, the problem was not the "gimme gimme gimme", but exit status 0 instead of something else...


Thank you!

Best regards,
Adam Kvítek

Comment 18 Nikola Forró 2018-09-04 15:09:34 UTC
No, the text was printed every time man was run without a man page argument, regardless of the -w option, so for instance

$ man
$ man -w

but not

$ man -w bash


And no, there was no change in exit status.

Comment 19 Adam Kvitek 2018-09-05 13:05:21 UTC
Hello Nikola,

thank you. I am updating the Doc Text.

Best regards,
Adam Kvítek

Comment 22 errata-xmlrpc 2018-10-30 08:03:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3060


Note You need to log in before you can comment on or make changes to this bug.