Bug 97832 - mozilla-launcher does not clear the value of MOZILLA_LAUNCHER after using it
Bug#: 97832 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: mozilla@gentoo.org Reported By: rich0@gentoo.org
Component: Applications
URL: 
Summary: mozilla-launcher does not clear the value of MOZILLA_LAUNCHER after using it
Keywords:  
Status Whiteboard: 
Opened: 2005-07-03 09:35 0000
Description:   Opened: 2005-07-03 09:35 0000
/usr/libexec/mozilla-launcher contains the line:
  [[ -n $MOZILLA_LAUNCHER ]] && zero=$MOZILLA_LAUNCHER 

this should be changed to:
  [[ -n $MOZILLA_LAUNCHER ]] && zero=$MOZILLA_LAUNCHER && unset MOZILLA_LAUNCHER

The reason this variable exists is that some programs call mozilla-launcher
directly instead of using the symlink which makes it impossible for the launcher
to determine how it was called.  To correct this, a stub program is used which
sets this variable so that the launcher knows which binary to execute.  The
problem is that it does not clear the variable after using it - so if a mozilla
program (such as thunderbird) is called using this mechanism, and then it
directly launches another mozilla program (such as /usr/bin/firefox), the
variable is still set, and thunderbird launches itself instead.

Changing the line of code fixes the problem, firefox-bin and thunderbird still
both load normally.

Reproducible: Always
Steps to Reproduce:
1.  Run thunderbird from bash.
2.  Click on a link after associating firefox with thunderbird as the default
http handler.

Actual Results:  
Firefox loads the link.

Expected Results:  
Error to stderr indicating that mozilla-xremote-client had an internal error 509
command not understood.  (Thunderbird is talking to itself instead of to
firefox, and thunderbird can't open a url.)

emerge info:

Gentoo Base System version 1.6.12
Portage 2.0.51.19 (default-linux/amd64/2005.0, gcc-3.4.3,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r7-rf28 x86_64)
=================================================================
System uname: 2.6.11-gentoo-r7-rf28 x86_64 AMD Athlon(tm) 64 Processor 3000+
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May 12 2005, 09:21:37)]
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.9.5, 1.7.9-r1, 1.8.5-r3, 1.6.3, 1.4_p6
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r4
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CFLAGS="-march=k8 -Os -pipe -fomit-frame-pointer -frename-registers -fweb
-fstack-protector"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /home /opt/zetagrid /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config
/usr/kde/3.3/shutdown /usr/kde/3.4/env /usr/kde/3.4/share/config
/usr/kde/3.4/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb
/usr/lib/mozilla/defaults/pref /usr/share/config
/usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/usr/share/texmf/xdvi/ /var/bind /var/freenet /var/qmail/control /var/www"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=k8 -Os -pipe -fomit-frame-pointer -frename-registers -fweb
-fstack-protector"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache distlocks nostrip sandbox
sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://gentoo.mirrors.pair.com/ http://mirror.datapipe.net/gentoo
http://gentoo.mirrors.pair.com/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo"
MAKEOPTS="-j2"
PKGDIR="/var/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="amd64 4kstacks X aac aalib acpi aim alsa apache2 arts avi bash-completion
berkdb bitmap-fonts bonobo canna cdparanoia cdr crypt css cups curl dba dts dv
dvd esd ethereal fam fbcon flac font-server foomaticdb fortran freetype gd gdbm
gif gimpprint glut gmail gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml guile
iconv imagemagick imap imlib innodb ipv6 jack java jp2 jpeg junit kde kerberos
ldap libwww lzw lzw-tiff mad maildir memlimit mikmod motif mozilla mozsvg mp3
mpeg mpeg4 mplayer msn mysql ncurses nls nptl ntlm oav ogg oggvorbis opengl oss
pam pda pdflib perl php png python qt quicktime readline ruby samba sasl sdl
session slang smime speex ssl svg tcltk tcpd tetex theora tiff timidity truetype
truetype-fonts type1-fonts usb userlocales vorbis wmf xine xml xml2 xmms xpm
xrandr xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS


While running on amd64 I don't think it is arch related.

------- Comment #1 From Sven Wegener 2005-07-03 09:41:00 0000 -------
The stub executable will set MOZILLA_LAUNCHER itself and override the old
setting,
even if called by another mozilla application.

------- Comment #2 From Richard Freeman 2005-07-03 11:56:13 0000 -------
I don't think that thunderbird was calling the stub executable.  It was calling
/usr/bin/firefox, which is a symlink to /usr/libexec/mozilla-launcher.  

Without the change in mozilla-launcher I was unable to open links in
thunderbird.  After the change, I was.  If others aren't seeing this behavior
I'm not sure what is configured differently (perhaps a firefox vs firebox-bin
issue?).  In any case, I can't see any negative effects from unsetting the variable.

------- Comment #3 From Jory A. Pratt 2005-07-03 12:29:56 0000 -------
proper way to handle opening urls in thunderbird is to set the browser itself
in
your prefs.js with something like
"user_pref("network.protocol-handler.app.http", "firefox");
user_pref("network.protocol-handler.app.https", "firefox");" this allows you to
use any browser of your preference mozilla-launcher should not come into play
at
all.

------- Comment #4 From Richard Freeman 2005-07-03 13:30:02 0000 -------
I have it set to /usr/bin/firefox.  It does not work with this, or with just
firefox in either user.js, prefs.js, or in the global file (under /lib). 
However, changing this line in the launcher does fix the problem.  

I'm certainly open to other suggestions - feel free to browse my posts on
gentoo-amd64.

------- Comment #5 From Jory A. Pratt 2005-07-03 14:59:13 0000 -------
post your prefs.js please ... I am sure you have syntax wrong somewhere I have
tested it on 5 different machines. 

------- Comment #6 From Richard Freeman 2005-07-03 19:41:09 0000 -------
In /usr/lib64/MozillaThunderbird/defaults/pref/all-thunderbird.js : 

pref("network.protocol-handler.app.http","/usr/bin/firefox");
pref("network.protocol-handler.app.https","/usr/bin/firefox");

In user.js:

user_pref("network.protocol-handler.app.http", "/usr/bin/firefox")
user_pref("network.protocol-handler.app.https", "/usr/bin/firefox")

I cannot set this in prefs.js since I am using the system-wide default (system
defaults are purged from the file automatically).  The settings are set
correctly in about:config (using the AboutConfig extension).

I am running www-client/mozilla-firefox-bin-1.0.4 and
mail-client/mozilla-thunderbird-1.0.2.

------- Comment #7 From Jory A. Pratt 2005-07-04 11:29:44 0000 -------
you do not add them lines to your /usr/blah/blah you add them to
~/.thunderbird/"profile"/prefs.js  ... "profile is numbers and letters mixed
matched at random upon first run of thunderbird. 

------- Comment #8 From Richard Freeman 2005-07-04 17:16:34 0000 -------
I have placed this in both user.js and prefs.js in the thunderbird profile
directory (under .thunderbird and the profile name).  This was actually the
first solution I attempted.  Neither had any effect.  Under /usr/lib are the
system-wide defaults.  Modifying these should have the same effect (which in my
case was nothing).

Again, I have confirmed that the settings were changed in about:config, which I
doubt would be the case in the event of a syntax error.

The problem was completely fixed by my edit to the launcher, and nothing else
I've tried worked.

Are you attempting to confirm this using thunderbird from source and
firefox-bin?  Could there be an issue with this package only?  Might the problem
be amd64-specific?

In any case, the change fixes things for me, and all is well on my system.  If
you'd prefer not to change it in portage it will only take me 30 seconds to
re-patch it any time I emerge an upgrade.  I just figured that somebody else is
likely to run into the same problem (granted, I'm not sure what is particular to
my config such that the problem is not widespread), and I figured I'd at least
have it documented here for anybody else who is searching for this problem, and
possibly offer a general solution.

I did notice that thunderbird is using a stub script in /usr/bin/thunderbird,
but that /usr/bin/firefox is a symlink to /usr/libexec/mozilla-launcher.  Should
firefox have installed a stub?  Clearly without a stub in firefox the variable
would not be cleared there.  Perhaps there is an issue with firefox-bin?

------- Comment #9 From Aron Griffis (RETIRED) 2005-07-05 09:25:13 0000 -------
(In reply to comment #8)
> I did notice that thunderbird is using a stub script in /usr/bin/thunderbird,
> but that /usr/bin/firefox is a symlink to /usr/libexec/mozilla-launcher.

As soon as I saw this bug, I suspected this was the problem.  Sorry I didn't get
to it until now. :-(

Your suggestion for modifying mozilla-launcher is a good one.  I've put it into
mozilla-launcher-1.35, now in portage.  Thanks for patiently helping to debug
the problem.

http://www.gentoo.org/cgi-bin/viewcvs.cgi/mozilla-launcher/mozilla-launcher?r1=1.34&r2=1.35&root=gentoo-src