Subject: bug#21573: (no subject)

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Sun, 06 Dec 2015 15:28:52 +0900

>>>>> On Thu, 03 Dec 2015 15:23:41 +0300, Alexander Zhukov <[email-masked]> said:

> Yes, it's OS X specific. Even more, it's seems to be specific to my
> machine and the author of the original bug. I have reported this bug
> to magit initially and so far nobody with OS X machines was able to
> reproduce the bug.

I could reproduce it with the Mac port as well as the NS port on OS X
10.11.  It seems that faccessat (AT_CWD, "pathToExecutable/.", F_OK,
AT_EACCESS) returns 0 after the call to -[NSWindow
setRepresentedFilename:@"pathToExecutable"], which sets the proxy icon
on the title bar.  If you compile the source (faccessattest.m) at the
end of this mail with $ cc faccessattest.m -framework Cocoa, and run
it with $ ./a.out, then the output becomes

-1
0

rather than expected

-1
-1

I've just sent a bug report to Apple.

				     YAMAMOTO Mitsuharu
				[email-masked]

#import <Cocoa/Cocoa.h>

int main (int argc, char *argv[])
{
  char *name, *nameWithSlashDot;

  name = argv[argc - 1];
  nameWithSlashDot = alloca (strlen (name) + sizeof ("/."));
  sprintf (nameWithSlashDot, "%s/.", name);

  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  NSWindow *window = [[[NSWindow alloc] init] autorelease];

  printf ("%d\n", faccessat (AT_FDCWD, nameWithSlashDot, F_OK, AT_EACCESS));
  [window setRepresentedFilename:[NSString stringWithUTF8String:name]];
  printf ("%d\n", faccessat (AT_FDCWD, nameWithSlashDot, F_OK, AT_EACCESS));

  [pool release];
}