! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce4-tips show no tips or fortunes on Solaris
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Peter Tribble 2007-02-05 23:11:13 CET
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.
Comment 1 Alexander E. Patrakov 2007-11-04 06:26:47 CET
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.
Comment 2 Enrico Tröger editbugs 2008-02-15 19:08:29 CET
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.
Comment 3 Enrico Tröger editbugs 2008-02-15 19:09:21 CET
Created attachment 1512 
Read tips data directly, dropping fortune dependency
Comment 4 Brian J. Tarricone (not reading bugmail) 2008-11-15 12:25:47 CET
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?
Comment 5 Alexander E. Patrakov 2008-11-15 12:30:12 CET
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.
Comment 6 Brian J. Tarricone (not reading bugmail) 2008-11-15 12:34:02 CET
(In reply to comment #5)
> Brian, I am against any form of fortune support.

Too bad.  I want it kept in there.
Comment 7 Enrico Tröger editbugs 2008-11-15 12:39:52 CET
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.
Comment 8 Alexander E. Patrakov 2008-11-15 12:46:40 CET
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.
Comment 9 Brian J. Tarricone (not reading bugmail) 2008-11-15 21:11:51 CET
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.
Comment 10 Enrico Tröger editbugs 2008-11-16 14:48:35 CET
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.
Comment 11 Brian J. Tarricone (not reading bugmail) 2008-11-28 07:27:41 CET
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.
Comment 12 Enrico Tröger editbugs 2008-11-29 10:06:40 CET
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.
Comment 13 Enrico Tröger editbugs 2009-06-12 12:50:23 CEST
Brian, can we finally get this in?
Comment 14 Brian J. Tarricone (not reading bugmail) 2009-07-16 07:27:44 CEST
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.
Comment 15 Enrico Tröger editbugs 2009-07-16 14:19:22 CEST
Created attachment 2451 
Updated patch against latest SVN

This is an updated version of the patch, tested against SVN r30320.
Comment 16 Brian J. Tarricone (not reading bugmail) 2009-07-16 17:32:02 CEST
Checked into trunk.  My apologies for letting this sit for so long.

Bug #2871

Reported by:
Peter Tribble
Reported on: 2007-02-05
Last modified on: 2009-07-16

People

Assignee:
Brian J. Tarricone (not reading bugmail)
CC List:
2 users

Version

Attachments

Additional information