Red Hat Bugzilla – Bug 1515352
From 12:30:00 to 12:30:59, as indicated by localtime(), man will return "gimme gimme gimme"
Last modified: 2018-10-30 04:03:14 EDT
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 ();
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.)
Thanks Colin. Patch backported.
Created attachment 1356670 [details] Stop Easter egg interfering with non-error cases
Nikola, consider backporting the followup ("Remove Easter egg entirely"): https://git.savannah.gnu.org/cgit/man-db.git/commit/?id=b225d9e76fbb0a6a4539c0992fba88c83f0bd37e
Created attachment 1357513 [details] Remove easter egg interfering with non-error cases
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
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.
Hello Nikola, thank you. I am updating the Doc Text. Best regards, Adam Kvítek
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