Bug 343903

Summary: yast2 xmessage enhancement to make error details accessible for copying
Product: [openSUSE] openSUSE 11.0 Reporter: Casual J. Programmer <casualprogrammer>
Component: YaST2Assignee: Jiri Srain <jsrain>
Status: RESOLVED DUPLICATE QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P5 - None CC: d, forgotten_h13THG8RK1, mgorse, mvidner
Version: Alpha 2   
Target Milestone: ---   
Hardware: x86   
OS: openSUSE 11.0   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Casual J. Programmer 2007-11-25 11:37:13 UTC
As pointed out in Bug 343899 Comment #0 it doesn't seem to be possible to copy content from an xmessage for reporting it here or elsewhere.

Adding some functionality to /sbin/yast2 could help.

I tried the following:

Modify function exit_trap() from

exit_trap()
{
    # handily, exit_code is set to $? of y2base.
    # If there was an error and there is anything to display, pop up.
    if [ $exit_code != 0 -a -s $ERRLOG ]; then
	xmessage -buttons OK:0 -default OK -center -file $ERRLOG
    fi
    rm -f $ERRLOG
}

to

exit_trap()
{
    # handily, exit_code is set to $? of y2base.
    # If there was an error and there is anything to display, pop up.
    if [ $exit_code != 0 -a -s $ERRLOG ]; then
	xmessage -buttons OK:0,"Details in: "$ERRLOG:0 -default OK -center -file $ERRLOG
    fi
    rm -f $ERRLOG
}

which simply adds a dummy ( return code same as OK ) button displaying the location of the temporary file containing the error details.

While this is probably not perfect, it saves me a lot of fiddling to get at the information offered.
Comment 2 Casual J. Programmer 2007-12-02 16:03:08 UTC
Refined a little to:

exit_trap()
{
    # handily, exit_code is set to $? of y2base.
    # If there was an error and there is anything to display, pop up.
    if [ $exit_code != 0 -a -s $ERRLOG ]; then
	if [ $(echo $(xmessage -buttons OK:0,Snap:1 -default OK -center -file $ERRLOG -print)) = "Snap" ]; then
           $( cat $ERRLOG > $ERRLOG.bak ) && $( gedit $ERRLOG.bak)
        fi
     fi
    rm -f $ERRLOG
}

So now, if I press "Snap" instead of "OK", the error message gets copied to .bak and opened in gedit.

Comment 3 Martin Vidner 2007-12-03 15:58:56 UTC
But I *can* select text in the xmessage window. Have you rechecked in the final release? Test with "/sbin/yast2 bigfoot < /dev/null".
Comment 4 Casual J. Programmer 2007-12-03 16:44:56 UTC
Testing with "/sbin/yast2 bigfoot < /dev/null" yields

No such client module bigfoot

Run 'yast2 -h' for help on usage

I can select it too ( i.e. highlight ), but not copy or drag it, there is simply no context menu ( right click in object ) available.

Comment 5 Martin Vidner 2007-12-03 16:55:13 UTC
Well but that is no problem :-) The beauty of X is that you do not need anything else. Just select it and then press the middle mouse button in an editor. That is http://en.wikipedia.org/wiki/X_Window_selection . 
Comment 6 Casual J. Programmer 2007-12-03 17:51:48 UTC
You are right !

Very interesting, so I suggest that this knowledge is offered to the uninitiated user somehow.

Maybe as prefix to the error message displayed in the xmessage.

That is the beauty of Windows, it tells you (most of the time) what you can, should are expected to do. :-)

Comment 7 Forgotten User h13THG8RK1 2008-08-18 15:01:56 UTC
Sounds like a reasonable request. Anyway, what about just using zenity when available, which should be available even in KDE installs unlike gedit, as requested by bug 418032 ?
Comment 8 Martin Vidner 2008-08-19 13:58:24 UTC
Good point, done.

*** This bug has been marked as a duplicate of bug 418032 ***