Re: [RFC/PATCH] git-web--browse: don't add start as candidate on Ubuntu

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [RFC/PATCH] git-web--browse: don't add start as candidate on Ubuntu

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:51

Christian Couder [off-list ref] writes:
Le jeudi 1 janvier 2009, Ramsay Jones a écrit :
...
quoted
Does anybody else see this issue and can someone test the patch?
Petr, as you added support for using /bin/start on MinGW, could you test?

Thanks,
Christian.
quoted hunk
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 78d236b..7ed0fad 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -115,7 +115,7 @@ if test -z "$browser" ; then
 	browser_candidates="open $browser_candidates"
     fi
     # /bin/start indicates MinGW
-    if test -n /bin/start; then
+    if test -x /bin/start; then
 	browser_candidates="start $browser_candidates"
     fi
In any case, the original test is simply bogus.  'test -n "$foo"' is to
see if $foo is an empty string, and giving a constant /bin/start always
yields true.

As an old timer, I tend to prefer "test -f" in this context, as anybody
sane can expect that the directory /bin will contain executables and
nothing else.  Another reason is purely stylistic.  Historically "-f" has
been much more portable than "-x" (which came from SVID), even though it
wouldn't make much difference in practice in the real world these days.

Re: [RFC/PATCH] git-web--browse: don't add start as candidate on Ubuntu

From: Petr Baudis <hidden>
Date: 2016-06-15 22:45:52

On Sat, Jan 03, 2009 at 11:53:56PM -0800, Junio C Hamano wrote:
Christian Couder [off-list ref] writes:
quoted
Le jeudi 1 janvier 2009, Ramsay Jones a écrit :
...
quoted
Does anybody else see this issue and can someone test the patch?
Petr, as you added support for using /bin/start on MinGW, could you test?
Sorry, I don't have access to MinGW system anymore.
quoted
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 78d236b..7ed0fad 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -115,7 +115,7 @@ if test -z "$browser" ; then
 	browser_candidates="open $browser_candidates"
     fi
     # /bin/start indicates MinGW
-    if test -n /bin/start; then
+    if test -x /bin/start; then
 	browser_candidates="start $browser_candidates"
     fi
In any case, the original test is simply bogus.  'test -n "$foo"' is to
see if $foo is an empty string, and giving a constant /bin/start always
yields true.
Oops. :-) That should've obviously been -f.

-- 
				Petr "Pasky" Baudis
The average, healthy, well-adjusted adult gets up at seven-thirty
in the morning feeling just terrible. -- Jean Kerr

[PATCH v2] git-web--browse: don't add start as candidate on Ubuntu

From: Ramsay Jones <hidden>
Date: 2016-06-15 22:45:56

Signed-off-by: Ramsay Jones <redacted>
---

  Junio C Hamano wrote:
  > Christian Couder [off-list ref] writes:
  >> Le jeudi 1 janvier 2009, Ramsay Jones a écrit :
  >> ...
  >>> Does anybody else see this issue and can someone test the patch?
  >> Petr, as you added support for using /bin/start on MinGW, could you test?
  >>
  >> diff --git a/git-web--browse.sh b/git-web--browse.sh
  >> index 78d236b..7ed0fad 100755
  >> --- a/git-web--browse.sh
  >> +++ b/git-web--browse.sh
  >> @@ -115,7 +115,7 @@ if test -z "$browser" ; then
  >>  	browser_candidates="open $browser_candidates"
  >>      fi
  >>      # /bin/start indicates MinGW
  >> -    if test -n /bin/start; then
  >> +    if test -x /bin/start; then
  >>  	browser_candidates="start $browser_candidates"
  >>      fi
  > 
  > In any case, the original test is simply bogus.  'test -n "$foo"' is to
  > see if $foo is an empty string, and giving a constant /bin/start always
  > yields true.
  > 
  > As an old timer, I tend to prefer "test -f" in this context, as anybody
  > sane can expect that the directory /bin will contain executables and
  > nothing else.  Another reason is purely stylistic.  Historically "-f" has
  > been much more portable than "-x" (which came from SVID), even though it
  > wouldn't make much difference in practice in the real world these days.

Sorry for the late reply; if this has already been resolved, then sorry for
the noise.

I was expecting to be castigated for having /sbin in my $PATH. Indeed, I was
a bit surprised... So, I checked my initialization files and then the system
initialization files and could not find where it was being set...

    $ strings /bin/bash | grep sbin
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    $ strings /bin/sh | grep sbin
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

So I don't think it's anything I'm doing...

Anyway, I've changed the patch as you suggested. It would still be good
if someone on MinGW could test it.

ATB,
Ramsay Jones

 git-web--browse.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 78d236b..c5e62a6 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -115,7 +115,7 @@ if test -z "$browser" ; then
 	browser_candidates="open $browser_candidates"
     fi
     # /bin/start indicates MinGW
-    if test -n /bin/start; then
+    if test -f /bin/start; then
 	browser_candidates="start $browser_candidates"
     fi
 
-- 
1.6.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help