Announcement

Collapse
No announcement yet.

New Updates in Windows WSL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Updates in Windows WSL

    New features deployed with the Linux subsystem for windows should now make it possible for BC4 to work with the WSL.

    https://docs.microsoft.com/en-us/win...aries-from-wsl

    It is now possible to invoke EXE's from bash. For example you can activate BC4 like so:

    Code:
    tom@ws2:~$ /mnt/c/Program\ Files/Beyond\ Compare\ 4/bcomp.exe
    Notice the escaped spaces in the above command. Simply copy and paste this and you'll see that BC4 opens.

    The opposite is now true as well:
    Code:
    C:\temp> wsl sudo apt-get update
    The above invokes the command just as if you were in bash itself.

    Do these changes warrant looking into this again?

  • #2
    To clarify earlier posts about Windows Subsystem for Linux (WSL), Scooter Software doesn't officially support running Beyond Compare for Linux in WSL. Microsoft also doesn't officially support running graphical (X-Window) applications using WSL. You might be able to make BC4 Linux work if you run an X-Window client, but it isn't a configuration we test, so we can't guarantee it will work. See the previous forum thread Installing Linux BC4 under WSL for a possible method to run BC4 Linux in WSL.

    Beyond Compare for Windows doesn't support Linux/Unix style paths, so that's the main issue with launching it from Git in WSL. I haven't had time to test the instructions yet, but the blog post WSL, git, and Beyond Compare might point you in the direction of a working Git in WSL + BC 4 Windows configuration.
    Chris K Scooter Software

    Comment


    • #3
      The blog post above that Chris mentioned, WSL, git and Beyond Compare worked great with the exception that I had to modify the alias to execute git difftool -y --dir-diff --no-symlinks --tool=BCompare

      Comment


      • #4
        I just added a comment in regards to using Beyond Compare with Windows / Bash. Basically to solve the problem I used a handy script to convert the file paths from POSIX to Windows which could then be given to Beyond Compare. I just need to tinker a little so that the /tmp/ path was converted correctly (see issue #7 on that github repo).

        https://www.scootersoftware.com/vbul...6717#post56717

        Comment


        • #5
          Just adding my two cents here. The only blocker issue for me not to buy BC4 currently is the way it is broken with WSL.

          WSL currently supports starting Windows apps from Linux, and starting Linux apps from Windows. It also supports accessing Linux files from Windows, and accessing Windows files from Linux.

          I store my git repositories in Linux filesystem (in WSL), and regularly run git difftool or git mergetool from there, and also manually launch diff tools from there.

          In p4merge for example, or most other Windows apps, I can just give the normal linux path as an argument and everything works. Like this:
          Code:
          ~$ p4merge.exe fileA fileB
          or
          Code:
          ~$ p4merge.exe /tmp/fileA /tmp/fileB
          However for some reason the first one works but the last one does not work with BC4. The first slash breaks it, all relative paths work but using any absolute path doesn't work. This makes it difficult to launch BC4 from scripts or git.

          I know WSL isn't officially supported by BC4, but BC4 really is the only Windows app I've noticed to not work when launched from WSL with absolute path to a linux file as an argument, so this seems like a bug in BC4.

          The workaround at blog post "WSL, git, and Beyond Compare" doesn't work for me, as I don't store my git repository in Windows filesystem.

          Comment


          • #6
            Thanks for the feedback and additional example cases. I'll add this usecase to our wishlist entry on the subject. Does the above helper script to convert paths help?
            Aaron P Scooter Software

            Comment


            • #7
              Thanks for a quick reply. If you are referring to https://github.com/laurent22/wslpath - no, I don't think so. If I understand correctly it should convert the path if the file actually is on Windows FS but command is launched from Linux, which means this as an example:
              Actual storage of an example file:
              Code:
              C:\fileA
              Path shown in Linux:
              Code:
              /mnt/c/fileA
              Command to run in Linux:
              Code:
              BComp.exe $(wslpath /mnt/c/fileA)
              Which would translate to
              Code:
              BComp.exe C:\fileA
              So when working with Windows files from Linux, this script converts the paths to native Windows paths.

              However in my use case the files are in Linux filesystem, not in Windows. WSL natively converts those paths to Windows paths under \\wsl$\ so they shouldn't need any other conversion. \\wsl$\ is the new feature in recent Windows versions which allows Windows apps to see files under the Linux filesystem. It should show up as a kind of a network share. More info on that: https://devblogs.microsoft.com/comma...-version-1903/

              Comment


              • #8
                Ah, thanks for the clarification and helpful resource links. I'll add these references to our tracker as well.
                Aaron P Scooter Software

                Comment


                • #9
                  An update, I managed to get it working using the built-in wslpath command which comes with new WSL versions!

                  My git config on WSL linux side:

                  Code:
                  difftool.bc3.cmd=BComp.exe "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)"
                  mergetool.bc3.cmd=BComp.exe "$(wslpath -aw $LOCAL)" "$(wslpath -aw $REMOTE)" "$(wslpath -aw $BASE)" "$(wslpath -aw $MERGED)"
                  BComp.exe is in my $PATH. I'm using WSL2 on Windows version 2004 (build 19041), and this works both inside the WSL filesystem and also for the mounted Windows filesystem.

                  The new wslpath -aw converts the Linux paths like this:
                  Code:
                  $ wslpath -aw /home/
                  \\wsl$\Debian\home
                  And Windows paths like this:
                  Code:
                  $ wslpath -aw /mnt/c/Users/
                  C:\Users
                  This makes them both work perfectly with the Windows version of BC when launched from Linux.

                  Comment

                  Working...
                  X