Bug 257510 - unstr does not produce a valid fortune file
Summary: unstr does not produce a valid fortune file
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-30 16:32 UTC by Hubert Tournier
Modified: 2023-11-28 02:14 UTC (History)
1 user (show)

See Also:


Attachments
Patch file to correct the issue (761 bytes, patch)
2021-07-30 16:32 UTC, Hubert Tournier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hubert Tournier 2021-07-30 16:32:21 UTC
Created attachment 226804 [details]
Patch file to correct the issue

Overview:

While reimplementing the unstr command, I noticed that the original command, when displaying a fortune file in the order specified in its datafile, does not print the final '%' delimiter, which should end any fortune and any fortune file.

Steps to Reproduce:

# cd /usr/share/games/fortune
# tail -1 freebsd-tips
%
# strfile -Co freebsd-tips
"freebsd-tips.dat" created
There were 134 strings
Longest string: 746 bytes
Shortest string: 39 bytes
# unstr freebsd-tips | tail -4
%
sh (the default Bourne shell in FreeBSD) supports command-line editing.  Just
``set -o emacs'' or ``set -o vi'' to enable it. Use "<TAB>" key to complete
paths.

Build Date & Hardware: 
Additional Builds and Platforms:

Any BSD version since 4.4. This is a 28 years old bug!

Correction:

Here's a patchfile to correct this in /usr/src/usr.bin/fortune/unstr/unstr.c