LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Opera10 64bit Java fix for SBO slackbuild. (https://www.linuxquestions.org/questions/slackware-14/opera10-64bit-java-fix-for-sbo-slackbuild-759089/)

GazL 10-01-2009 06:17 PM

Opera10 64bit Java fix for SBO slackbuild.
 
I was just trying out the slackbuilds.org build for Opera10 and found that it wouldn't run any java on my Slack64 13.0 box.

I used this page to test it. (Sun's example 'Clock' applet)


Anyway, I tracked the issue down and came up with a patch which I'll throw up here in case anyone else is interested.

Code:

# diff -u opera.SlackBuild.orig opera.SlackBuild
--- opera.SlackBuild.orig      2009-10-01 20:10:38.901539774 +0100
+++ opera.SlackBuild    2009-10-01 23:46:03.836031043 +0100
@@ -27,7 +27,7 @@
 VERSION=10.00
 ARCH=${ARCH:-x86_64}
 
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
 TAG=${TAG:-_SBo}
 
 CWD=$(pwd)
@@ -76,7 +76,13 @@
 # recreates the directory and does some unknown havoc.  It may very well be
 # completely safe and unexploitable and I'm just being Chicken Little here,
 # but it's easy enough to fix and I'd rather be safe than sorry.  --rworkman
-sed -i "s%$TMP/$TOPDIR%/usr/bin/%g" $PKG/usr/bin/opera
+sed -i "s%$TMP/$TOPDIR\$0%\$PWD/\${0#./}%g" $PKG/usr/bin/opera
+
+#  /usr/bin/opera doesn't look in the right places for 64bit java. Fix it.
+if [ "$ARCH" = "x86_64" ]; then
+sed -i -e "/PREFIXES=\"/,/\/opt\"/ s:/usr/lib:/usr/lib64:" \
+      -e "s:i386:amd64:" $PKG/usr/bin/opera
+fi
 
 # Include config files
 mv etc $PKG

It also fixes a potential problem with the OPERA_SCRIPT_PATH, that no one was really likely to trigger anyway, but it sort of caught my interest so I fixed that too.

If you don't want to rebuild, then adding
export OPERA_JAVA_DIR="/usr/lib64/java/lib/amd64" to your bash profile will also resolve the issue.

Hope someone finds this useful.

G.

meetscott 10-01-2009 08:23 PM

Let the maintainer know!
 
You ought to email Robby Workman, as he is the maintainer of this build. I noticed the same thing yesterday and I've been using this Slackbuild since it was submitted, before it was generally available.

When I updated the script, for Opera 10 on Slackware 12.2, I let him know. They normally do not maintain the older versions, only current versions because of their work load. However, I posted the script on the mailing list and on my web site:

http://raescott.net

My point being... I found Robby to be very friendly and open about the whole thing and I'm sure he'd be more than happy to include your fix for this. He had told me that Opera was not his primary browser so I'm sure he was not aware of the problem. Opera *is* my primary browser and I only discovered this yesterday! Applets aren't on very many sites anymore.

My discovery was when I visited http://time.gov

GazL 10-02-2009 05:15 AM

Yep, I'll drop him a note when I'm happy with it. I still need to check a few other things, like the spellchecking which doesn't seem to be working, so there may be further changes.

tommcd 10-02-2009 06:38 AM

As luck would have it, I just compiled opera 10 from slackbuilds.org about an hour before I saw this thread. So I added:
export OPERA_JAVA_DIR="/usr/lib64/java/lib/AMD64" to my .bash_profile and it worked like a charm.
Now time.gov works again, thanks.
Hopefully Rob W will add this patch to his slackbuild.

rworkman 10-10-2009 07:57 PM

Quote:

Originally Posted by GazL (Post 3704296)
Code:

@@ -76,7 +76,13 @@
 # recreates the directory and does some unknown havoc.  It may very well be
 # completely safe and unexploitable and I'm just being Chicken Little here,
 # but it's easy enough to fix and I'd rather be safe than sorry.  --rworkman
-sed -i "s%$TMP/$TOPDIR%/usr/bin/%g" $PKG/usr/bin/opera
+sed -i "s%$TMP/$TOPDIR\$0%\$PWD/\${0#./}%g" $PKG/usr/bin/opera


Is this the intended output?

-case $0 in /*) OPERA_SCRIPT_PATH=$0;; *) OPERA_SCRIPT_PATH=/tmp/SBo/opera-10.00-4585.gcc4-qt4.x86_64/$0;; esac
+case $0 in /*) OPERA_SCRIPT_PATH=$0;; *) OPERA_SCRIPT_PATH=$PWD/${0#./};; esac

grissiom 10-11-2009 12:07 AM

Doing sed -i -e "s:i386:amd64:" $PKG/usr/bin/opera is enough for opera running java on my box.

GazL 10-11-2009 06:04 AM

Quote:

Originally Posted by rworkman (Post 3714938)
Is this the intended output?

-case $0 in /*) OPERA_SCRIPT_PATH=$0;; *) OPERA_SCRIPT_PATH=/tmp/SBo/opera-10.00-4585.gcc4-qt4.x86_64/$0;; esac
+case $0 in /*) OPERA_SCRIPT_PATH=$0;; *) OPERA_SCRIPT_PATH=$PWD/${0#./};; esac

Yep, that's as intended Robby.


Since then I've tracked the original problem back to what Opera actually did wrong. They forgot to escape some backquotes in the part of install.sh that generates the /usr/bin/opera wrapper file. They meant to insert a literal `/bin/pwd` but instead insert the pwd of the build directory.

To follow their intentions, the correct fix to include in the slackbuild should probably be...
Code:

# Fix a bug in install.sh that resulted in the build directory being included in /usr/bin/opera
#  (they forgot to escape some back-quotes).
sed -i -e "/OPERA_SCRIPT_PATH=/ s:\`/bin/pwd\`:\\\\\`/bin/pwd\\\\\`:" install.sh

... prior to calling the install.sh from the slackbuild, rather than fixing it after the fact in /usr/bin/opera.
( P.S. figuring out all those escapes was a right pain. :) )


I think my first solution is actually cleaner than theirs as theirs results in OPERA_SCRIPT_PATH=/usr/bin/./opera when the wrapper is run with ./opera where as mine strips the ./ off and avoids an unnecessary external call to /bin/pwd. However, for the purpose of the slackbuild, it's probably better to stick as closely to their intentions as possible, so you might prefer to use this second approach.


I still haven't gotten to the bottom of the opera spell checker not working on my system. :(

rworkman 10-11-2009 01:27 PM

Quote:

Originally Posted by GazL (Post 3715278)
Yep, that's as intended Robby.

Since then I've tracked the original problem back to what Opera actually did wrong. They forgot to escape some backquotes in the part of install.sh that generates the /usr/bin/opera wrapper file. They meant to insert a literal `/bin/pwd` but instead insert the pwd of the build directory.

To follow their intentions, the correct fix to include in the slackbuild should probably be...
Code:

# Fix a bug in install.sh that resulted in the build directory being included in /usr/bin/opera
#  (they forgot to escape some back-quotes).
sed -i -e "/OPERA_SCRIPT_PATH=/ s:\`/bin/pwd\`:\\\\\`/bin/pwd\\\\\`:" install.sh

... prior to calling the install.sh from the slackbuild, rather than fixing it after the fact in /usr/bin/opera.
( P.S. figuring out all those escapes was a right pain. :) )


I think my first solution is actually cleaner than theirs as theirs results in OPERA_SCRIPT_PATH=/usr/bin/./opera when the wrapper is run with ./opera where as mine strips the ./ off and avoids an unnecessary external call to /bin/pwd. However, for the purpose of the slackbuild, it's probably better to stick as closely to their intentions as possible, so you might prefer to use this second approach.

Nope, I like yours better. :-)

Just for the sake of completeness, have you reported this to the opera folks? I'd like to see both of these issues fixed in their next release...

Quote:

I still haven't gotten to the bottom of the opera spell checker not working on my system. :(
No idea on that :/

GazL 10-11-2009 06:32 PM

I've reported the extract/build-directory getting hard coded bug to Opera via their bug report wizard thingy.

I've not reported the Java path, as to be honest, I didn't feel qualified enough to say whether it's an opera bug or just a side effect of where Slackware installs the JRE.

rworkman 10-13-2009 08:38 AM

Okay, I just pushed this changeset out to our repo.
I suspect that our java installation is correct and thus the Java PATH issue is an upstream problem too, especially since "i386" is hardcoded in the 64bit builds - IOW, that's probably worth at least mentioning to them.


All times are GMT -5. The time now is 01:05 AM.