Bug: git web--browse doesn't recognise browser on OS X
A message that is not in the archive (sent off-list or not yet received): CAMxBVSs6dJFnK78E2Da7t4V9ndJFRVDZEd1fR5QuCFz=u2Bnpw@mail.gmail.com
Hi
I tried to open a website by runnin 'git web--browse http://google.com'
and it replied 'No known browser available'.
I also tried with '--browser=chrome' and '--browser=google-chrome' but the responded with 'The browser chrome is not available as 'chrome'.'
I expected the command to open a new tab in my browser in each of the 3 tries. This has worked for my system before.
OS X 10.8.2, git 1.8.2, Google Chrome 27.0.1438.7 dev
--
Timo Sand
[email protected]
Hi,
Quoted 4 lines · Timo Sand
Hi
I tried to open a website by runnin 'git web--browse http://google.com'
and it replied 'No known browser available'.
First git web--browse is a plumbing shell script to display documentation on a web browser when you type something like "git help -w log".
It is not really supposed to be used directly by the user. On OS X it might be simpler to just type "open http://google.com".
That said there is the following in it to make it work on OS X:
# SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \
-o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fi
So I guess that you don't have SECURITYSESSIONID set in your terminal and you are not using Apple Terminal.
As I am not using OS X, I have no idea how to improve the script in this case.
Quoted 2 lines
I also tried with '--browser=chrome' and '--browser=google-chrome' but the responded with 'The browser chrome is not available as 'chrome'.'
Could you try something like: "chromium http://google.com" or "chromium-browser http://google.com"
If it works, then using 'git web--browse' with '--browser=chromium' or '--browser=chromium-browser' should work.
Otherwise did you try "chrome http://google.com" and "google-chrome
http://google.com"?
Quoted 4 lines
I expected the command to open a new tab in my browser in each of the 3 tries. This has worked for my system before.
OS X 10.8.2, git 1.8.2, Google Chrome 27.0.1438.7 dev
Thanks,
Christian.
Hi,
well my use case is actually that I'm trying to use the gem 'gem-browse' which uses 'git web--browse'
I'm not using Apple Terminal, I'm using iTerm2 and there doesn't seem to be a SECURITYSESSIONID set, at least echo didn't find any. But neither did I find it on Apple Terminal either.
What troubles me is that this issue has only arisen recently, earlier this worked fine for me
Quoted 45 lines · Christian Couder
Hi,
Quoted 4 lines · Timo Sand
Hi
I tried to open a website by runnin 'git web--browse http://google.com'
and it replied 'No known browser available'.First git web--browse is a plumbing shell script to display documentation on a web browser when you type something like "git help -w log".
It is not really supposed to be used directly by the user. On OS X it might be simpler to just type "open http://google.com".That said there is the following in it to make it work on OS X:
# SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \
-o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fiSo I guess that you don't have SECURITYSESSIONID set in your terminal and you are not using Apple Terminal.
As I am not using OS X, I have no idea how to improve the script in this case.
Quoted 2 lines
I also tried with '--browser=chrome' and '--browser=google-chrome' but the responded with 'The browser chrome is not available as 'chrome'.'
Could you try something like: "chromium http://google.com" or "chromium-browser http://google.com"
If it works, then using 'git web--browse' with '--browser=chromium' or '--browser=chromium-browser' should work.Otherwise did you try "chrome http://google.com" and "google-chrome
http://google.com"?Quoted 4 lines
I expected the command to open a new tab in my browser in each of the 3 tries. This has worked for my system before.
OS X 10.8.2, git 1.8.2, Google Chrome 27.0.1438.7 dev
Thanks,
Christian.
Signature · 2 lines
Timo Sand [email protected]
Quoted 7 lines · Timo Sand
Hi,
well my use case is actually that I'm trying to use the gem 'gem-browse' which uses 'git web--browse'
I'm not using Apple Terminal, I'm using iTerm2 and there doesn't seem to be a SECURITYSESSIONID set, at least echo didn't find any. But neither did I find it on Apple Terminal either.
I noticed this the other day, but I think SECURITYSESSIONID only gets set when Screen Sharing is enabled. I had Screen Sharing enabled, launched iTerm2 and saw the variable. I closed iTerm2, turned off Screen Sharing, and relaunched iTerm2 to find the variable missing. As a result, I'm not SECURITYSESSIONID is a good mechanism for determining whether the terminal is associated a GUI or not. Unfortunately, I don't know of a better way.
Quoted 2 lines
What troubles me is that this issue has only arisen recently, earlier this worked fine for me
The following patch fixes the issue by recognizing iTerm2 as a GUI terminal.
-John
Quoted 1 line
From
5d282325f9374b25609a8704661c252304b4d18aMon Sep 17 00:00:00 2001
Date: Fri, 22 Mar 2013 13:23:07 -0400
Subject: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
--- git-web--browse.sh | 1 + 1 file changed, 1 insertion(+)
git-web--browse.sh +1 -0
@@ -120,6 +120,7 @@ if test -z "$browser" ; then fi # SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \ + -o "$TERM_PROGRAM" = "iTerm.app" \ -o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fi
Signature · 1 line
1.8.1.1
Quoted 17 lines · John Szakmeister
Quoted 7 lines · Timo Sand
Hi,
well my use case is actually that I'm trying to use the gem 'gem-browse' which uses 'git web--browse'
I'm not using Apple Terminal, I'm using iTerm2 and there doesn't seem to be a SECURITYSESSIONID set, at least echo didn't find any. But neither did I find it on Apple Terminal either.I noticed this the other day, but I think SECURITYSESSIONID only gets set when Screen Sharing is enabled. I had Screen Sharing enabled, launched iTerm2 and saw the variable. I closed iTerm2, turned off Screen Sharing, and relaunched iTerm2 to find the variable missing. As a result, I'm not SECURITYSESSIONID is a good mechanism for determining whether the terminal is associated a GUI or not. Unfortunately, I don't know of a better way.
Quoted 4 lines
Quoted 2 lines
What troubles me is that this issue has only arisen recently, earlier this worked fine for me
The following patch fixes the issue by recognizing iTerm2 as a GUI terminal.
Your patch looks good to me, and I cannot really test it as I don't have a Mac. Could you just had some of the explanations you gave above to the commit message?
Thanks,
Christian.
PATCH 1/1 git-web--browse: recognize iTerm as a GUI terminal on OS X
It turns out that the presence of SECURITYSESSIONID is not sufficient for detecting the presence of a GUI under Mac OS X. SECURITYSESSIONID appears to only be set when the user has Screen Sharing enabled. Disabling Screen Sharing and relaunching the shell showed that the variable was missing, at least under Mac OS X 10.6.8. As a result, let's check for iTerm directly via TERM_PROGRAM.
---
On Sun, Mar 24, 2013 at 10:05:53PM +0100, Christian Couder wrote:
[snip]
Quoted 3 lines
Your patch looks good to me, and I cannot really test it as I don't have a Mac. Could you just had some of the explanations you gave above to the commit message?
Here's an updated patch. I also noticed that git-bisect.sh is also trying to determine if a GUI is present by looking for SECURITYSESSIONID as well. I wonder if it would be better to create a shell function in git-sh-setup.sh that the two scripts could use?
-John
git-web--browse.sh | 1 +
1 file changed, 1 insertion(+)
git-web--browse.sh +1 -0
@@ -120,6 +120,7 @@ if test -z "$browser" ; then fi # SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \ + -o "$TERM_PROGRAM" = "iTerm.app" \ -o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fi
Signature · 1 line
1.8.2
Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
Quoted 16 lines · John Szakmeister
It turns out that the presence of SECURITYSESSIONID is not sufficient for detecting the presence of a GUI under Mac OS X. SECURITYSESSIONID appears to only be set when the user has Screen Sharing enabled. Disabling Screen Sharing and relaunching the shell showed that the variable was missing, at least under Mac OS X 10.6.8. As a result, let's check for iTerm directly via
TERM_PROGRAM.Signed-off-by John Szakmeister <[email protected]>---
On Sun, Mar 24, 2013 at 10:05:53PM +0100, Christian Couder wrote:
[snip]Quoted 3 lines
Your patch looks good to me, and I cannot really test it as I don't have a Mac. Could you just had some of the explanations you gave above to the commit message?
Quoted 5 lines
Here's an updated patch. I also noticed that
git-bisect.shis also trying to determine if a GUI is present by looking for SECURITYSESSIONID as well. I wonder if it would be better to create a shell function ingit-sh-setup.shthat the two scripts could use?
Yes, but that can come later once this settles.
Your patch makes me wonder if
test -n "$TERM_PROGRAM"
without any SECURITYSESSIONID or explicit program name checks should suffice, though.
Quoted 18 lines
-John
git-web--browse.sh| 1 +1 file changed, 1 insertion(+)git-web--browse.sh +1
-0@@ -120,6 +120,7 @@ if test -z "$browser" ; then fi # SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \ + -o "$TERM_PROGRAM" = "iTerm.app" \ -o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fi
Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
Sorry about the repeat Junio, I meant to hit "Reply to All".
On Mon, Mar 25, 2013 at 5:44 PM, Junio C Hamano <[email protected]> wrote:
[snip]
Quoted 6 lines
Your patch makes me wonder if
test -n "$TERM_PROGRAM"
without any SECURITYSESSIONID or explicit program name checks should suffice, though.
So, after downloading a couple of other terminals and trying things out, I think you're suggestion does suffice. Should I send an updated patch?
-John
Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
Quoted 6 lines · John Szakmeister
Sorry about the repeat Junio, I meant to hit "Reply to All".
On Mon, Mar 25, 2013 at 5:44 PM, Junio C Hamano <[email protected]> wrote:
[snip]Quoted 2 lines
Your patch makes me wonder if
Quoted 8 lines
Quoted 4 lines
test -n "$TERM_PROGRAM"
without any SECURITYSESSIONID or explicit program name checks should suffice, though.
So, after downloading a couple of other terminals and trying things out, I think you're suggestion does suffice. Should I send an updated patch?
If that approach is better than what you originally sent, then yes.
But I do not use OS X, so you may need to pay attention to possible complaints and comments from other Mac users on this list for a while---there may be people who run the program in question without that environment variable.
Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
On Wed, Mar 27, 2013 at 10:43 AM, Junio C Hamano <[email protected]> wrote:
[snip]
Quoted 6 lines
If that approach is better than what you originally sent, then yes.
But I do not use OS X, so you may need to pay attention to possible complaints and comments from other Mac users on this list for a while---there may be people who run the program in question without that environment variable.
Sorry it has taken me so long to get back to this. I searched around and tried out a few terminal programs that are available, and I think what you queued--checking that TERM_PROGRAM is non-empty--is the right fix.
Thanks!
-John
Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
In reply to John SzakmeisterQuoted 2 lines · John Szakmeister
Here's an updated patch.
Thank you for it. For what it's worth:
Quoted 5 lines
I also noticed that
git-bisect.shis
also trying to determine if a GUI is present by looking for SECURITYSESSIONID as well. I wonder if it would be better to create a shell function ingit-sh-setup.shthat the two scripts could use?
Yeah, it might be a good idea to have some common functions to determine if a GUI is present.
Maybe you could start with an os_x_gui_present() function in another patch on top of this one.
Thanks,
Christian.