Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930568 - www-client/firefox[geckodriver] - compatibility with other browsers
Summary: www-client/firefox[geckodriver] - compatibility with other browsers
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-04-24 12:30 UTC by Arniii
Modified: 2024-04-25 11:37 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arniii 2024-04-24 12:30:18 UTC
I have firefox and firefox-based browser called librewolf ( which is in different overlay at codeberg https://codeberg.org/librewolf/gentoo.git ).

After some investigation, I got to next points:

1. To make firefox work with a geckodriver, firefox[+geckodriver] is *not* necessary.
2. To make librewolf work with a geckodriver, librewolf[+geckodriver] is *not* necessary
3. To make firefox work with Selenium library ( https://www.selenium.dev/documentation/webdriver/browsers/firefox/ ), we need a geckodriver, either from firefox[+geckodriver]:/usr/bin/geckodriver -> /usr/lib64/firefox/geckodriver or from github releases ( https://github.com/mozilla/geckodriver )
4. To make librewolf work with Selenium through geckodriver, we need not firefox's geckodriver, but another one called unchained-geckodriver ( https://github.com/rafiibrahim8/geckodriver-unchained/ ). The geckodriver from librewolf[+geckodriver]:/usr/bin/geckodriver -> /usr/lib64/librewolf/geckodriver is actually firefox's geckodriver, which is impossible to use on librewolf.

All of this is checked using the next python code in environment where Selenium library is installed ( `emerge -avtq dev-python/selenium` ):

```
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.service import Service as FirefoxService

if __name__ == "__main__":
    options = webdriver.FirefoxOptions()
    options.binary_location = '/usr/bin/librewolf'
    # executable_path = "/usr/bin/geckodriver"
    executable_path = "./geckodriver-unchained-linux-0.34.0-ff-125.0.1"
    driver = webdriver.Firefox(service=FirefoxService(executable_path), options=options)
    url = "https://lite.ip2location.com/russian-federation-ip-address-ranges?lang=en_US"

    driver.get(url)

    title = driver.title

    driver.implicitly_wait(5)

```
Here in the code you can comment and uncomment related lines to check if it works with a combination of a geckodriver and a browser


What's more interesting, because of the symlink /usr/bin/geckodriver -> ... You cannot install firefox[+geckodriver] and librewolf[+geckodriver] simultaneously, since there will be a file collision like in the bug https://bugs.gentoo.org/show_bug.cgi?id=693390 



I guess, the right stuff to do are either of next solutions:

a.  Separate geckodriver as a new packages like geckodriver-firefox:slot and geckodriver-unchained:slot , remove USE flags from both firefox and librewolf
b.  Separate geckodriver as a new package like geckodriver:slot with USE flag for using geckodriver-unchained ( since it's actually just a patch for geckodriver )
c.  Remove the symlinks to /usr/bin/geckodriver from both packages , since selenium is stupid and cannot find those without manually writing the path, and /usr/lib64/firefox/geckodriver will be though, /usr/lib64/librewolf/geckodriver will be too
d.  In all packages that do the symlink make RESTRICTED_USE for to be geckodriver only for one package. Or maybe virtual/package ?
e. Remove the useflags in both cases and make users to find the geckodriver by themselves ( actually a. or b. are better in comparison, since the option is like a. or b. but without gentoo's ebuild for geckodriver )


I don't know any uses of geckodriver except selenium. If you know something else that uses it and uses the symlink, it would be great to know.
Comment 1 Joonas Niilola gentoo-dev 2024-04-25 07:05:05 UTC
Here's my proposal:
 - make a new standalone geckodriver package, since it's simple and doesn't indeed break firefox
 - remove firefox[geckodriver] use flag after a short migration period


Now:

I don't know how to truly incorporate the "unchained-geckodriver" into the main standalone geckodriver ebuild. I'd recommend people hosting forks of Firefox to package that in their repos. If there's a simple way to include unchained version, let me know. But it also isn't up-to-date with last official release.

I want to keep the /usr/bin/geckodriver symlink just for compatibility - people might find it comfortably there in their current setups. It shouldn't collide anymore as a standalone package.


> 
> I don't know any uses of geckodriver except selenium. If you know something
> else that uses it and uses the symlink, it would be great to know.

Granted I've never used geckodriver, but I thought it's kind of an API-proxy for e.g. contained Firefox, since e.g. opening links from host applications inside a contained Firefox can be complicated. Geckodriver makes it easy. That's my impression for it anyway.

PR incoming shortly, please let me know what you think about it and if it can be enhanced before merging.
Comment 2 Joonas Niilola gentoo-dev 2024-04-25 07:17:22 UTC
(In reply to Joonas Niilola from comment #1)
> unchained version, let me know. But it also isn't up-to-date with last
> official release.
> 

Or maybe it is, just for some reason it looks like last tag is from 2023 but the  release matches:
https://github.com/rafiibrahim8/geckodriver-unchained/tags
https://github.com/rafiibrahim8/geckodriver-unchained/releases/tag/0.34.0-ff-125.0.2
Comment 3 Arniii 2024-04-25 10:42:34 UTC
(In reply to Joonas Niilola from comment #2)
> (In reply to Joonas Niilola from comment #1)
> > unchained version, let me know. But it also isn't up-to-date with last
> > official release.
> > 
> 
> Or maybe it is, just for some reason it looks like last tag is from 2023 but
> the  release matches:
> https://github.com/rafiibrahim8/geckodriver-unchained/tags
> https://github.com/rafiibrahim8/geckodriver-unchained/releases/tag/0.34.0-ff-
> 125.0.2

The geckodriver-unchained seems to be just a patch https://github.com/rafiibrahim8/geckodriver-unchained/blob/main/unchained.patch

I guess we can do as I proposed in b. : if USE flag "unchained" is turned on for geckodriver, just add the patch.

New releases are because the guy have made whole github workflow that makes releases automatically just by applying the patch.
Comment 4 Arniii 2024-04-25 10:45:50 UTC
(In reply to Joonas Niilola from comment #1)

> 
> I want to keep the /usr/bin/geckodriver symlink just for compatibility -
> people might find it comfortably there in their current setups. It shouldn't
> collide anymore as a standalone package.
> 

So, do you expect to have one geckodriver per system, am I right?

If yes, it's good actually. Also then we need to ping guys from https://codeberg.org/librewolf/gentoo.git I guess
Comment 5 Joonas Niilola gentoo-dev 2024-04-25 11:21:28 UTC
(In reply to Arniii from comment #3)
> 
> The geckodriver-unchained seems to be just a patch
> https://github.com/rafiibrahim8/geckodriver-unchained/blob/main/unchained.
> patch
> 
> I guess we can do as I proposed in b. : if USE flag "unchained" is turned on
> for geckodriver, just add the patch.
> 

This kind of conditional patching is very frowned upon, but it is a simple patch and doesn't look like it's going to break easily. Just know that it can be dropped any time it breaks and an update isn't available - although if this is everything required, it's easy to rebase until it becomes more complicated.


> 
> So, do you expect to have one geckodriver per system, am I right?
> 
> If yes, it's good actually. Also then we need to ping guys from
> https://codeberg.org/librewolf/gentoo.git I guess

Yes and yes. I'll drop the use flag for next ESR which is 128 so there's a short migration period to install the standalone. I guess we also need to use this time to re-keyword the standalone on arches currently supported by Firefox. But should be plenty enough.
Comment 6 Larry the Git Cow gentoo-dev 2024-04-25 11:37:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc5c7855d56b676e619d0fa99bd1748382e09d85

commit fc5c7855d56b676e619d0fa99bd1748382e09d85
Author:     Joonas Niilola <juippis@gentoo.org>
AuthorDate: 2024-04-25 11:33:31 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2024-04-25 11:33:31 +0000

    net-misc/geckodriver: new package, add 0.34.0
    
    Closes: https://bugs.gentoo.org/930568
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 net-misc/geckodriver/Manifest                      | 182 ++++++++++++++++
 ...eckodriver-0.34.0-firefox-125.0-unchained.patch |  17 ++
 net-misc/geckodriver/geckodriver-0.34.0.ebuild     | 229 +++++++++++++++++++++
 net-misc/geckodriver/metadata.xml                  |  14 ++
 4 files changed, 442 insertions(+)