]> granicus.if.org Git - fortune-mod/blob - README.md
debian / rinutils: dpkg -i
[fortune-mod] / README.md
1 # fortune-mod Maintenance Version and Ongoing Development
2
3 [![Travis-CI Build Status](https://travis-ci.org/shlomif/fortune-mod.svg?branch=master)](https://travis-ci.org/shlomif/fortune-mod)
4
5 [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/0pbvqd1xa7777aoo/branch/master?svg=true)](https://ci.appveyor.com/project/shlomif/fortune-mod/branch/master)
6
7 This GitHub repository maintains the sources for fortune-mod, a
8 version of
9 [the UNIX fortune command](https://en.wikipedia.org/wiki/Fortune_%28Unix%29).
10 `fortune` is a command-line utility which displays a random quotation from a
11 collection of quotes. This collection is read from the local [file system](https://en.wikipedia.org/wiki/File_system)
12 and does not require network access. A large collection of quotes is provided in
13 the download and installed by default, but more quote collections can be added
14 by the user.
15
16 The canonical repository for the time being is:
17 https://github.com/shlomif/fortune-mod . In the future, we may create a GitHub
18 organization for it and move the sources there.
19
20 For more information about it, you can contact
21 [Shlomi Fish](https://www.shlomifish.org/) .
22
23 ## Installation
24
25 On Fedora and other rpm-based distributions:
26
27 ```
28 sudo dnf install fortune-mod
29 ```
30
31 On Arch Linux and derivatives:
32
33 ```
34 sudo pacman -S fortune-mod
35 ```
36
37 On Debian, and derivatives (e.g: Ubuntu, Linux Mint):
38
39 ```
40 sudo apt install fortune-mod
41 ```
42
43 (Warning: may be an old version.)
44
45 ## Release Tarballs
46
47 Release tarballs can be found at [this directory](https://www.shlomifish.org/open-source/projects/fortune-mod/arcs/)
48 for now.
49
50 Based on [this reported bug](https://github.com/shlomif/fortune-mod/issues/10):
51
52 One can find the official release tarballs of fortune-mod as prepared by CPack
53 there. They have a proper containing directory. One can also download these tarballs
54 from the [GitHub releases page](https://github.com/shlomif/fortune-mod/releases)
55 but please do not use the auto generated “Source code (zip)” and “Source code (tar.gz)”
56 downloads which are both incomplete and have extra directories inside.
57
58 ## Sample usage
59
60 ```
61 $ fortune
62 Enthusiasm is one of the most important
63 ingredients a volunteer project runs on.
64                 -- Andreas Schuldei
65 $
66 ```
67
68 ## History
69
70 I believe fortune-mod was originally forked from the NetBSD version of
71 fortune, and ported to run on Linux systems. For some time it was maintained
72 at the currently offline redellipse-dot-net inside a
73 [GNU Arch](http://en.wikipedia.org/wiki/GNU_arch) (= an old and now mostly
74 unused version control system) repository, and version 1.99.1 was released as
75 a tarball.
76
77 This maintenance version was initiated by Shlomi Fish, who decided to maintain
78 it out of being a fan of the fortune command. It started by importing the
79 unpacked source of the fortune-mod-1.99.1.tar tarball from the Mageia Linux
80 .src.rpm into an empty git repository and continuing from there.
81
82 ## What is the difference between fortune-mod and the "normal" fortune?
83
84 fortune-mod (= "fortune modified") was the name of a fork of the original
85 NetBSD fortune, which was done in order to port the code to Linux and apply some
86 other changes. If you are using a Linux distribution chances are that
87 the `fortune` executable's package **is** fortune-mod (although in the
88 case of Debian-and-derivatives it is likely very out-of-date as of September
89 2020).
90
91 ## Why is it written in C? Can't it be written in Perl, awk, Python, etc.?
92
93 The answer has several parts:
94
95 First of all note that according to [the wikipedia page](https://en.wikipedia.org/wiki/Fortune_%28Unix%29)
96 the original fortune was created in 1979, before the first version of perl was
97 released in 1987, or python, ruby or Lua which were released later, and when UNIX-running
98 computers were more underpowered than they are today.
99
100 Secondly, you can find some reimplementations of fortune here:
101
102 * [perl](https://metacpan.org/pod/distribution/PerlPowerTools/bin/fortune)
103 * [python](https://github.com/bmc/fortune)
104
105 You may be able to get them to work with the data files of fortune-mod and
106 other fortune collections, but note that we have not closely reviewed their
107 source codes.
108
109 Thirdly, most of the value (and relative data size) of the tarball is in the
110 quotes collection.
111
112 Fourthly, a native executable may still give a [better user experience](https://tonsky.me/blog/disenchantment/)
113 (I have yet to perform a stresstest benchmark though, and I doubt it will matter too much
114 for fortune's common use case.)
115
116 Finally note that the runtime algorithm is not as straightforward as one may
117 believe, making use of dat files that contain counts and offsets of the fortune
118 "cookies".
119
120 # What was already done.
121
122 1. fortune-mod-1.99.1 was imported into the repository from the Mageia tarball
123 as the tag <code>fortune-mod-1.99.1</code>.
124
125 2. Converted the build system to [CMake](https://en.wikipedia.org/wiki/CMake) .
126
127 3. Converted the source files to UTF-8.
128
129 4. Added some tests.
130
131 5. Removed trailing whitespace.
132
133 6. Reformatted long (> 80 chars) lines.
134
135 7. Fixed some typos.
136
137 8. Added [Travis-CI](https://travis-ci.org/) testing.
138
139 9. Added valgrind tests and fixed some memory leaks.
140
141 10. Released fortune-mod-1.99.3, fortune-mod-1.99.4, v2.0.0 and up to
142 version 2.26.0
143
144 11. Fixed some C compiler warnings encountered with the GCC compiler flags of
145 [Shlomif_Common](https://bitbucket.org/shlomif/shlomif-cmake-modules/overview).
146
147 12. Added a build-time option to remove the “-o” (= “offensive”) flag, inspired
148 by a set of patches on the Fedora package.
149
150 13. Applied some downstream patches.
151
152 14. Fixed as many “clang -Weverything” warnings as possible.
153
154 15. lib-recode became maintained again at https://github.com/rrthomas/recode
155 (thanks to @rrthomas ) thus preventing a switch to something else.
156
157 16. Got the build and tests to pass on [AppVeyor/MS Windows](https://ci.appveyor.com/project/shlomif/fortune-mod)
158 (with some appreciated help).
159
160 17. Found and fixed some security issues:
161     - Seems to affect some Linux distributions as well as FreeBSD and NetBSD.
162         - Was already fixed in OpenBSD
163     - https://bugs.mageia.org/show_bug.cgi?id=26567
164     - https://advisories.mageia.org/MGASA-2020-0199.html
165     - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246050
166     - https://github.com/shlomif/fortune-mod/commit/fe182a25663261be6e632a2824f6fd653d1d8f45
167     - https://github.com/shlomif/fortune-mod/commit/540c495f57e441b745038061a3cfa59e3a97bf33
168     - https://github.com/shlomif/fortune-mod/commit/acd338098071bddfa1d21f87e1813727031428ea
169
170 18. Reformatted the C code using [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
171
172 # What remains to be done.
173
174 1. See if there are any more downstream patches to apply.
175
176 2. Fix more typos (reports and pull-requests are welcome.)
177
178 3. Perhaps modernize the code a little.
179
180 4. Add more quotes / fortune cookies.
181
182 5. Prepare packages for the new releases for [downstream distributions/Operating Systems](https://pkgs.org/download/fortune-mod).
183
184 # Links
185
186 * [Shlomi Fish’s Fortune Cookie Files](https://www.shlomifish.org/humour/fortunes/) - on his site, containing links to many other collections of fortune cookies.
187 * [XML-Grammar-Fortune](https://web-cpan.shlomifish.org/modules/XML-Grammar-Fortune/) - an XML grammar for collections of quotes, allowing one to generate XHTML or plaintext.
188 * [Anvari.org’s web interface to fortune](http://www.anvari.org/fortune/) - with many collections.