brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.91k stars 2.34k forks source link

Tab opens three times when clicking link in Arch Linux, accompanied by segmentation fault #29188

Open willfindlay opened 1 year ago

willfindlay commented 1 year ago

Description

EDIT: Issue appears to be FIXED in the beta channel.

From what I can tell, a segmentation fault when launching Brave (arch-linux) interferes with xdg-open and causes multiple tabs to open.

I first noticed this issue when clicking links from another application (e.g. mail client, Discord, etc.). Whenever I clicked a URL, Brave opened three tabs instead of one as expected.

After some trial and error, I managed to reproduce the issue by running xdg-open from the terminal, which triggered the bug along with the segfault (I've pasted the output below).

Steps to Reproduce

  1. Set the BROWSER=brave environment variable.
  2. Open a terminal and type xdg-open https://wiki.archlinux.org or click a similar link from an external application.
  3. Observe that the new tab opens three times.

Actual result:

xdg-open appears to make three attempts to launch Brave. Each one ends in a segfault, but results in three copies of the same tab opening in the existing browser session.

Output of xdg-open looks like:

$ xdg-open https://wiki.archlinux.org
Opening in existing browser session.
/usr/bin/xdg-open: line 756: 164054 Segmentation fault      (core dumped) env "$command" "$@"
Opening in existing browser session.
/usr/bin/xdg-open: line 867: 164128 Segmentation fault      (core dumped) $browser "$1"
Opening in existing browser session.
/usr/bin/xdg-open: line 867: 164233 Segmentation fault      (core dumped) $browser "$1"
xdg-open: no method available for opening 'https://wiki.archlinux.org'

Expected result:

No segmentation fault and Brave opens the new tab just once.

Reproduces how often:

100% reproduction on my system with the above steps.

Brave version (brave://version info)

Brave   1.49.120 Chromium: 111.0.5563.64 (Official Build) (64-bit) 
Revision    c710e93d5b63b7095afe8c2c17df34408078439d-refs/branch-heads/5563@{#995}
OS  Linux
JavaScript  V8 11.1.277.13
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Command Line    /opt/brave-bin/brave --disable-domain-reliability --enable-dom-distiller --lso-url=https://no-thanks.invalid --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --restart --sync-url=https://sync-v2.brave.com/v2 --variations-insecure-server-url=https://variations.brave.com/seed --variations-server-url=https://variations.brave.com/seed --restart --flag-switches-begin --flag-switches-end --component-updater=url-source=https://go-updater.brave.com/extensions,url-source=https://go-updater.brave.com/extensions,url-source=https://go-updater.brave.com/extensions
Executable Path /opt/brave-bin/brave
Profile Path    /home/will/.config/BraveSoftware/Brave-Browser/Default
Active Variations   AdRewardsStudy:NextPaymentDay
AllowCertainClientHintsStudy:Enabled
BraveAdblockCookieListOptInReleaseStudy:Enabled
BraveAds.AdServingStudy:DefaultAdNotificationsPerHour=10/MaximumAdNotificationsPerDay=100/MaximumInlineContentAdsPerHour=6/MaximumInlineContentAdsPerDay=20/AdServingVersion=2
BraveAds.FrequencyCappingStudy:ExcludeAdIfWithinTimeWindow=0h
BraveAutoTranslateStudy:AutoTranslateDisabled
BraveDebounceStudy:Enabled
BraveRewardsWebUiPanelStudy:Enabled
BraveScreenFingerprintingBlockerStudy:Default
ConversionsStudy:NewDefaultPattern
Default1pBlockingStudy:Disabled
DisableReduceLanguage:Enabled
EphemeralStorageStudy:Enabled
FirstPartyEphemeralDomainBlockStudy:Enabled
ForceDisableBlinkFeatures:Enabled
PartitionBlinkMemoryCacheStudy:Enabled
PartitionConnectionsByNetworkIsolationKeyStudy:Enabled
PermissionLifetimeReleaseStudy:Enabled
SpeedreaderReleaseStudy:Enabled
UserActivityStudy:Triggers

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

Package version (AUR): brave-bin 1:1.49.120-1

JonMontgo commented 1 year ago

Ahh I thought I was going crazy. This same thing is happening to me too except I was getting the behavior of firefox opening after segmentation fault occured. I assume xdg-open tried to use another desktop entry associated with the mime type. I then set the BROWSER env var and the 3 tab behavior happened. I should note that to make this behavior happen you must have brave running. If brave is not running it will open normally.

willfindlay commented 1 year ago

Thanks @JonMontgo. I also have the BROWSER env var set so I'll add that to my repro steps. Cheers.

willfindlay commented 1 year ago

@JonMontgo I got around to testing the brave-bin-beta package and it seems that the issue is already fixed there. So if you just install that in the mean time, you should be good to go. I symlinked /bin/brave-beta to /bin/brave and did the same thing with my configs so that I wouldn't have to reconfigure everything. So far it's working great.