If urlview loads the browser for the first time, it kills it on ctrl-c or on quitting neomutt

Bug #1782443 reported by Paulo Marcel Coelho Aragão
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
urlview (Ubuntu)
New
Undecided
Unassigned

Bug Description

If the browser wasn't running and urlview loaded it to open an URL, urlview kills the browser when quitting neomutt or when hitting ctrl-c.

It can be easily reproduced in 2 ways

I) Without neomutt

1. Close the browser
2. Run:

echo 'http://example.com' | urlview

3. Wait for the browser to open and load the URL
4. Hit ctrl-c on urlview

II) With neomutt

1. Close the browser
2. Add to ~/.config/neomutt/neomuttrc:

set pipe_decode
macro index,pager \Cu "<pipe-message>urlview<enter>"

3. Select or open a message which contains URLs
4. Hit ctrl-u
5. Select an URL
6. Wait for the browser to open and load the URL
7. Quit neomutt

If the browser was already opened and urlview opened the URL on a new tab, the bug doesn't happen. It only happens when the browser wasn't opened and urlview opens it.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: urlview 0.9-20build1
ProcVersionSignature: Ubuntu 4.15.0-29.31-generic 4.15.18
Uname: Linux 4.15.0-29-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: XFCE
Date: Wed Jul 18 19:49:41 2018
InstallationDate: Installed on 2018-04-28 (81 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: urlview
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Paulo Marcel Coelho Aragão (marcelpaulo) wrote :
Revision history for this message
Paulo Marcel Coelho Aragão (marcelpaulo) wrote :

Digging into this problem, I learned that:

nohup program &

doesn't stop the shell from sending SIGHUP to program when the shell ends. The job has to be removed from the job table, running:

disown

So, to properly prevent a background program from receiving SIGHUP, the correct sequence should be:

program &
disown

This led me to think /etc/urlview/system.urlview was the problem, so just for testing, I copied it to ~/.urlview, and changed it to:

#
# Sample urlview(1) configuration file
#

# regular expression to use to match URLs
REGEXP (((http|https|ftp|gopher)|mailto):(//)?[^ <>"\t]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)[^ .,;\t\n\r<">\):]?[^, <>"\t]*[^ .,;\t\n\r<">\):]

# command to invoke for selected URL
COMMAND /tmp/foo

# set to yes to enable menu wrapping
#WRAP Yes

and created /tmp/foo:

#!/bin/bash
sensible-browser "$1" &
disown

But this bug was reproduced just the same. So, it looks like urlview itself is running COMMAND through the shell, and it should group COMMAND and disown and run them together in a single shell invocation.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.