{"thread":{"id":"17664","subject":"[PATCH 1/2] git-web--browse: Fix check for /bin/start","startedAt":"2009-02-08T23:12:43Z","lastAt":"2009-02-08T23:13:33Z","messageCount":2,"participants":["Todd Zullinger"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"103793","messageId":"e44161a223e7ec2cfb1f1b71399b995626c2d208.1234127422.git.tmz@pobox.com","threadId":"17664","inReplyTo":null,"subject":"[PATCH 1/2] git-web--browse: Fix check for /bin/start","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2009-02-08T23:12:43Z","receivedAt":"2009-02-08T23:12:43Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"The previous check in git-web--browse for /bin/start used test -n\n/bin/start, which was always true.  This lead to \"start\" being tried\nfirst in the browser list.  On systems with upstart installed, \"start\"\nexists and might be in the PATH, but it makes a poor choice for a web\nbrowser.  Instead, test that /bin/start exists and is executable.\n\nSigned-off-by: Todd Zullinger <tmz@pobox.com>\n---\n\nThis test is still a bit fragile, as it relies on the start from\nupstart not being installed in /bin.  I don't know if that's something\nwe can count on or not.  If not, the test needs to be extended to\ndifferentiate between the MingW's start and upstart's start.  Does the\nMingW start have a --version string or something we could check before\nadding start to the list?\n\n git-web--browse.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-web--browse.sh b/git-web--browse.sh\nindex 78d236b..7ed0fad 100755\n--- a/git-web--browse.sh\n+++ b/git-web--browse.sh\n@@ -115,7 +115,7 @@ if test -z \"$browser\" ; then\n \tbrowser_candidates=\"open $browser_candidates\"\n     fi\n     # /bin/start indicates MinGW\n-    if test -n /bin/start; then\n+    if test -x /bin/start; then\n \tbrowser_candidates=\"start $browser_candidates\"\n     fi\n\n-- \n1.6.1.3\n\n-- \nTodd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nHonesty is the best policy, but insanity is a better defense.\n"},{"id":"103794","messageId":"505e3349e025bb4ac91fdfaa987a19cc729fa8fb.1234127422.git.tmz@pobox.com","threadId":"17664","inReplyTo":"e44161a223e7ec2cfb1f1b71399b995626c2d208.1234127422.git.tmz@pobox.com","subject":"[PATCH 2/2] git-web--browse: Use xdg-open if it is available","fromName":"Todd Zullinger","fromEmail":"tmz@pobox.com","sentAt":"2009-02-08T23:13:33Z","receivedAt":"2009-02-08T23:13:33Z","isPatch":true,"sender":{"key":"tmz@pobox.com","avatar":"https://avatars.githubusercontent.com/u/806319?v=4"},"body":"Signed-off-by: Todd Zullinger <tmz@pobox.com>\n---\n\nFor now, I didn't remove any of the KDE specific hacks.  It seemed\nbetter to add  xdg-open and let it prove whether it's workable first.\n\nIs testing for start and xdg-open based on their paths robust enough?\nIs there a more portable, preferred method to search for these\nprograms in $PATH?\n\n git-web--browse.sh |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/git-web--browse.sh b/git-web--browse.sh\nindex 7ed0fad..a72cd5b 100755\n--- a/git-web--browse.sh\n+++ b/git-web--browse.sh\n@@ -31,7 +31,7 @@ valid_custom_tool()\n\n valid_tool() {\n \tcase \"$1\" in\n-\t\tfirefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start)\n+\t\tfirefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start | xdg-open)\n \t\t\t;; # happy\n \t\t*)\n \t\t\tvalid_custom_tool \"$1\" || return 1\n@@ -118,6 +118,10 @@ if test -z \"$browser\" ; then\n     if test -x /bin/start; then\n \tbrowser_candidates=\"start $browser_candidates\"\n     fi\n+    # Use xdg-open if it is available\n+    if test -x /usr/bin/xdg-open; then\n+\tbrowser_candidates=\"xdg-open $browser_candidates\"\n+    fi\n\n     for i in $browser_candidates; do\n \tinit_browser_path $i\n@@ -161,7 +165,7 @@ case \"$browser\" in\n \t\t;;\n \tesac\n \t;;\n-    w3m|links|lynx|open|start)\n+    w3m|links|lynx|open|start|xdg-open)\n \teval \"$browser_path\" \"$@\"\n \t;;\n     dillo)\n-- \n1.6.1.3\n\n-- \nTodd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nHe may look like an idiot and talk like an idiot but don't let that\nfool you. He really is an idiot.\n    -- Groucho Marx\n"}]}