git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: Bug: git web--browse doesn't recognise browser on OS X
       [not found] <CAMxBVSs6dJFnK78E2Da7t4V9ndJFRVDZEd1fR5QuCFz=u2Bnpw@mail.gmail.com>
@ 2013-03-14 11:39 ` Timo Sand
  2013-03-15 11:19   ` Christian Couder
  0 siblings, 1 reply; 11+ messages in thread
From: Timo Sand @ 2013-03-14 11:39 UTC (permalink / raw)
  To: git

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
timo.j.sand+sig@gmail.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: git web--browse doesn't recognise browser on OS X
  2013-03-14 11:39 ` Fwd: Bug: git web--browse doesn't recognise browser on OS X Timo Sand
@ 2013-03-15 11:19   ` Christian Couder
  2013-03-22 16:19     ` Timo Sand
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Couder @ 2013-03-15 11:19 UTC (permalink / raw)
  To: Timo Sand; +Cc: git

Hi,

On Thu, Mar 14, 2013 at 12:39 PM, Timo Sand <timo.j.sand@gmail.com> wrote:
> 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.

> 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"?

> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: git web--browse doesn't recognise browser on OS X
  2013-03-15 11:19   ` Christian Couder
@ 2013-03-22 16:19     ` Timo Sand
  2013-03-22 17:36       ` John Szakmeister
  0 siblings, 1 reply; 11+ messages in thread
From: Timo Sand @ 2013-03-22 16:19 UTC (permalink / raw)
  To: Christian Couder; +Cc: git

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

On 15 March 2013 11:19, Christian Couder <christian.couder@gmail.com> wrote:
> Hi,
>
> On Thu, Mar 14, 2013 at 12:39 PM, Timo Sand <timo.j.sand@gmail.com> wrote:
>> 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.
>
>> 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"?
>
>> 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.



-- 
Timo Sand
timo.j.sand+sig@gmail.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Bug: git web--browse doesn't recognise browser on OS X
  2013-03-22 16:19     ` Timo Sand
@ 2013-03-22 17:36       ` John Szakmeister
  2013-03-24 21:05         ` Christian Couder
  0 siblings, 1 reply; 11+ messages in thread
From: John Szakmeister @ 2013-03-22 17:36 UTC (permalink / raw)
  To: Timo Sand; +Cc: Christian Couder, git

On Fri, Mar 22, 2013 at 12:19 PM, Timo Sand <timo.j.sand@gmail.com> wrote:
> 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.

> 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

>From 5d282325f9374b25609a8704661c252304b4d18a Mon 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

Signed-off-by: John Szakmeister <john@szakmeister.net>
---
 git-web--browse.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1e82726..1ff5379 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -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
-- 
1.8.1.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Bug: git web--browse doesn't recognise browser on OS X
  2013-03-22 17:36       ` John Szakmeister
@ 2013-03-24 21:05         ` Christian Couder
  2013-03-25 10:13           ` [PATCH] git-web--browse: recognize iTerm as a GUI terminal " John Szakmeister
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Couder @ 2013-03-24 21:05 UTC (permalink / raw)
  To: John Szakmeister; +Cc: Timo Sand, git

On Fri, Mar 22, 2013 at 6:36 PM, John Szakmeister <john@szakmeister.net> wrote:
> On Fri, Mar 22, 2013 at 12:19 PM, Timo Sand <timo.j.sand@gmail.com> wrote:
>> 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.
>
>> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-24 21:05         ` Christian Couder
@ 2013-03-25 10:13           ` John Szakmeister
  2013-03-25 20:13             ` Christian Couder
  2013-03-25 21:44             ` Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: John Szakmeister @ 2013-03-25 10:13 UTC (permalink / raw)
  To: Christian Couder; +Cc: Timo Sand, git

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 <john@szakmeister.net>
---

On Sun, Mar 24, 2013 at 10:05:53PM +0100, Christian Couder wrote:
[snip]
> 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(+)

diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1e82726..1ff5379 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -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
-- 
1.8.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-25 10:13           ` [PATCH] git-web--browse: recognize iTerm as a GUI terminal " John Szakmeister
@ 2013-03-25 20:13             ` Christian Couder
  2013-03-25 21:44             ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Christian Couder @ 2013-03-25 20:13 UTC (permalink / raw)
  To: John Szakmeister; +Cc: Timo Sand, git

On Mon, Mar 25, 2013 at 11:13 AM, John Szakmeister <john@szakmeister.net> wrote:
>
> Here's an updated patch.

Thank you for it. For what it's worth:

Acked-by: Christian Couder <chriscool@tuxfamily.org>

> 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?

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-25 10:13           ` [PATCH] git-web--browse: recognize iTerm as a GUI terminal " John Szakmeister
  2013-03-25 20:13             ` Christian Couder
@ 2013-03-25 21:44             ` Junio C Hamano
  2013-03-26  8:54               ` John Szakmeister
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2013-03-25 21:44 UTC (permalink / raw)
  To: John Szakmeister; +Cc: Christian Couder, Timo Sand, git

John Szakmeister <john@szakmeister.net> writes:

> 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 <john@szakmeister.net>
> ---
>
> On Sun, Mar 24, 2013 at 10:05:53PM +0100, Christian Couder wrote:
> [snip]
>> 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?

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.

>
> -John
>
> git-web--browse.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/git-web--browse.sh b/git-web--browse.sh
> index 1e82726..1ff5379 100755
> --- a/git-web--browse.sh
> +++ b/git-web--browse.sh
> @@ -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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-25 21:44             ` Junio C Hamano
@ 2013-03-26  8:54               ` John Szakmeister
  2013-03-27 14:43                 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: John Szakmeister @ 2013-03-26  8:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Timo Sand, git

Sorry about the repeat Junio, I meant to hit "Reply to All".

On Mon, Mar 25, 2013 at 5:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
[snip]
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-26  8:54               ` John Szakmeister
@ 2013-03-27 14:43                 ` Junio C Hamano
  2013-04-04  0:10                   ` John Szakmeister
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2013-03-27 14:43 UTC (permalink / raw)
  To: John Szakmeister; +Cc: Christian Couder, Timo Sand, git

John Szakmeister <john@szakmeister.net> writes:

> Sorry about the repeat Junio, I meant to hit "Reply to All".
>
> On Mon, Mar 25, 2013 at 5:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
> [snip]
>> 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?

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] git-web--browse: recognize iTerm as a GUI terminal on OS X
  2013-03-27 14:43                 ` Junio C Hamano
@ 2013-04-04  0:10                   ` John Szakmeister
  0 siblings, 0 replies; 11+ messages in thread
From: John Szakmeister @ 2013-04-04  0:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Christian Couder, Timo Sand, git

On Wed, Mar 27, 2013 at 10:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
[snip]
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-04-04  0:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAMxBVSs6dJFnK78E2Da7t4V9ndJFRVDZEd1fR5QuCFz=u2Bnpw@mail.gmail.com>
2013-03-14 11:39 ` Fwd: Bug: git web--browse doesn't recognise browser on OS X Timo Sand
2013-03-15 11:19   ` Christian Couder
2013-03-22 16:19     ` Timo Sand
2013-03-22 17:36       ` John Szakmeister
2013-03-24 21:05         ` Christian Couder
2013-03-25 10:13           ` [PATCH] git-web--browse: recognize iTerm as a GUI terminal " John Szakmeister
2013-03-25 20:13             ` Christian Couder
2013-03-25 21:44             ` Junio C Hamano
2013-03-26  8:54               ` John Szakmeister
2013-03-27 14:43                 ` Junio C Hamano
2013-04-04  0:10                   ` John Szakmeister

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).