bin/70182: [patch] fortune -e implementation bug

Martin Kulas coolaz at
Sun Aug 8 12:10:07 PDT 2004

>Number:         70182
>Category:       bin
>Synopsis:       [patch] fortune -e implementation bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 08 19:10:07 GMT 2004
>Originator:     Martin Kulas
>Release:        FreeBSD 4.10-RELEASE i386
System: FreeBSD 4.10-RELEASE FreeBSD 4.10-RELEASE #0: Sat Jun 19 23:12:40 CEST 2004 i386

If I type ``fortune -e murphy startrek'' several times, ich will get only 
messages from ``murphy'' but not from ``startrek''. If I understand the
``-e'' flag correctly, this flag should treat all fortune files equally.

Just type ``fortune -e murphy startrek'' and you will not get any message
from ``startrek''.

Apply the following patch:
--- fortune.c.orig	Fri Aug  6 15:13:28 2004
+++ fortune.c	Sun Aug  8 00:51:38 2004
@@ -933,7 +933,7 @@
 			if (num_noprob > 1) {
 				frac = percent / num_noprob;
 				DPRINTF(1, (stderr, ", frac = %d%%", frac));
-				for (fp = File_list; fp != last; fp = fp->next)
+				for (fp = File_tail; fp != last; fp = fp->prev)
 					if (fp->percent == NO_PROB) {
 						fp->percent = frac;
 						percent -= frac;

Now ``murphy'' and ``startrek'' are treated equally.


More information about the freebsd-bugs mailing list