bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #23273] Please include xkcd easteregg


From: James Coleman
Subject: Re: [bug #23273] Please include xkcd easteregg
Date: Wed, 09 Jul 2008 20:11:27 +0100
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

Sorry I'm not sure about where to submit a patch.
 http://savannah.gnu.org/projects/make/ ?


I keep on thinking about this since I saw your request Joachim!
Now maybe I can lay it to rest whether this is used or not.


As simple as possible I think.
Don't call to fatal so that easter egg error text is clear of adornment.
Exits using die(2) as fatal does.
Doesn't trigger action if -k (continue on error) is specified.
There's already a strcmp() call in remake.c (strncmp used for this patch).
There's already a getuid() call in misc.c, I think for all platforms.
Tested on linux, solaris and cygwin.


patch also attached

$ cat make_me_some_tea.patch
Index: remake.c
===================================================================
RCS file: /sources/make/make/remake.c,v
retrieving revision 1.137
diff -u -r1.137 remake.c
--- remake.c    5 Nov 2007 14:15:20 -0000       1.137
+++ remake.c    9 Jul 2008 16:58:29 -0000
@@ -353,6 +353,13 @@

   if (!keep_going_flag)
     {
+      // bug #23273: http://xkcd.com/149/
+      if (!strncmp ("me", file->name, 3))
+       if (getuid())
+         fputs ("What? Make it yourself.\n", stderr), die (2);
+        else
+         fputs ("Okay.\n", stderr), die (2);
+
       if (file->parent == 0)
         fatal (NILF, msg_noparent, "", file->name, "");




$ ./make the cat some tea
make: *** No rule to make target `the'.  Stop.

$ ./make me a sandwich
What? Make it yourself.

$ sudo ./make me a sandwich
Okay.

$ ./make -k me a sandwich
make: *** No rule to make target `me'.
make: *** No rule to make target `a'.
make: *** No rule to make target `sandwich'.

$ ./make -f Makefile.me -k me a sandwich
make: Nothing to be done for `me'.
make: *** No rule to make target `a'.
make: Nothing to be done for `sandwich'.

$ ./make -f Makefile.me me a sandwich
make: Nothing to be done for `me'.
make: *** No rule to make target `a'.  Stop.

$ ./make me a cup of tea please
What? Make it yourself.

$ make -k me a god
make: *** No rule to make target `me'.
make: *** No rule to make target `a'.
make: *** No rule to make target `god'.

$ su -

address@hidden # cd ~yyy/make-3.81

address@hidden # ./make me a god
Okay.

address@hidden # ./make haste not waste
make: *** No rule to make target `haste'.  Stop.




Joachim Breitner wrote:
> Follow-up Comment #3, bug #23273 (project make):
> 
> Sure, I know how to make this happen on my machine (also by shell aliases
> etc.), but that’s not the point of an easter egg. I imagine someone reading
> that comic strip, trying it out just for the sake of it and then be really
> surprised that it works.
> 
>     _______________________________________________________
> 
> Reply to this item at:
> 
>   <http://savannah.gnu.org/bugs/?23273>
> 

Index: remake.c
===================================================================
RCS file: /sources/make/make/remake.c,v
retrieving revision 1.137
diff -u -r1.137 remake.c
--- remake.c    5 Nov 2007 14:15:20 -0000       1.137
+++ remake.c    9 Jul 2008 16:58:29 -0000
@@ -353,6 +353,13 @@
 
   if (!keep_going_flag)
     {
+      // bug #23273: http://xkcd.com/149/ 
+      if (!strncmp ("me", file->name, 3))
+       if (getuid())
+         fputs ("What? Make it yourself.\n", stderr), die (2);
+        else
+         fputs ("Okay.\n", stderr), die (2);
+
       if (file->parent == 0)
         fatal (NILF, msg_noparent, "", file->name, "");
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]