Debugging an app bundle on MacOSX

Dirk Hohndel dirk at hohndel.org
Sat Feb 9 09:53:39 PST 2013


Henrik Brautaset Aronsen <subsurface at henrik.synth.no> writes:

> I was trying to debug some stuff in Subsurface today, and stumbled upon 
> some barriers when running it as an app bundle.
>
> There are four ways of starting Subsurface:
>
> 1) Run the binary directly from the Terminal:  ./subsurface
> 2) Start the app bundle from the Terminal, with path reference:  open 
> /Applications/Subsurface.app
> 3) Start the app bundle from the Terminal, with application reference:  
> open -a Subsurface
> 4) Double-click the Subsurface icon in the /Applications folder.
>
> The app bundle was generated with "make install-macosx".
>
> Here's a simple example that I put on top of subsurface_ui_setup() in 
> macos.c:
>
>      FILE *file = fopen("/tmp/file.txt", "a+");
>      if (file != NULL) {
>          fprintf(file,"Silly test message");
>          fclose(file);
>      }
>      syslog(LOG_ERR, "Another silly test message");
>
> I had no problems when running as 1) or 2).  /tmp/file.txt was written 
> to, and so was /var/log/system.log.
>
> However, when run as 3) or 4), neither works.  Both operations fails 
> silently.
>
> Does anyone know what's going on here?  Mandatory sandboxing?  It's 
> driving me quite mad.

Wow, that does sound extremely annoying. It will make it very hard to
get debug output from people on Macs. And it makes no sense whatsoever
not to allow syslog from an app.

Do an exit(0) if file == NULL to see if the open fails already...

/D


More information about the subsurface mailing list