firefox x windows oddity

Here’s something odd that made me scratch my head. I have a Debian Etch server and a laptop running Archlinux. I was logged into the debian box and I thought I’d ssh across to the laptop and run firefox off the laptop, but using the Debian box’s monitor. So I did a :

ssh -X user@laptop

I did a quick ‘xterm’ to see that the DISPLAY variable and xauth was all go (it worked). Then I typed ‘firefox’ to start firefox on the laptop. What I should have seen on the Debian monitor was the version of firefox on the laptop. However, an Iceweasel window popped up. Iceweasel is the rebranded name of firefox for Debian. Very very odd I thought. How can I type a command to run on my laptop but end up running a program on the Debian box? Did I have a rootkit or somesuch?

I noticed that I already had one Iceweasel window open on the Debian bo, so I tried closing it and launching firefox from the laptop again. This time, the laptop version of firefox launched with the screen output going to the Debian box (ie. what I wanted).

I then tried the reverse; I had an xterm open on the laptop, then ssh -X’d across to the Debian box and launched firefox. If firefox was already open on the laptop, I got a new window of that firefox instance rather than the Iceweasel window I was expecting. If firefox wasn’t already open on the laptop, I got a Iceweasel window.

I’m guessing that this is normal behaviour for firefox. I’m thinking that the logic is to check if there’s a window already open with the name firefox (or window ID for it), and then send a signal to that window to open another copy of itself.

The only way I’ve found so far to avoid this silly behaviour is to use the -no-remote option:

firefox -no-remote

I’ve since found a forum post that suggests the same thing.