Public bug reported:
The -r option to strfile is supposed to randomize the order of the entries in
the index file produced by
the program.
This could be used, for instance, to randomize the order of the entry in the
entries' file by using unstr.
While this doesn't work due to bugs #1444427 and #1961954 (i submitted a patch
to these bugs) the presence of the bug can be checked by doing the following:
1. Create lorem-ipsum file containing a few entries:
--------------------------------------------------------- cut ----------------
1. Create a data file with a few entries, eg:
Cras placerat accumsan nulla.
%
Phasellus neque orci, porta a, aliquet quis, semper a, massa. Etiam laoreet
quam sed arcu.
%
Sed bibendum.
Aliquam feugiat tellus ut neque. Nullam libero mauris, consequat quis, varius
et, dictum id, arcu. Donec vitae dolor. Nunc porta vulputate tellus.
%
Curabitur vulputate vestibulum lorem. Nullam tristique diam non turpis.
%
---------------------------------------------------- cut ------------------
2. run strfile
strfile -r lorem-ipsum
"lorem-ipsum.dat" created
There were 4 strings
Longest string: 164 bytes
Shortest string: 30 bytes
3. repeatedly invoke fortune as
fortune lorem-ipsum
* only three entries will ever be visualized (which ones is random)
* in average every n times (where n is the number of entries) an empty cookie
will be shown
This is due to an error in the randomize function in strfile.c: at line
388 the statement
cnt = Num_pts;
should actually be
cnt = Num_pts - 1;
ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: fortune-mod 1:1.99.1-9.2
ProcVersionSignature: Ubuntu 7.0.0-38.38-generic 7.0.14
Uname: Linux 7.0.0-38-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.34.1-0ubuntu0.1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: XFCE
Date: Sat Oct 17 21:44:48 2026
InstallationDate: Installed on 2026-01-31 (259 days ago)
InstallationMedia: Xubuntu 25.10 "Questing Quokka" - Release amd64 (20251008.1)
SourcePackage: fortune-mod
UpgradeStatus: Upgraded to resolute on 2026-05-23 (147 days ago)
** Affects: fortune-mod (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug resolute
** Patch added: "patch solving the bug"
https://bugs.launchpad.net/bugs/2171310/+attachment/6010145/+files/strfile.patch
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171310
Title:
strfile doesn't correctly handle the -r flag
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fortune-mod/+bug/2171310/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs