Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 103071 - fortune-mod breaks with LC_ALL/LANG set
Summary: fortune-mod breaks with LC_ALL/LANG set
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: High normal
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-19 11:10 UTC by Jordan
Modified: 2006-03-11 07:19 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan 2005-08-19 11:10:27 UTC
when I set LC_ALL or LANG or what not fortune stops working with commands like
"fortune all"

I used to use something like "fortune 80% off all" but this stopped working once
i set LANG. 

$ fortune all
(fortune output)

$ LANG="en_US.UTF-8" fortune all
No fortunes found
Comment 1 Tom Knight (RETIRED) gentoo-dev 2005-08-19 12:33:52 UTC
When $LC_ALL or $LANG are set fortune looks for files in a subdirectory of the
cookie directory named after the locale. To get around this you can create a
directory /usr/share/fortune/$LC_ALL then from there create a symlink: ln -s ..  all
Comment 2 Jordan 2005-08-19 12:42:23 UTC
I just tried that however, it still doesn't work.

I ran "strace fortune all" and accordingly I see it does go into the directory
and follow the symlink I created however it still reports "no fortunes found"

here's some example output:

stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd", {st_mode=S_IFREG|0644,
st_size=90917, ...}) = 0
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd", {st_mode=S_IFREG|0644,
st_size=90917, ...}) = 0
open("/usr/share/fortune/en_US.UTF-8/all/knghtbrd", O_RDONLY) = 43
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8", {st_mode=S_IFREG|0644,
st_size=90917, ...}) = 0
access("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.dat", R_OK) = 0
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.dat", {st_mode=S_IFREG|0644,
st_size=2244, ...}) = 0
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.dat", {st_mode=S_IFREG|0644,
st_size=2244, ...}) = 0
open("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.dat", O_RDONLY) = 44
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.dat.u8", 0xbfb5fbf4) = -1
ENOENT (No such file or directory)
close(44)                               = 0
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8", {st_mode=S_IFREG|0644,
st_size=90917, ...}) = 0
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8", {st_mode=S_IFREG|0644,
st_size=90917, ...}) = 0
open("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8", O_RDONLY) = 44
stat64("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8.u8", 0xbfb5fbf4) = -1
ENOENT (No such file or directory)
access("/usr/share/fortune/en_US.UTF-8/all/knghtbrd.u8.dat", R_OK) = -1 ENOENT
(No such file or directory)
close(44)                               = 0

and here's the end of the output:

stat64("/usr/local/share/fortune", 0xbfb60084) = -1 ENOENT (No such file or
directory)
stat64("/home/xero/all", 0xbfb60084)    = -1 ENOENT (No such file or directory)
write(2, "No fortunes found\n", 18No fortunes found
)     = 18
exit_group(1)                           = ?
Comment 3 SpanKY gentoo-dev 2005-08-19 17:28:16 UTC
works for me ... on my machine fortune looks in a LANG subdir first and then
falls back to the main shared dir if it wasnt able to find anything

what does this show on your machine:
strings `which fortune` | grep /usr
Comment 4 Tom Knight (RETIRED) gentoo-dev 2005-08-22 11:20:44 UTC
(In reply to comment #2)
> I just tried that however, it still doesn't work.
> 

Sorry, I've just noticed that it was only working because my cwd was
/usr/share/fortune/$LANG.
Comment 5 Jordan 2005-08-22 12:17:49 UTC
(In reply to comment #3)
> what does this show on your machine:
> strings `which fortune` | grep /usr

$ strings `which fortune`|grep /usr
/usr/local/share/fortune/off
/usr/share/fortune/off
/usr/local/share/fortune
/usr/share/fortune
Comment 6 Tupone Alfredo gentoo-dev 2006-03-11 07:19:11 UTC
Fixed in CVS. Thanks for report