Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiffMerge requires wrapper script #11056

Closed
michaellopez opened this issue May 7, 2015 · 8 comments
Closed

DiffMerge requires wrapper script #11056

michaellopez opened this issue May 7, 2015 · 8 comments

Comments

@michaellopez
Copy link

As I have reported at SourceGear forums DiffMerge requires a wrapper script to work from command line.

My reply at SourceGear forum

The error
/build/sgdm400/Apple/intel/Release_patched/wxWidgets-3.0.0-rc1/src/common/arrstr.cpp(368): assert "nIndex < m_nCount" failed in RemoveAt(): bad index in wxArrayString::Remove is due to calling the program from the command line without a path, like having it in $PATH

ls -l | grep diffmerge
  diffmerge -> /opt/homebrew-cask/Caskroom/diffmerge/4.2.0.697/DiffMerge.app/Contents/MacOS/DiffMerge

$ /usr/local/bin/diffmerge <--- works, no error
$ /opt/homebrew-cask/Caskroom/diffmerge/4.2.0.697/DiffMerge.app/Contents/MacOS/DiffMerge <--- works, no error
$ diffmerge <--- works, but gives error

So either use absolute path when calling the program or use a small wrapper script. Save this as /usr/local/bin/diffmerge and make it executable with chmod +x /usr/local/bin/diffmerge

#!/bin/bash
/opt/homebrew-cask/Caskroom/diffmerge/4.2.0.697/DiffMerge.app/Contents/MacOS/DiffMerge $@

End reply

So I wanted to try and submit my workaround to the cask formula, but I can't figure out the best and recommended way to approach it. What I want to accomplish is making the formula create the small wrapper script above instead of binary 'DiffMerge.app/Contents/MacOS/DiffMerge', :target => 'diffmerge' which is currently does now.

@vitorgalvao
Copy link
Member

We don’t yet have a solution, but we’re discussing it. You’re welcome to join in.

@michaellopez
Copy link
Author

@vitorgalvao A SourceGear representative pointed me to a script that is included with the dmg file. But for that to work properly I would need to replace strings inside the script file to point to the files homebrew cask installs. I can't seem to find a documented way of doing this, neither in documentation or other cask formulae. Is homebrew's "inreplace" supported?

@vitorgalvao
Copy link
Member

Not sure. Pinging @phinze @ndr-qef.

@darkn3rd
Copy link

The Docs (which seem to be only applicable to DiffMerge.4.2.0.697.intel.stable.dmg):

sudo cp Extras/diffmerge.sh /usr/bin/diffmerge
sudo chmod 755 /usr/bin/diffmerge
sudo cp Extras/diffmerge.1 /usr/share/man/man1/diffmerge.1
sudo chmod 644 /usr/share/man/man1/diffmerge.1

Reference: https://sourcegear.com/diffmerge/webhelp/sec__inst__mac.html

I have been inspecting the installer package (DiffMerge.4.2.0.697.intel.stable.pkg), and noted that it has a Payload (gzip/cpio) that includes the /usr/bin/diffmerge wrapper script:

#!/bin/sh
## A little script to make it easier to launch DiffMerge from the command line.
## Install this script into a folder in your path, such as /usr/bin or /usr/local/bin.
##
## Version 4.2.0.697
## Copyright (C) 2003-2013 SourceGear LLC. All Rights Reserved.
##############################################################################

## Change DIFFMERGE_PATH to point to where you installed DiffMerge

DIFFMERGE_PATH=/Applications/DiffMerge.app

## The actual executable is hidden inside the .app bundle.

DIFFMERGE_EXE=${DIFFMERGE_PATH}/Contents/MacOS/DiffMerge

## Launch DiffMerge using the given command line arguments.  Use --help for
## additional information or see the man page distributed along with this
## shell script.

exec ${DIFFMERGE_EXE} --nosplash "$@"

Thus it looks like the manual steps that are required for the DMG installation, are performed by the PKG install.

@darkn3rd
Copy link

Note this is marked as an enhancement request. This is a BUG. Having a program not crash should not be an enhancement request.

@vitorgalvao vitorgalvao added bug Issue describing a reproducible bug. and removed enhancement labels Sep 27, 2015
@darkn3rd
Copy link

darkn3rd commented Oct 9, 2015

As a workaround for command line installations, I am recommending users at my work use until this is fixed:

curl -O http://download-us.sourcegear.com/DiffMerge/4.2.0/DiffMerge.4.2.0.697.intel.stable.pkg
sudo installer -pkg ~/Downloads/DiffMerge.4.2.0.697.intel.stable.pkg -target /

@jawshooah
Copy link
Contributor

Seems the obvious solution would be to just use the pkg installer rather than the dmg. What do you think, @vitorgalvao?

@vitorgalvao
Copy link
Member

Seems the obvious solution would be to just use the pkg installer rather than the dmg. What do you think, @vitorgalvao?

Yep, I agree.

@miccal miccal removed bug Issue describing a reproducible bug. cask labels Dec 23, 2016
@Homebrew Homebrew locked and limited conversation to collaborators May 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants