2

Since I installed Firefox Quantum and Firefox ESR 52 both (Kubuntu Trusty / KDE 4.13.3) it happens every time that any external web link is opened twice in my default browser. So I presume this is an system issue and not a Firefox issue.

The only things I changed manually are that I added personal executable scripts in "/usr/bin/" and "~/bin/" and changed the default browser so that I don't mix up with both firefox installations.

So "/usr/bin/" contains "firefox-esr" and "firefox.real" (for Quantum) which both are simply links to the start files of the according program folders in "/usr/lib/". In addition it contains a script "firefox" which might be cause of my problem, but I cant see it.

Here is the "/usr/bin/firefox" script:

#!/bin/sh
FIREFOX="$(which firefox)"
[ -x "$FIREFOX.real" ] && exec "$FIREFOX.real" "$@"
exec firefox-esr "$@"

which reports "~/bin/firefox" and "firefox.real" exists in both "/usr/bin/" and "~/bin/" directories as links to a script (see below).

Here is the "/usr/bin/firefox.real" script:

#!/bin/sh
set -e

MOZ_LIBDIR=/usr/lib/firefox
MOZ_APP_LAUNCHER=`which $0`
MOZ_APP_NAME=firefox

export MOZ_APP_LAUNCHER

while [ ! -x $MOZ_LIBDIR/$MOZ_APP_NAME ] ; do
    if [ -L "$MOZ_APP_LAUNCHER" ] ; then
        MOZ_APP_LAUNCHER=`readlink -f $MOZ_APP_LAUNCHER`
        MOZ_LIBDIR=`dirname $MOZ_APP_LAUNCHER`
    else
        echo "Can't find $MOZ_LIBDIR/$MOZ_APP_NAME"
        exit 1
    fi
done

usage () {
    $MOZ_LIBDIR/$MOZ_APP_NAME -h | sed -e 's,/.*/,,'
    echo
    echo "      -g or --debug          Start within debugger"
    echo "      -d or --debugger       Specify debugger to start with (eg, gdb or valgrind)"
    echo "      -a or --debugger-args  Specify arguments for debugger"
}

moz_debug=0
moz_debugger_args=""
moz_debugger="gdb"

while [ $# -gt 0 ]; do
    case "$1" in
        -h | --help )
            usage
            exit 0
            ;;
        -g | --debug )
            moz_debug=1
            shift
            ;;
        -d | --debugger)
            moz_debugger=$2;
            if [ "${moz_debugger}" != "" ]; then
          shift 2
            else
              echo "-d requires an argument"
              exit 1
            fi
            ;;
        -a | --debugger-args )
            moz_debugger_args=$2;
            if [ "${moz_debugger_args}" != "" ] ; then
                shift 2
            else
                echo "-a requires an argument"
                exit 1
            fi
            ;;
        -- ) # Stop option processing
            shift
            break
            ;;
        * )
            break
            ;;
    esac
done

if [ $moz_debug -eq 1 ] ; then
    case $moz_debugger in
        memcheck)
            debugger="valgrind"
            ;;
        *)
            debugger=$moz_debugger
            ;;
    esac

    debugger=`which $debugger`
    if [ ! -x $debugger ] ; then
        echo "Invalid debugger"
        exit 1
    fi

    case `basename $moz_debugger` in
        gdb)
            exec $debugger $moz_debugger_args --args $MOZ_LIBDIR/$MOZ_APP_NAME "$@"
            ;;
        memcheck)
            echo "$MOZ_APP_NAME has not been compiled with valgrind support"
            exit 1
            ;;
        *)
            exec $debugger $moz_debugger_args $MOZ_LIBDIR/$MOZ_APP_NAME "$@"
            ;;
    esac
else
    exec $MOZ_LIBDIR/$MOZ_APP_NAME "$@"
fi

In addition to these I wanted to add my personal override executables under "~/bin/". Here I relinked "firefox" and "firefox.real" to "./firefox-quantum" which lets me run this with a separate profile – "~/bin/firefox-quantum":

#!/bin/bash
/usr/bin/firefox.real -no-remote -P "########.default-quantum"  "$@"

According to this I did the same with "~/bin/firefox-esr" which is my default browser (for the default profile):

#!/bin/bash
/usr/bin/firefox-esr "$@"

The default browser command is now:

firefox-esr  -new-tab %u

Why are external web links opened twice? I cannot find the problem.

Might the cause be the "/usr/bin/firefox" script? Shouldn't it start firefox twice because there is of cause "firefox.real" and so it should start "firefox.real" AND "firefox-esr"? Or didn't I understand the exec command?

  • I finally found the error myself: the additional %u parameter for the default browser was redundant. – Jens Nov 23 '18 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.