Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying percentage for "all" breaks if both FORTDIR and LOCFORTDIR have fortunes #79

Open
ralismark opened this issue Mar 4, 2023 · 1 comment

Comments

@ralismark
Copy link
Contributor

Demonstration:

$ fortune 70% all
fortune: probabilities sum to 140%!

This seems to be because FORTDIR and LOCFORTDIR both get separately added with the specified pecentage, instead of sharing the 70% between the two, so it effectively interprets it as fortune 70% <locfortdir> 70% <fortdir>.

I don't think fixing this is as simple as halving the percentage, since if the two directories have different numbers of fortunes, each fortunes in FORTDIR would have a different probability of showing up compared to ones in LOCFORTDIR. This would differ from what I'd expect if all the fortunes were in the same directory, where e.g. fortune 70% ./dir would still mean every fortune in dir has a roughly equal chance of appearing.

@shlomif
Copy link
Owner

shlomif commented Mar 7, 2023

Thanks for the report. I reproduced the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants