Skip to content

samba4: fix build on macOS <10.10 #28322

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aeiouaeiouaeiouaeiouaeiouaeiou
Copy link
Contributor

Closes: https://trac.macports.org/ticket/72369

Description

Type(s)
  • bugfix
  • enhancement
  • security fix
Tested on

macOS 10.6.8 10K549 x86_64
Xcode 4.2 4C199

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL in commit message?
  • checked your Portfile with port lint?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

Closes: https://trac.macports.org/ticket/72369

Co-authored-by: Sergey Fedorov <barracuda@macos-powerpc.org>
@mohd-akram
Copy link
Member

This is an ugly hack. Why not just define the value?

@aeiouaeiouaeiouaeiouaeiouaeiou
Copy link
Contributor Author

@mohd-akram #define ENOTRECOVERABLE EINVAL?

I mean that the value should signal an error and just giving it a number is not a good idea since it is not in the system (and EINVAL is the closest flag).

@aeiouaeiouaeiouaeiouaeiouaeiou
Copy link
Contributor Author

I also discovered that the hack is being used to fix the build of an outdated version of Go:

+ if runtime.GOOS == "darwin" && e1 == syscall.EBADF {
+ // On OS X 10.6 and below (but we only support
+ // >= 10.6), F_DUPFD_CLOEXEC is unsupported
+ // and fcntl there falls back (undocumented)
+ // to doing an ioctl instead, returning EBADF
+ // in this case because fd is not of the
+ // expected device fd type. Treat it as
+ // EINVAL instead, so we fall back to the
+ // normal dup path.
+ // TODO: only do this on 10.6 if we can detect 10.6
+ // cheaply.
+ e1 = syscall.EINVAL
+ }

@mohd-akram
Copy link
Member

I'm seeing this defined all the way up to macOS 10.7. So maybe just need to define _DARWIN_C_SOURCE (or _POSIX_C_SOURCE to 200809L).

@aeiouaeiouaeiouaeiouaeiouaeiou aeiouaeiouaeiouaeiouaeiouaeiou marked this pull request as draft May 3, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants