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

Fix to include correct Availability.h header #40

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

subpop
Copy link
Contributor

@subpop subpop commented Feb 3, 2024

I believe I have discovered a very peculiar bug related to header names. First, a little background. The default filesystem on macOS Is a case-insensitive, case-preserving filesystem. This means that two files sharing the same case-insensitive name cannot exist in the same directory. For example, a directory cannot contain a filed named Test.txt and test.txt; they are, in fact, the same file. This is evident from the output of the "stat" command:

% stat -f %i Test.txt
28557750
% stat -f %i test.txt
28557750

HFS and APFS can optionally be configured in a case-sensitive mode. Unlike the default case-insensitive, case-preserving mode, the file "Test.txt" and "test.txt" are uniquely separate inodes. If you have access to a case-sensitive filesystem, give it a try.

Now, I discovered that while packaging socket_vmnet for MacPorts, the port compiled successfully on my local system, but failed to compile on the MacPorts build systems. Thanks to some very clever MacPorts developers, it was disclosed that the MacPorts build systems use case-sensitive filesystems.

In cli.c, line 8, includes "availability.h". In actuality, the OS X SDK includes a file named "Availability.h" (not "availability.h"). On case-insensitive, case-preserving filesystems, this incorrect #include statement inadvertently still works due to the case-insensitivity. But it fails on case-sensitive filesystems.

This PR edits the #include statement to include the file name as it is declared in the SDK: Availability.h.

The OS X SDK includes a file named
"Availability.h". This file defines the  macro
__MAC_OS_X_VERSION_MAX_ALLOWED. However, the file
was being imported as "availability.h". On
case-insensitive, case-preserving filesystems,
this name discrepancy is not a problem, but when
compiling on a case-sensitive filesystem, the
compiler fails to find a file named
"availability.h". Include the correct,
case-sensitive filename instead.

Signed-off-by: Link Dupont <[email protected]>
Copy link
Member

@jandubois jandubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@AkihiroSuda
Copy link
Member

Thanks

@AkihiroSuda AkihiroSuda added this to the v1.1.3 milestone Feb 15, 2024
@AkihiroSuda AkihiroSuda merged commit 2fb4f3c into lima-vm:master Feb 15, 2024
5 checks passed
@subpop subpop deleted the availability-header branch February 15, 2024 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants