auriamg / macdylibbundler

Utility to ease bundling libraries into executables for OSX
MIT License
550 stars 83 forks source link

Craps out on app binaries with multiple words. #2

Closed dtakeda closed 3 years ago

dtakeda commented 10 years ago

I created an app with a binary with two names. The space in the app name is escaped, however when I run a tool it doesn't seem to like spaces.

tag4800:macdylibbundler dtakeda$ ./dylibbundler -od -b -x ~/Desktop/Waveform\ Maker.app/Contents/MacOS/Waveform\ Maker -d ~/Desktop/Waveform\ Maker.app/Contents/libs
* Collecting dependencieserror: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /Users/dtakeda/Desktop/Waveform (No such file or directory)
auriamg commented 10 years ago

I don't really have the time to check that properly myself, but if you wish to take a look yourself, in method "void collectDependencies", the code reads like

 std::string cmd = "otool -L " + filename; 

It would probably be pretty straightforward to add quotes there. Something like

 std::string cmd = "otool -L \"" + filename + "\""; 

Want to test it? I don't have a test setup at hand

dtakeda commented 10 years ago

I'll give it a shot if I have time later today.

neverpanic commented 10 years ago

That should really use a proper shell escaping function rather than just quotes though – next would be somebody that wants to use quotes in his application name and you've got the same problem again.

dtakeda commented 10 years ago

Well I finally got around to testing.

tag4800:macdylibbundler dtakeda$ ./dylibbundler -od -b -x ~/Waveform\ Maker.app/Contents/MacOS/Waveform\ Maker -d ~/Waveform\ Maker.app/Contents/libs
* Collecting dependencies...............error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: /opt/local/lib/libcrypto.1.0.0.dylib  (No such file or directory)
Cannot find file /opt/local/lib/libcrypto.1.0.0.dylib  to read its dependencies
tag4800:macdylibbundler dtakeda$ ls -alh /opt/local/lib/libcrypto.1.0.0.dylib 
-r-xr-xr-x  1 root  admin   1.5M Jun  5 09:55 /opt/local/lib/libcrypto.1.0.0.dylib

Time to relearn C++ to do proper shell escaping.

dtakeda commented 10 years ago

Well it turns out the filename has a space at the end. cmd:otool -L "/opt/local/lib/libcrypto.1.0.0.dylib "

SCG82 commented 3 years ago

fixed in #53