{"thread":{"id":"17305","subject":"[PATCH] cygwin: Convert paths for html help from posix to windows","startedAt":"2009-01-22T17:16:05Z","lastAt":"2009-01-26T10:05:11Z","messageCount":6,"participants":["Björn Steinbrink","Junio C Hamano","Johannes Schindelin","Steffen Jaeckel","Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"101549","messageId":"20090122171605.GA16684@atjola.homenet","threadId":"17305","inReplyTo":null,"subject":"[PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-01-22T17:16:05Z","receivedAt":"2009-01-22T17:16:05Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"When using \"git help --web\" with cygwin, we used to pass the posix path\nto the browser, but a native windows browser will expect a windows path\nand is unable to make use of the given path.\n\nSo the cygwin port gets its own open_html implementation that handles\nthe path conversion.\n\nReported-by: Steffen Jaeckel <jaeckel@stzedn.de>\nTested-by: Steffen Jaeckel <jaeckel@stzedn.de>\n\nSigned-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n---\nOK, I don't really know if this is the right way to do it. Maybe when\nthe browser was built for cygwin this breaks? I have no clue, it's\nadmittedly just the result of a quick glance at the code and some\ngoogling to find the \"right\" cygwin function... :-/\n\n compat/cygwin.c |    7 +++++++\n compat/cygwin.h |    3 +++\n 2 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/cygwin.c b/compat/cygwin.c\nindex ebac148..70ecd2d 100644\n--- a/compat/cygwin.c\n+++ b/compat/cygwin.c\n@@ -141,3 +141,10 @@ static int cygwin_lstat_stub(const char *file_name, struct stat *buf)\n stat_fn_t cygwin_stat_fn = cygwin_stat_stub;\n stat_fn_t cygwin_lstat_fn = cygwin_lstat_stub;\n \n+void cygwin_open_html(const char *unixpath)\n+{\n+\tchar cygpath[PATH_MAX];\n+\n+\tcygwin_conv_to_win32_path(unixpath, cygpath);\n+\texecl_git_cmd(\"web--browse\", \"-c\", \"help.browser\", cygpath, NULL);\n+}\ndiff --git a/compat/cygwin.h b/compat/cygwin.h\nindex a3229f5..7cbefea 100644\n--- a/compat/cygwin.h\n+++ b/compat/cygwin.h\n@@ -7,3 +7,6 @@ extern stat_fn_t cygwin_lstat_fn;\n \n #define stat(path, buf) (*cygwin_stat_fn)(path, buf)\n #define lstat(path, buf) (*cygwin_lstat_fn)(path, buf)\n+\n+void cygwin_open_html(const char *path);\n+#define open_html cygwin_open_html\n-- \n1.6.1.230.gf873d\n"},{"id":"101551","messageId":"7veiyv6ynm.fsf@gitster.siamese.dyndns.org","threadId":"17305","inReplyTo":"20090122171605.GA16684@atjola.homenet","subject":"Re: [PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-22T17:25:33Z","receivedAt":"2009-01-22T17:25:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Björn Steinbrink <B.Steinbrink@gmx.de> writes:\n\n> OK, I don't really know if this is the right way to do it. Maybe when\n> the browser was built for cygwin this breaks? I have no clue,...\n\nIt might be simple enough to check if all it takes is to install a\nprepackaged browser from Cygwin suite and try to run it.  Doesn't Cygwin\nhave small ones such as lynx (or links)?\n"},{"id":"101554","messageId":"alpine.DEB.1.00.0901221829180.3586@pacific.mpi-cbg.de","threadId":"17305","inReplyTo":"7veiyv6ynm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-22T17:30:07Z","receivedAt":"2009-01-22T17:30:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Jan 2009, Junio C Hamano wrote:\n\n> Björn Steinbrink <B.Steinbrink@gmx.de> writes:\n> \n> > OK, I don't really know if this is the right way to do it. Maybe when\n> > the browser was built for cygwin this breaks? I have no clue,...\n> \n> It might be simple enough to check if all it takes is to install a\n> prepackaged browser from Cygwin suite and try to run it.  Doesn't Cygwin\n> have small ones such as lynx (or links)?\n\nWas it not the case that Cygwin programs could grok Windows paths, too?  \nIIRC w3m is available, dunno about lynx.\n\nCiao,\nDscho\n"},{"id":"101557","messageId":"1166352985.20090122203419@stzedn.de","threadId":"17305","inReplyTo":"alpine.DEB.1.00.0901221829180.3586@pacific.mpi-cbg.de","subject":"Re[2]: [PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Steffen Jaeckel","fromEmail":"jaeckel@stzedn.de","sentAt":"2009-01-22T19:34:19Z","receivedAt":"2009-01-22T19:34:19Z","isPatch":true,"sender":{"key":"jaeckel@stzedn.de","avatar":null},"body":"Hi,\n\n-----Original Message-----\nFrom: Johannes Schindelin [mailto:Johannes.Schindelin@gmx.de] \n\n> Hi,\n\n> On Thu, 22 Jan 2009, Junio C Hamano wrote:\n\n>> Björn Steinbrink <B.Steinbrink@gmx.de> writes:\n>> \n>> > OK, I don't really know if this is the right way to do it. Maybe when\n>> > the browser was built for cygwin this breaks? I have no clue,...\n>> \n>> It might be simple enough to check if all it takes is to install a\n>> prepackaged browser from Cygwin suite and try to run it.  Doesn't Cygwin\n>> have small ones such as lynx (or links)?\n\n> Was it not the case that Cygwin programs could grok Windows paths, too?  \n> IIRC w3m is available, dunno about lynx.\n\n> Ciao,\n> Dscho\n\nThe intention of this patch was to hand over the url to a windows\napplication.\n\nIn cygwin you can use lynx, links and others, but they are not as\nsmart to use as a browser with a real gui.\n\nCygwin can't handle windows paths, and this patch will break\ncygwin based browsers like links...\n\nMy first idea was to patch the git-web--browse.sh script in the section\nwhere the browser is called.\n--------\ndiff --git a/git-web--browse.sh b/git-web--browse.sh\nindex 78d236b..f726f8f 100755\n--- a/git-web--browse.sh\n+++ b/git-web--browse.sh\n@@ -143,7 +143,7 @@ case \"$browser\" in\n        vers=$(expr \"$($browser_path -version)\" : '.* \\([0-9][0-9]*\\)\\..*')\n        NEWTAB='-new-tab'\n        test \"$vers\" -lt 2 && NEWTAB=''\n-       \"$browser_path\" $NEWTAB \"$@\" &\n+       \"$browser_path\" $NEWTAB \"`cygpath -w $@`\" &\n        ;;\n     konqueror)\n        case \"$(basename \"$browser_path\")\" in\n--------\nThis solution works for cygwin internal browsers where the posix path\nis required and it works for windows apps called out of the cygwin\nenvironment as well.\nThis is certainely not a proper solution but I've got no other idea\nhow to solve the problem.\n\nBest regards,\nsteffen\n-- \nSteffen Jaeckel\nSteinbeis-Transferzentrum/Steinbeis-Innovationszentrum \nEmbedded Design und Networking\nan der Berufsakademie Lörrach\nPoststraße 35, 79423 Heitersheim\nLeiter: Prof. Dr.-Ing. Axel Sikora\nPhone: +49 7634 6949341\nMob  : +49  170 2328968\nFax  : +49 7634 5049886\nwww.stzedn.de\n\nHINWEIS\nDas Steinbeis Transferzentrum Embedded Design und Networking (stzedn)\nan der Dualen Hochschule Baden-Württemberg/Berufsakademie Lörrach wird\nvom 3.-5.3.2009 auf der Embedded World 2009 in Nürnberg mit einem Stand\nvertreten sein. Bitte besuchen Sie uns in Halle 12 Stand 322h.\n\nZentrale: \nSteinbeis GmbH & Co. KG für Technologietransfer \nWilli-Bleicher-Straße 19, 70174 Stuttgart \nRegistergericht Stuttgart HRA 12 480 \n\nKomplementär: Steinbeis-Verwaltung-GmbH, Registergericht Stuttgart HRB 18715 \nGeschäftsführer: Prof. Dr. Heinz Trasch, Prof. Dr. Michael Auer \n\nDer Inhalt dieser E-Mail einschließlich aller Anhänge ist vertraulich und \nausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der \nvorgesehene Adressat dieser E-Mail oder dessen Vertreter sein sollten, so \nbeachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, \nVervielfältigung oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. \nWir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung \nzu setzen, sowie die Originalnachricht zu löschen und alle Kopien hiervon zu \nvernichten.\n\nThis e-mail message including any attachments is for the sole use of the \nintended recipient(s) and may contain privileged or confidential information. \nAny unauthorized review, use, disclosure or distribution is prohibited. If you \nare not the intended recipient, please immediately contact the sender by reply \ne-mail and delete the original message and destroy all copies thereof.\n"},{"id":"101764","messageId":"497B632B.1060801@ramsay1.demon.co.uk","threadId":"17305","inReplyTo":"20090122171605.GA16684@atjola.homenet","subject":"Re: [PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2009-01-24T18:51:23Z","receivedAt":"2009-01-24T18:51:23Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Björn Steinbrink wrote:\n> When using \"git help --web\" with cygwin, we used to pass the posix path\n> to the browser, but a native windows browser will expect a windows path\n> and is unable to make use of the given path.\n> \n> So the cygwin port gets its own open_html implementation that handles\n> the path conversion.\n> \n> Reported-by: Steffen Jaeckel <jaeckel@stzedn.de>\n> Tested-by: Steffen Jaeckel <jaeckel@stzedn.de>\n> \n> Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n> ---\n> OK, I don't really know if this is the right way to do it. Maybe when\n> the browser was built for cygwin this breaks? I have no clue, it's\n> admittedly just the result of a quick glance at the code and some\n> googling to find the \"right\" cygwin function... :-/\n> \n\nHi Björn,\n\nI had the same problem. However, rather than modifying git, I created a\nfirefox wrapper script (in ~/bin) which used the cygpath command line\ntool to do the path conversion. Also, if you use \"git instaweb\", you\nalso need to filter out http URLs and pass them through un-molested\nby cygpath (it turns http://localhost into http:\\localhost).\n\nMy script is clearly a \"quick hack\" just to get something working for\nme, but you may find it useful as a starting point for your own\n(\"proper\" ;-) script, so I've included it below.\n\nHTH,\nRamsay Jones\n\n-->8--\n#!/bin/sh\n#\n\nwhile test $# != 0\ndo\n    case \"$1\" in\n\t-version)\n\t    echo \"firefox 1.5.0.2\"\n\t    exit 0\n\t    ;;\n\t-new-tab)\n\t    echo \"-new-tab not supported\"\n\t    exit 1\n\t    ;;\n\t--)\n\t    shift\n\t    break\n\t    ;;\n\t-*)\n\t    echo \"option '$1' not supported\"\n\t    exit 1\n\t    ;;\n\t*)\n\t    break\n\t    ;;\n    esac\n    shift\ndone\n\nif test \"$1\" = \"\"\nthen\n\tp=\nelse\n\tcase \"$1\" in\n\t    http*)\n\t\tp=\"$1\"\n\t\t;;\n\t    *)\n\t\tp=\"$(cygpath -w \"$1\")\"\n\t\t;;\n\tesac\nfi\n\n\n\"/cygdrive/c/Program Files/Mozilla Firefox/firefox.exe\" \"$p\"\n\nexit 0\n"},{"id":"101956","messageId":"1232544917.20090126110511@stzedn.de","threadId":"17305","inReplyTo":"497B632B.1060801@ramsay1.demon.co.uk","subject":"Re: [PATCH] cygwin: Convert paths for html help from posix to windows","fromName":"Steffen Jaeckel","fromEmail":"jaeckel@stzedn.de","sentAt":"2009-01-26T10:05:11Z","receivedAt":"2009-01-26T10:05:11Z","isPatch":true,"sender":{"key":"jaeckel@stzedn.de","avatar":null},"body":"-----Original Message-----\nFrom: Ramsay Jones [mailto:ramsay@ramsay1.demon.co.uk]\n\n> Hi Björn,\n\n> I had the same problem. However, rather than modifying git, I created a\n> firefox wrapper script (in ~/bin) which used the cygpath command line\n> tool to do the path conversion. Also, if you use \"git instaweb\", you\n> also need to filter out http URLs and pass them through un-molested\n> by cygpath (it turns http://localhost into http:\\localhost).\n\n> My script is clearly a \"quick hack\" just to get something working for\n> me, but you may find it useful as a starting point for your own\n> (\"proper\" ;-) script, so I've included it below.\n\n> HTH,\n> Ramsay Jones\n\nHi Ramsay,\n\nthanks for this idea. I solved the problem by using the bash script\nincluded below.\n\nCheerz,\nSteffen\n\n\n>sj\n#!/bin/sh\n#\n\nff=\"/cygdrive/c/Programme/Mozilla Firefox/firefox.exe\"\n\nwhile test $# != 0\ndo\n    case \"$1\" in\n        -version)\n            echo $(\"$ff\" \"-version\")\n            exit 0\n            ;;\n        -new-tab)\n            p=\n            case \"$2\" in\n                http*)\n                    p=\"$2\"\n                    ;;\n                *)\n                    # check if file exists\n                    if [ -e \"$2\" ]\n                    then\n                      p=\"$(cygpath -w \"$2\")\"\n                    fi\n                    ;;\n            esac\n            # check if $p has been set, otherwise exit with error\n            if [ \"$p\" ]\n            then\n              $(\"$ff\" \"$p\")\n              exit 0\n            else\n              exit 1\n            fi\n            ;;\n    esac\n    shift\ndone\n\nexit 1\n\n-- \nSteffen Jaeckel\nSteinbeis-Transferzentrum/Steinbeis-Innovationszentrum \nEmbedded Design und Networking\nan der Berufsakademie Lörrach\nPoststraße 35, 79423 Heitersheim\nLeiter: Prof. Dr.-Ing. Axel Sikora\nPhone: +49 7634 6949341\nMob  : +49  170 2328968\nFax  : +49 7634 5049886\nwww.stzedn.de\n\nHINWEIS\nDas Steinbeis Transferzentrum Embedded Design und Networking (stzedn)\nan der Dualen Hochschule Baden-Württemberg/Berufsakademie Lörrach wird\nvom 3.-5.3.2009 auf der Embedded World 2009 in Nürnberg mit einem Stand\nvertreten sein. Bitte besuchen Sie uns in Halle 12 Stand 322h.\n\nZentrale: \nSteinbeis GmbH & Co. KG für Technologietransfer \nWilli-Bleicher-Straße 19, 70174 Stuttgart \nRegistergericht Stuttgart HRA 12 480 \n\nKomplementär: Steinbeis-Verwaltung-GmbH, Registergericht Stuttgart HRB 18715 \nGeschäftsführer: Prof. Dr. Heinz Trasch, Prof. Dr. Michael Auer \n\nDer Inhalt dieser E-Mail einschließlich aller Anhänge ist vertraulich und \nausschließlich für den bezeichneten Adressaten bestimmt. Wenn Sie nicht der \nvorgesehene Adressat dieser E-Mail oder dessen Vertreter sein sollten, so \nbeachten Sie bitte, dass jede Form der Kenntnisnahme, Veröffentlichung, \nVervielfältigung oder Weitergabe des Inhalts dieser E-Mail unzulässig ist. \nWir bitten Sie, sich in diesem Fall mit dem Absender der E-Mail in Verbindung \nzu setzen, sowie die Originalnachricht zu löschen und alle Kopien hiervon zu \nvernichten.\n\nThis e-mail message including any attachments is for the sole use of the \nintended recipient(s) and may contain privileged or confidential information. \nAny unauthorized review, use, disclosure or distribution is prohibited. If you \nare not the intended recipient, please immediately contact the sender by reply \ne-mail and delete the original message and destroy all copies thereof.\n"}]}