User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.1) Gecko/20061211 Firefox/2.0 Build Identifier: On Solaris, xfce4-tips is blank, showing no tips or fortunes. Reproducible: Always Steps to Reproduce: 1. Start xfce 2. Look at the tips window Actual Results: Tips window is empty Expected Results: I would have expected something to be in the window If you start xfce4-tips from a window you see the following error: sh: fortune: not found The problem is that Solaris doesn't ship with a fortune command. Ideally, configuration would detect this and not build or install a non-functional application. Better, the tips browser wouldn't be dependent on an external application that may not be present.
Also, fortune depends on the recode package that is patched by all distributions because of incorrect conversions involving UTF-8, and that will have no new releases. Please don't depend (indirectly through fortune) on this unmaintained library.
See the attached patch as a workaround. The code does read the tips file directly and display a random item of it. All fortune support is dropped, also the ability to display any fortune message. The tips.dat should also be removed from the SVN as it is not used anymore (I skipped the removal in the patch because tips.dat is a binary file and I don't like patches with binary parts). There might be bugs and there might be better solutions, but IMO it's usuable.
Created attachment 1512 Read tips data directly, dropping fortune dependency
I'd like the fortune support left in -- it's fine to drop the support for the default tips (that is, read the tips file directly as your patch does), but it's cool to have generic fortune support in there. Enrico, would you be willing to modify your patch to do that?
Brian, I am against any form of fortune support. I have already stated why: on Linux, it depends on the broken and unmaintained "recode" package, and anyway, uses fortune output directly (it is in the locale encoding, which may or may not be UTF-8) without conversion to UTF-8.
(In reply to comment #5) > Brian, I am against any form of fortune support. Too bad. I want it kept in there.
Brian, yes, I will update the patch. Maybe later today or tomorrow. Alexander, regarding the problem of unknown encoding of the fortune output: this could be easily checked for valid UTF-8 and in case it is not, it can be converted into UTF-8 (assuming it's in the user's locale and that is not UTF-8). Not sure if then there are still remaining serious problems with the broken recode library. But we can check fortune's output for valid UTF-8, then try to convert it into UTF-8 from the user's locale and if this also fails, we could just dismiss the output and show a warning message instead. This could be a quite solid way to go.
There is one very serious problem with the recode library: In order to work, it must be patched. Those who build stuff from scratch generally don't know this fact. See what all distros are doing. See also these bug reports that will never be fixed upstream, because the project is dead upstream (because there is iconv()): http://bugs.debian.org/114850 http://bugs.debian.org/131080 http://bugs.debian.org/134899 http://bugs.debian.org/156635 So: if you want to support fortune in Xfce, please fork fortune first.
Here's the thing: I don't care about recode. xfce4-tips should work like this: 1. The default xfce tips that ship with it should not depend on fortune, but should be displayed directly. 2. It should still support fortune to display fortune messages. #1 will always work for any user. #2 may not. If it does not, that's ok with me. They can simply not use it. Since the default setup will work, that's all I really care about. As Enrico suggests, we can try using g_utf8_validate() on 'fortune' output, and if that fails, try converting the string from the current locale to utf8. If that succeeds, great, we win. If not, oh well, we just display nothing, or an error message or something.
Created attachment 1983 Updated patch to read the tips file directly and use fortune optionally if it is available (In reply to comment #9) > Here's the thing: I don't care about recode. xfce4-tips should work like this: > > 1. The default xfce tips that ship with it should not depend on fortune, but > should be displayed directly. > 2. It should still support fortune to display fortune messages. I completely agree with this. This patch does the suggested things: read the tips file directly and offer fortunes only when the fortune command is available. If so, it checks whether the its output is valid UTF-8 and if not, it tries converting. @Brian: if you do apply the patch, please don't forget to remove the now obsolete tips.dat. Thanks.
Patch looks pretty good for the most part, I think. Please fix coding style, and I'll check it in. 2-space indents, no tabs. Also note extra 2-space brace indentation.
Created attachment 2005 Same code as patch v2 but with proper coding style Sorry for the coding style. This one should be better, I hope I didn't miss anything.
Brian, can we finally get this in?
The patch doesn't apply to svn trunk. I get two rejected hunks for main.c, and then the second file doesn't apply because somehow half of the diff is looking for patch -p0, and the other half is looking for patch -p2.
Created attachment 2451 Updated patch against latest SVN This is an updated version of the patch, tested against SVN r30320.
Checked into trunk. My apologies for letting this sit for so long.