{"thread":{"id":"35899","subject":"difftool sends malformed path to exernal tool on Windows","startedAt":"2014-02-17T22:14:01Z","lastAt":"2014-03-16T07:27:47Z","messageCount":10,"participants":["Paul Lotz","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"234933","messageId":"011301cf2c2d$90442810$b0cc7830$@lsst.org","threadId":"35899","inReplyTo":null,"subject":"difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-02-17T22:14:01Z","receivedAt":"2014-02-17T22:14:01Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"From the Git Bash command line, I enter\n$ git difftool\n\nand type y when the file I want to difference appears.  Git correctly\ncalls the external diff tool (LVCompare.exe), but the path for the remote\nfile Git passes to that tool is malformed (e.g.,\nC:\\/Users/Paul/AppData/Local/Temp/QCpqLa_calcLoadCellExcitation.vi). \nObviously the \\/ (backslash forwardslash) combination is incorrect.\n\nFor the record, I have successfully made calls to LVCompare.exe manually\nfrom a Windows command prompt directly (without Git).\n\nThe relevant portion of the .gitconfig file is:\n[diff]\n     tool = \"LVCompare\"\n[difftool \"LVCompare\"]\n     cmd = 'C:/Program Files (x86)/National Instruments/Shared/LabVIEW\nCompare/LVCompare.exe' \\\"$LOCAL\\\"  \\\"$REMOTE\\\"\n\n\nFor the record, the operating system is Windows 8.1.\n\nPaul\n"},{"id":"235124","messageId":"20140221103821.GA21414@gmail.com","threadId":"35899","inReplyTo":"011301cf2c2d$90442810$b0cc7830$@lsst.org","subject":"Re: difftool sends malformed path to exernal tool on Windows","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-02-21T10:38:22Z","receivedAt":"2014-02-21T10:38:22Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Feb 17, 2014 at 03:14:01PM -0700, Paul Lotz wrote:\n> From the Git Bash command line, I enter\n> $ git difftool\n> \n> and type y when the file I want to difference appears.  Git correctly\n> calls the external diff tool (LVCompare.exe), but the path for the remote\n> file Git passes to that tool is malformed (e.g.,\n> C:\\/Users/Paul/AppData/Local/Temp/QCpqLa_calcLoadCellExcitation.vi). \n> Obviously the \\/ (backslash forwardslash) combination is incorrect.\n\nIf this is the case then difftool is not the only one with this problem.\n\nWe use the GIT_EXTERNAL_DIFF mechanism to run difftool under \"git diff\",\nso it may be that the paths are mangled by \"git diff\" itself.\nI don't really know enough about msysgit to know for sure, though.\n\nWhat do you see if you create a dummy tool which just does \"echo\"?\n\n[difftool \"test\"]\n\tcmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\nThen run:\n\n$ git difftool -t test\n\n> For the record, I have successfully made calls to LVCompare.exe manually\n> from a Windows command prompt directly (without Git).\n> \n> The relevant portion of the .gitconfig file is:\n> [diff]\n>      tool = \"LVCompare\"\n> [difftool \"LVCompare\"]\n>      cmd = 'C:/Program Files (x86)/National Instruments/Shared/LabVIEW\n> Compare/LVCompare.exe' \\\"$LOCAL\\\"  \\\"$REMOTE\\\"\n> \n> \n> For the record, the operating system is Windows 8.1.\n\nDo any msysgit folks know whether GIT_EXTERNAL_DIFF is a known issue?\n-- \nDavid\n"},{"id":"235263","messageId":"000801cf317f$ac1be2b0$0453a810$@lsst.org","threadId":"35899","inReplyTo":"20140221103821.GA21414@gmail.com","subject":"RE: difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-02-24T16:44:23Z","receivedAt":"2014-02-24T16:44:23Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"David,\n\nThanks for the helpful reply.\n\nAs you suggested, I modified the .gitconfig file to have:\n[difftool \"test\"]\n\tcmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\nand ran\n$ git difftool -t test\n\nAn example of the the resulting console output is:\nC:/Users/Paul/AppData/Local/Temp/I8L2Bc_WriteTestParameters.vi Commands/StartAutomatedTest/WriteTestParameters.vi\n\nPaul\n\n-----Original Message-----\nFrom: David Aguilar [mailto:davvid@gmail.com] \nSent: Friday, February 21, 2014 3:38 AM\nTo: Paul Lotz\nCc: git@vger.kernel.org\nSubject: Re: difftool sends malformed path to exernal tool on Windows\n\nOn Mon, Feb 17, 2014 at 03:14:01PM -0700, Paul Lotz wrote:\n> From the Git Bash command line, I enter $ git difftool\n> \n> and type ‘y’ when the file I want to difference appears.  Git \n> correctly calls the external diff tool (LVCompare.exe), but the path \n> for the remote file Git passes to that tool is malformed (e.g., \n> C:\\/Users/Paul/AppData/Local/Temp/QCpqLa_calcLoadCellExcitation.vi).\n> Obviously the \\/ (backslash forwardslash) combination is incorrect.\n\nIf this is the case then difftool is not the only one with this problem.\n\nWe use the GIT_EXTERNAL_DIFF mechanism to run difftool under \"git diff\", so it may be that the paths are mangled by \"git diff\" itself.\nI don't really know enough about msysgit to know for sure, though.\n\nWhat do you see if you create a dummy tool which just does \"echo\"?\n\n[difftool \"test\"]\n\tcmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\nThen run:\n\n$ git difftool -t test\n\n> For the record, I have successfully made calls to LVCompare.exe \n> manually from a Windows command prompt directly (without Git).\n> \n> The relevant portion of the .gitconfig file is:\n> [diff]\n>      tool = \"LVCompare\"\n> [difftool \"LVCompare\"]\n>      cmd = 'C:/Program Files (x86)/National Instruments/Shared/LabVIEW \n> Compare/LVCompare.exe' \\\"$LOCAL\\\"  \\\"$REMOTE\\\"\n> \n> \n> For the record, the operating system is Windows 8.1.\n\nDo any msysgit folks know whether GIT_EXTERNAL_DIFF is a known issue?\n--\nDavid\n"},{"id":"235630","messageId":"000001cf349d$95fed750$c1fc85f0$@lsst.org","threadId":"35899","inReplyTo":"20140221103821.GA21414@gmail.com","subject":"RE: difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-02-28T15:56:04Z","receivedAt":"2014-02-28T15:56:04Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"OK, so what can we do next?\n\nPaul\n\n-----Original Message-----\nFrom: Paul Lotz [mailto:plotz@lsst.org] \nSent: Monday, February 24, 2014 9:44 AM\nTo: 'David Aguilar'\nCc: 'git@vger.kernel.org'\nSubject: RE: difftool sends malformed path to exernal tool on Windows\n\nDavid,\n\nThanks for the helpful reply.\n\nAs you suggested, I modified the .gitconfig file to have:\n[difftool \"test\"]\n\tcmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\nand ran\n$ git difftool -t test\n\nAn example of the the resulting console output is:\nC:/Users/Paul/AppData/Local/Temp/I8L2Bc_WriteTestParameters.vi Commands/StartAutomatedTest/WriteTestParameters.vi\n\nPaul\n\n-----Original Message-----\nFrom: David Aguilar [mailto:davvid@gmail.com]\nSent: Friday, February 21, 2014 3:38 AM\nTo: Paul Lotz\nCc: git@vger.kernel.org\nSubject: Re: difftool sends malformed path to exernal tool on Windows\n\nOn Mon, Feb 17, 2014 at 03:14:01PM -0700, Paul Lotz wrote:\n> From the Git Bash command line, I enter $ git difftool\n> \n> and type ‘y’ when the file I want to difference appears.  Git \n> correctly calls the external diff tool (LVCompare.exe), but the path \n> for the remote file Git passes to that tool is malformed (e.g., \n> C:\\/Users/Paul/AppData/Local/Temp/QCpqLa_calcLoadCellExcitation.vi).\n> Obviously the \\/ (backslash forwardslash) combination is incorrect.\n\nIf this is the case then difftool is not the only one with this problem.\n\nWe use the GIT_EXTERNAL_DIFF mechanism to run difftool under \"git diff\", so it may be that the paths are mangled by \"git diff\" itself.\nI don't really know enough about msysgit to know for sure, though.\n\nWhat do you see if you create a dummy tool which just does \"echo\"?\n\n[difftool \"test\"]\n\tcmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\nThen run:\n\n$ git difftool -t test\n\n> For the record, I have successfully made calls to LVCompare.exe \n> manually from a Windows command prompt directly (without Git).\n> \n> The relevant portion of the .gitconfig file is:\n> [diff]\n>      tool = \"LVCompare\"\n> [difftool \"LVCompare\"]\n>      cmd = 'C:/Program Files (x86)/National Instruments/Shared/LabVIEW \n> Compare/LVCompare.exe' \\\"$LOCAL\\\"  \\\"$REMOTE\\\"\n> \n> \n> For the record, the operating system is Windows 8.1.\n\nDo any msysgit folks know whether GIT_EXTERNAL_DIFF is a known issue?\n--\nDavid\n"},{"id":"235819","messageId":"CAJDDKr751=c2AOBfjbg2_im6UCBvwWSVjJ7QX8=76vXMsLSw4g@mail.gmail.com","threadId":"35899","inReplyTo":"000801cf317f$ac1be2b0$0453a810$@lsst.org","subject":"Re: difftool sends malformed path to exernal tool on Windows","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-03-03T00:35:23Z","receivedAt":"2014-03-03T00:35:23Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Feb 24, 2014 at 8:44 AM, Paul Lotz <plotz@lsst.org> wrote:\n> David,\n>\n> Thanks for the helpful reply.\n>\n> As you suggested, I modified the .gitconfig file to have:\n> [difftool \"test\"]\n>         cmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n>\n> and ran\n> $ git difftool -t test\n>\n> An example of the the resulting console output is:\n> C:/Users/Paul/AppData/Local/Temp/I8L2Bc_WriteTestParameters.vi Commands/StartAutomatedTest/WriteTestParameters.vi\n\nHmm. That's interesting.\n\nThe next test: replace \"echo\" with \"cat\".\n\nAre the contents of both files printed?\n\nIf so, then the next thing to try is running:\n\nLVCompare.exe [same paths printed by echo]\n\nand then seeing if it does the right thing.\n\nCould it be that LVCompare.exe is getting tripped up by the forward slashes?\n\nI'm not familiar enough with how msysgit mangles paths before\nlaunching programs. It may be that the C:/foo/bar/baz path is getting\nmanged (that's my current guess), but I really don't know.\n\nAnother tip I've read online is that launching git via \"cmd.exe\" may\navoid the path mangling. Sorry I'm not more helpful in this area.\n\nAnother workaround you can do is to place a shell script wrapper\naround LVCompare.exe that replaces C:\\/ with / and then launches the\nreal LVCompare.exe; that's a workaround, but it could work.\n\nI hope that helps shed some light on what may be going on.\n-- \nDavid\n"},{"id":"235958","messageId":"00bc01cf3737$b1474280$13d5c780$@lsst.org","threadId":"35899","inReplyTo":"CAJDDKr751=c2AOBfjbg2_im6UCBvwWSVjJ7QX8=76vXMsLSw4g@mail.gmail.com","subject":"RE: difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-03-03T23:24:15Z","receivedAt":"2014-03-03T23:24:15Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"David,\n\nOK, I did as you suggested, and the results were revealing.\n\nFirst, I replaced \"echo\" with \"cat\".  Result: The contents of both files appeared in the Git Bash Window.\n\nThen I tried calling LVCompare from the Git Bash and Windows Command Prompt windows with variations on the paths.\n\nHere are the most relevant results:\nFirst from the Windows Command Prompt:\n1) This command works:\nC:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\nabVIEW Compare\\LVCompare.exe\" C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\nus_Before.ctl C:\\LSST_TS\\SystemSW\\M2AADT\\Typedefs\\TestStatus.ctl\n[General note:\nI saved a copy of the temp file and replaced the hex string with the string 'Before' to make the file stick around.  The paths are otherwise the same.]\n\n2) C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\nabVIEW Compare\\LVCompare.exe\" C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\nus_Before.ctl Typedefs\\TestStatus.ctl\n\nResult: Error message with reference to C:\\Program Files (x86)\\National Instruments\\Shared\\L\nabVIEW Compare\\supportVIs\\_prolvcmp.llb\\Typedefs\\TestStatus.ctl\n\nObservation: The second path has to be the full path, not the relative path we get back using \"echo\".\n\n>From the Git Bash window:\n1) I tried the command that worked in the Windows Command Prompt:\n\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\nabVIEW Compare\\LVCompare.exe\" C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\nus_Before.ctl C:\\LSST_TS\\SystemSW\\M2AADT\\Typedefs\\TestStatus.ctl\n\nResult: Error message with reference to C:\\UsersPaulAppDataLocalTempTypedefs_TestStatus_Before.ctl\n\n2) So I tried a variation with forward slashes instead in the parameters:\n\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\nabVIEW Compare\\LVCompare.exe\" C:/Users/Paul/AppData/Local/Temp/Typedefs_TestStat\nus_Before.ctl C:/LSST_TS/SystemSW/M2AADT/Typedefs/TestStatus.ctl\n\nResult: Error message with reference to C:\\/Users/Paul/AppData/Local/Temp/Typedefs_TestStatus_Before.ctl\n[Note: This is the familiar problem we saw using the Git difftool command.]\n\n3) So I tried forward slashes even in the LVCompare.exe path:\n\"C:/Program Files (x86)/National Instruments\\Shared\\L\nabVIEW Compare\\LVCompare.exe\" C:/Users/Paul/AppData/Local/Temp/Typedefs_TestStat\nus_Before.ctl C:/LSST_TS/SystemSW/M2AADT/Typedefs/TestStatus.ctl\n\nResult: Error message with reference to C:\\/Users/Paul/AppData/Local/Temp/Typedefs_TestStatus_Before.ctl\n\n[No difference.]\n\nPaul\n\n-----Original Message-----\nFrom: David Aguilar [mailto:davvid@gmail.com] \nSent: Sunday, March 2, 2014 5:35 PM\nTo: Paul Lotz\nCc: Git Mailing List\nSubject: Re: difftool sends malformed path to exernal tool on Windows\n\nOn Mon, Feb 24, 2014 at 8:44 AM, Paul Lotz <plotz@lsst.org> wrote:\n> David,\n>\n> Thanks for the helpful reply.\n>\n> As you suggested, I modified the .gitconfig file to have:\n> [difftool \"test\"]\n>         cmd = echo \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n>\n> and ran\n> $ git difftool -t test\n>\n> An example of the the resulting console output is:\n> C:/Users/Paul/AppData/Local/Temp/I8L2Bc_WriteTestParameters.vi \n> Commands/StartAutomatedTest/WriteTestParameters.vi\n\nHmm. That's interesting.\n\nThe next test: replace \"echo\" with \"cat\".\n\nAre the contents of both files printed?\n\nIf so, then the next thing to try is running:\n\nLVCompare.exe [same paths printed by echo]\n\nand then seeing if it does the right thing.\n\nCould it be that LVCompare.exe is getting tripped up by the forward slashes?\n\nI'm not familiar enough with how msysgit mangles paths before launching programs. It may be that the C:/foo/bar/baz path is getting manged (that's my current guess), but I really don't know.\n\nAnother tip I've read online is that launching git via \"cmd.exe\" may avoid the path mangling. Sorry I'm not more helpful in this area.\n\nAnother workaround you can do is to place a shell script wrapper around LVCompare.exe that replaces C:\\/ with / and then launches the real LVCompare.exe; that's a workaround, but it could work.\n\nI hope that helps shed some light on what may be going on.\n--\nDavid\n"},{"id":"236075","messageId":"20140305082517.GA86532@gmail.com","threadId":"35899","inReplyTo":"00bc01cf3737$b1474280$13d5c780$@lsst.org","subject":"Re: difftool sends malformed path to exernal tool on Windows","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-03-05T08:25:18Z","receivedAt":"2014-03-05T08:25:18Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Mon, Mar 03, 2014 at 04:24:15PM -0700, Paul Lotz wrote:\n> David,\n> \n> OK, I did as you suggested, and the results were revealing.\n> \n> First, I replaced \"echo\" with \"cat\".  Result: The contents of both files appeared in the Git Bash Window.\n> \n> Then I tried calling LVCompare from the Git Bash and Windows Command Prompt windows with variations on the paths.\n> \n> Here are the most relevant results:\n> First from the Windows Command Prompt:\n> 1) This command works:\n> C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\n> abVIEW Compare\\LVCompare.exe\" C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl C:\\LSST_TS\\SystemSW\\M2AADT\\Typedefs\\TestStatus.ctl\n> [General note:\n> I saved a copy of the temp file and replaced the hex string with the string 'Before' to make the file stick around.  The paths are otherwise the same.]\n\nThis is aligns with: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/\n\n\t\"lvcompare.exe <absolute path to VI 1> ...\"\n\nThe key thing is the mention of absolute paths.\n\nWhat is happening is that lvcompare.exe (or likely it's a\nWindows thing) changes its current directory to its installation\ndirectory under Progra~1.\n\nThat means the relative paths passed in by difftool won't be found.\n\nThe way to fix it is to redirect your difftool config to a script\nthat makes all paths absolute.  This script can then call the real\nlvcompare.exe.\n\nYou just need to tweak the lvcompare part in your .gitconfig\nto look like this:\n\n[difftool \"lvcompare\"]\n\tcmd = ~/bin/lvcompare.sh \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\n\n... and install an executable lvcompare.sh shell script in in\nyour $HOME/bin.  Something like this:\n\n#!/bin/sh\n\nabspath () {\n\t(\n\t\tcd \"$(dirname \"$1\")\" &&\n\t\tprintf \"%s/%s\" \"$(pwd)\" \"$(basename \"$1\")\"\n\t)\n}\n\nlvcompare=\"C:\\\\Program Files (x86)\\National Instruments\\\\Shared\\\\LabVIEW Compare\\\\LVCompare.exe\"\nlocal=$(abspath \"$1\")\nremote=$(abspath \"$2\")\nexec \"$lvcompare\" \"$local\" \"$remote\"\n\n> 2) C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National Instruments\\Shared\\L\n> abVIEW Compare\\LVCompare.exe\" C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl Typedefs\\TestStatus.ctl\n> \n> Result: Error message with reference to C:\\Program Files (x86)\\National Instruments\\Shared\\L\n> abVIEW Compare\\supportVIs\\_prolvcmp.llb\\Typedefs\\TestStatus.ctl\n> \n> Observation: The second path has to be the full path, not the relative path we get back using \"echo\".\n\nYes, that's what it looks like.\n-- \nDavid\n"},{"id":"236136","messageId":"013501cf38c2$34018740$9c0495c0$@lsst.org","threadId":"35899","inReplyTo":"20140305082517.GA86532@gmail.com","subject":"RE: difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-03-05T22:28:16Z","receivedAt":"2014-03-05T22:28:16Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"David,\n\nWe did succeed in getting a script to work.  The local Git guru started with your script (he independently sent me something very similar) and added some tricks to make things work.\n\nThe contents of the shell script ended up as:\n___\n#!/bin/bash\n\n# Method to determine absolute path\n# The -W option on the pwd command is necessary to return the Windows version of the path.\n# Leaving off the -W option will result in a conversion of temp directory to a Linux-specific 'tmp' path.\n# Piping the result through tr '/' '\\\\' translates the forward slashes to backslashes.\n# Windows understands forward slashes, but LVCompare.exe does not.\nabspath () {\n\t(\n\t\tDIR=$(dirname \"$1\")\n\t\tFN=$(basename \"$1\")\n\t\tcd \"$DIR\"\n\t\tprintf \"%s/%s\" \"$(pwd -W)\" \"$FN\" | tr '/' '\\\\'\n\t)\n}\n\nlvcompare=\"C:\\\\Program Files (x86)\\National Instruments\\\\Shared\\\\LabVIEW Compare\\\\LVCompare.exe\"\nlocal=$(abspath \"$1\")\nremote=$(abspath \"$2\")\nexec \"$lvcompare\" -nobdpos -nofppos \"$local\" \"$remote\"\n# For the options, see http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/.\n___\n\nThis works, but the solution seems to me nontrivial.\n\nI will post this solution in Git with LabVIEW threads tomorrow, but I thought I'd see if you have any suggestions before I do that.\n\nThanks much!\n\nPaul\n\n-----Original Message-----\nFrom: David Aguilar [mailto:davvid@gmail.com] \nSent: Wednesday, March 5, 2014 1:25 AM\nTo: Paul Lotz\nCc: 'Git Mailing List'\nSubject: Re: difftool sends malformed path to exernal tool on Windows\n\nOn Mon, Mar 03, 2014 at 04:24:15PM -0700, Paul Lotz wrote:\n> David,\n> \n> OK, I did as you suggested, and the results were revealing.\n> \n> First, I replaced \"echo\" with \"cat\".  Result: The contents of both files appeared in the Git Bash Window.\n> \n> Then I tried calling LVCompare from the Git Bash and Windows Command Prompt windows with variations on the paths.\n> \n> Here are the most relevant results:\n> First from the Windows Command Prompt:\n> 1) This command works:\n> C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National \n> Instruments\\Shared\\L abVIEW Compare\\LVCompare.exe\" \n> C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl C:\\LSST_TS\\SystemSW\\M2AADT\\Typedefs\\TestStatus.ctl\n> [General note:\n> I saved a copy of the temp file and replaced the hex string with the \n> string 'Before' to make the file stick around.  The paths are \n> otherwise the same.]\n\nThis is aligns with: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/\n\n\t\"lvcompare.exe <absolute path to VI 1> ...\"\n\nThe key thing is the mention of absolute paths.\n\nWhat is happening is that lvcompare.exe (or likely it's a Windows thing) changes its current directory to its installation directory under Progra~1.\n\nThat means the relative paths passed in by difftool won't be found.\n\nThe way to fix it is to redirect your difftool config to a script that makes all paths absolute.  This script can then call the real lvcompare.exe.\n\nYou just need to tweak the lvcompare part in your .gitconfig to look like this:\n\n[difftool \"lvcompare\"]\n\tcmd = ~/bin/lvcompare.sh \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\n\n... and install an executable lvcompare.sh shell script in in your $HOME/bin.  Something like this:\n\n#!/bin/sh\n\nabspath () {\n\t(\n\t\tcd \"$(dirname \"$1\")\" &&\n\t\tprintf \"%s/%s\" \"$(pwd)\" \"$(basename \"$1\")\"\n\t)\n}\n\nlvcompare=\"C:\\\\Program Files (x86)\\National Instruments\\\\Shared\\\\LabVIEW Compare\\\\LVCompare.exe\"\nlocal=$(abspath \"$1\")\nremote=$(abspath \"$2\")\nexec \"$lvcompare\" \"$local\" \"$remote\"\n\n> 2) C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National \n> Instruments\\Shared\\L abVIEW Compare\\LVCompare.exe\" \n> C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl Typedefs\\TestStatus.ctl\n> \n> Result: Error message with reference to C:\\Program Files \n> (x86)\\National Instruments\\Shared\\L abVIEW \n> Compare\\supportVIs\\_prolvcmp.llb\\Typedefs\\TestStatus.ctl\n> \n> Observation: The second path has to be the full path, not the relative path we get back using \"echo\".\n\nYes, that's what it looks like.\n--\nDavid\n"},{"id":"236262","messageId":"019d01cf3a1f$4ebfe5f0$ec3fb1d0$@lsst.org","threadId":"35899","inReplyTo":"20140305082517.GA86532@gmail.com","subject":"RE: difftool sends malformed path to exernal tool on Windows","fromName":"Paul Lotz","fromEmail":"plotz@lsst.org","sentAt":"2014-03-07T16:07:15Z","receivedAt":"2014-03-07T16:07:15Z","isPatch":false,"sender":{"key":"plotz@lsst.org","avatar":null},"body":"David,\n\nI investigated further and found that \\\"$LOCAL\\\" \\\"$REMOTE\\\" return the remote and local files (reversed).  (One can easily see this in my 2/28 e-mail.)  Reversing these (\\\"$REMOTE\\\" \\\"$LOCAL\\\") does indeed reverse the output.  It is easy to work around this issue, but how can this be?\n\nPaul\n\n-----Original Message-----\nFrom: Paul Lotz [mailto:plotz@lsst.org] \nSent: Wednesday, March 5, 2014 3:28 PM\nTo: 'David Aguilar'\nCc: 'Git Mailing List'\nSubject: RE: difftool sends malformed path to exernal tool on Windows\n\nDavid,\n\nWe did succeed in getting a script to work.  The local Git guru started with your script (he independently sent me something very similar) and added some tricks to make things work.\n\nThe contents of the shell script ended up as:\n___\n#!/bin/bash\n\n# Method to determine absolute path\n# The -W option on the pwd command is necessary to return the Windows version of the path.\n# Leaving off the -W option will result in a conversion of temp directory to a Linux-specific 'tmp' path.\n# Piping the result through tr '/' '\\\\' translates the forward slashes to backslashes.\n# Windows understands forward slashes, but LVCompare.exe does not.\nabspath () {\n\t(\n\t\tDIR=$(dirname \"$1\")\n\t\tFN=$(basename \"$1\")\n\t\tcd \"$DIR\"\n\t\tprintf \"%s/%s\" \"$(pwd -W)\" \"$FN\" | tr '/' '\\\\'\n\t)\n}\n\nlvcompare=\"C:\\\\Program Files (x86)\\National Instruments\\\\Shared\\\\LabVIEW Compare\\\\LVCompare.exe\"\nlocal=$(abspath \"$1\")\nremote=$(abspath \"$2\")\nexec \"$lvcompare\" -nobdpos -nofppos \"$local\" \"$remote\"\n# For the options, see http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/.\n___\n\nThis works, but the solution seems to me nontrivial.\n\nI will post this solution in Git with LabVIEW threads tomorrow, but I thought I'd see if you have any suggestions before I do that.\n\nThanks much!\n\nPaul\n\n-----Original Message-----\nFrom: David Aguilar [mailto:davvid@gmail.com]\nSent: Wednesday, March 5, 2014 1:25 AM\nTo: Paul Lotz\nCc: 'Git Mailing List'\nSubject: Re: difftool sends malformed path to exernal tool on Windows\n\nOn Mon, Mar 03, 2014 at 04:24:15PM -0700, Paul Lotz wrote:\n> David,\n> \n> OK, I did as you suggested, and the results were revealing.\n> \n> First, I replaced \"echo\" with \"cat\".  Result: The contents of both files appeared in the Git Bash Window.\n> \n> Then I tried calling LVCompare from the Git Bash and Windows Command Prompt windows with variations on the paths.\n> \n> Here are the most relevant results:\n> First from the Windows Command Prompt:\n> 1) This command works:\n> C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National \n> Instruments\\Shared\\L abVIEW Compare\\LVCompare.exe\"\n> C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl C:\\LSST_TS\\SystemSW\\M2AADT\\Typedefs\\TestStatus.ctl\n> [General note:\n> I saved a copy of the temp file and replaced the hex string with the \n> string 'Before' to make the file stick around.  The paths are \n> otherwise the same.]\n\nThis is aligns with: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/configlvcomp_thirdparty/\n\n\t\"lvcompare.exe <absolute path to VI 1> ...\"\n\nThe key thing is the mention of absolute paths.\n\nWhat is happening is that lvcompare.exe (or likely it's a Windows thing) changes its current directory to its installation directory under Progra~1.\n\nThat means the relative paths passed in by difftool won't be found.\n\nThe way to fix it is to redirect your difftool config to a script that makes all paths absolute.  This script can then call the real lvcompare.exe.\n\nYou just need to tweak the lvcompare part in your .gitconfig to look like this:\n\n[difftool \"lvcompare\"]\n\tcmd = ~/bin/lvcompare.sh \\\"$LOCAL\\\" \\\"$REMOTE\\\"\n\n\n... and install an executable lvcompare.sh shell script in in your $HOME/bin.  Something like this:\n\n#!/bin/sh\n\nabspath () {\n\t(\n\t\tcd \"$(dirname \"$1\")\" &&\n\t\tprintf \"%s/%s\" \"$(pwd)\" \"$(basename \"$1\")\"\n\t)\n}\n\nlvcompare=\"C:\\\\Program Files (x86)\\National Instruments\\\\Shared\\\\LabVIEW Compare\\\\LVCompare.exe\"\nlocal=$(abspath \"$1\")\nremote=$(abspath \"$2\")\nexec \"$lvcompare\" \"$local\" \"$remote\"\n\n> 2) C:\\LSST_TS\\SystemSW\\M2AADT>\"C:\\Program Files (x86)\\National \n> Instruments\\Shared\\L abVIEW Compare\\LVCompare.exe\"\n> C:\\Users\\Paul\\AppData\\Local\\Temp\\Typedefs_TestStat\n> us_Before.ctl Typedefs\\TestStatus.ctl\n> \n> Result: Error message with reference to C:\\Program Files \n> (x86)\\National Instruments\\Shared\\L abVIEW \n> Compare\\supportVIs\\_prolvcmp.llb\\Typedefs\\TestStatus.ctl\n> \n> Observation: The second path has to be the full path, not the relative path we get back using \"echo\".\n\nYes, that's what it looks like.\n--\nDavid\n"},{"id":"236818","messageId":"CAJDDKr7=OVF0eJQFjFqrzNvOW0K0pZfRJL+CHB32kHoJFJ_csg@mail.gmail.com","threadId":"35899","inReplyTo":"019d01cf3a1f$4ebfe5f0$ec3fb1d0$@lsst.org","subject":"Re: difftool sends malformed path to exernal tool on Windows","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2014-03-16T07:27:47Z","receivedAt":"2014-03-16T07:27:47Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Fri, Mar 7, 2014 at 8:07 AM, Paul Lotz <plotz@lsst.org> wrote:\n> David,\n>\n> I investigated further and found that \\\"$LOCAL\\\" \\\"$REMOTE\\\" return the remote and local files (reversed).  (One can easily see this in my 2/28 e-mail.)  Reversing these (\\\"$REMOTE\\\" \\\"$LOCAL\\\") does indeed reverse the output.  It is easy to work around this issue, but how can this be?\n>\n> Paul\n\nIt's probably working as intended.\n\nThe $LOCAL and $REMOTE names come from \"git mergetool\", where they\nhave better defined semantics.\n\nIn the context of a diff, where we're really comparing \"A\" and \"B\"\nthey have a little less meaning, but the behavior is well-defined.\n\nWhen you modify a file locally, the default behavior for \"git diff\" is\nto compare your working tree against the index.\n\nThe diff will show the changes that will permute the index's copy into\nthe the worktree's copy. In a sense, your modifications are the\n\"remote\" thing that is being compared against.\n\nThat's why you see a temporary file for $LOCAL (\"A\") and your\nworktree's file for $REMOTE (B).\n\nIf compare two other things, e.g. \"git difftool HEAD~3 HEAD~\" then\n$LOCAL is HEAD~3 and $REMOTE is HEAD~, and they'll all be temporary\nfiles.\n\nOne analogy is that the $LOCAL thing is the starting point and the\n$REMOTE thing is what was modified (by the merge) if you think of it\nfrom the merging perspective.\n\nSpecific tools (e.g. lvcompare) may need the arguments to be specified\nin a specific order for them to make sense, so it's perfectly\nacceptable for specific tools to require that $LOCAL and $REMOTE are\nswapped.\n\nBTW.. we went through a lot of back-and-forth getting the difftool\nsetup correct for lvcompare. In the Git source tree there's a\nmergetools/ directory where all of the built-in diff/merge tools are\ndefined. Do you think you might be able to contribute a scriptlet for\nlvcompare so that it is natively supported? That'll save future poor\nsouls from needing to rediscover the correct recipe for getting\nlvcompare working with difftool.  Just a thought.\n\ncheers,\n-- \nDavid\n"}]}