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

Multiple fixes and new features - see individual commit messages #109

Merged
merged 16 commits into from
Jan 20, 2025

Conversation

fhgwright
Copy link
Contributor

Notable changes:

Tested, both from repo and via temp Portfile, on:

Mac OS X 10.4.11 8S165, PPC, Xcode 2.5 8M2558
Mac OS X 10.4.11 8S2167, i386, Xcode 2.5 8M2558
Mac OS X 10.4.11 8S2167, x86_64, Xcode 2.5 8M2558
Mac OS X 10.5.8 9L31a, PPC, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, i386, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, x86_64, Xcode 3.1.4 9M2809
Mac OS X 10.5.8 9L31a, PPC (i386 Rosetta), Xcode 3.1.4 9M2809
Mac OS X 10.6.8 10K549, i386, Xcode 3.2.6 10M2518
Mac OS X 10.6.8 10K549, x86_64, Xcode 3.2.6 10M2518
Mac OS X 10.6.8 10K549, PPC (i386 Rosetta), Xcode 3.2.6 10M2518
Mac OS X 10.7.5 11G63, x86_64, Xcode 4.6.3 4H1503
OS X 10.8.5 12F2560, x86_64, Xcode 5.1.1 5B1008
OS X 10.9.5 13F1911, x86_64, Xcode 6.2 6C131e
OS X 10.10.5 14F2511, x86_64, Xcode 7.2 7C68
OS X 10.11.6 15G22010, x86_64, Xcode 8.1 8B62
macOS 10.12.6 16G2136, x86_64, Xcode 9.2 9C40b
macOS 10.13.6 17G14042, x86_64, Xcode 10.1 10B61
macOS 10.14.6 18G9323, x86_64, Xcode 11.3.1 11C505
macOS 10.15.7 19H15, x86_64, Xcode 12.4 12D4e
macOS 11.7.10 20G1427, x86_64, Xcode 13.2.1 13C100
macOS 11.7.10 20G1427, arm64, Xcode 13.2.1 13C100
macOS 12.7.6 21H1320, x86_64, Xcode 14.2 14C18
macOS 12.7.6 21H1320, arm64, Xcode 14.2 14C18
macOS 13.7.2 22H313, arm64, Xcode 15.2 15C500b
macOS 14.7.2 23H311, arm64, Xcode 16.2 16C5032a
macOS 15.2 24C101, arm64, Xcode 16.2 16C5032a

Since the NULL fsec case doesn't have the 10.4 Rosetta bug, it should
be tested separately.

Also fixes misplaced fclose() in previous fstatx_np() tests.

TESTED:
Passes on all platforms, including with Rosetta.
This provides the missing byte swap for fstatx_np() on 10.4 Rosetta.
See the comment for details.

TESTED:
Passes tests on all platforms, including 10.4 Rosetta cases.
Almost a revert of commit ba45d6c, but with conflicts fixed.

TESTED:
Without fix, fails on 10.4 Rosetta and passes on all others.
With fix, passes on all platforms, including 10.4 Rosetta.
This almost reverts commit 4e3779a, but retains the better test_flags
setup.

TESTED:
Without	fix, fails on 10.4 Rosetta and passes on all others.
With fix, passes on all platforms, including 10.4 Rosetta.
Commit 55fd6e3 rearranged the scandir/alphasort hacks such that they
could apply in the non-POSIX case, where the underlying functions are
undefined, causing bad references in the header.  This fixes that.

TESTED:
Passes all tests, including darwin_c_full, which previously got
warnings.
The declaration of renameat() is in sys/stdio.h, to match Apple's
arrangement (when it exists) in 10.10+, but Apple also includes
(directly or indirectly) sys/stdio.h from stdio.h, so we need to
duplicate that behavior to ensure that stdio.h provides renameat() as
expected.

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

TESTED:
Passes all tests, including updated renameat test.
Closes: https://trac.macports.org/ticket/61691

Since a proper implementation of clock_gettime_nsec_np() would be
significant work, and should be accompanied by some needed rework of
time.c and test_time.c in general, for now we just provide a wrapper
around clock_gettime().  This is functionally correct but suboptimal
in performance.

It also cleans up the scale factors, converting the fairly pointless
THOUSAND to a number, removing the unused MILLIONS, and replacing
BILLIONS with separate 32- and 64-bit versions, both now explictly
unsigned.

It also cleans up some include issues.

TESTED:
Passes all tests on all platforms, including added test.
Since this is currently just a wrapper around clock_gettime(), testing
a single clock_id is sufficient.  This whole test needs to be
rewritten at some point, anyway.

TESTED:
Fails where expected without newly added function.
Passes on all platforms otherwise.
Most manual tests don't need to build with the library, and prior to
this change, *no* manual tests (except the old C++ tests) built with
the library.  This adds a naming convention to allow some manual tests
to use the library, currently just the clock_settime() test.

TESTED:
Manual tests with and without the library build as expected.
Closes: https://trac.macports.org/ticket/71399

TESTED:
Passes the new (manual) test on all platforms.
This test naturally requires running as root.  It goes to considerable
lengths to avoid leaving the time screwed up if something goes wrong,
and to hide its temporary adjustment from other programs.

TESTED:
Fails where expected without the new support.
Passes on all platforms with it.
This makes the 10.6 net/if_utun.h available in <10.6, though the
relevant features may or may not actually work in <10.6.  This may
simply replace build-time errors with runtime errors, though that's
sometimes a useful change.

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

TESTED:
New test passes on all platforms with this change.
This header is normally missing from <10.6.  This test verifies that
we successfully added it.

TESTED:
Fails where expected without related fix.
Passes on all platforms with the fix.
This provides both missing prototypes and missing function wrappers
for the pthread_[f]chdir_np() functions, which were introduced as
syscalls in 10.5, but not provided as functions until 10.12, and
not provided as prototypes at all in any SDK.

At present, no SDK for any OS version provides prototypes for these
functions, even when the functions themselves are included in
libSystem.  For that reason, we condition the addition of the
prototypes on the flag _MACPORTS_LEGACY_PTHREAD_CHDIR.  This is
ignored in the 10.4 SDK, since the functions themselves are not
available in 10.4.

The missing function wrappers are provided for 10.5-10.11.  For 10.4,
dummy functions that always fail are provided, though no SDK
declarations are present in the 10.4 SDK, even with the enabling flag.

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

TESTED:
Passes all tests on all platforms, including the new test.
This verifies both that the functions set the subthread's cwd as
intended, and that the main thread's cwd is unchanged.

TESTED:
Passes on all platforms.
Spot-checked test sensitivity with manually introduced bug.
Since best_fchdir is used in multiple sources, it needs to be global,
but it shouldn't pollute the global namespace without a suitable
prefix.

TESTED:
Passes all tests on all platforms.
@fhgwright
Copy link
Contributor Author

@mascguy
Here's another round of changes. This is the remainder of what I'm intending for this release cycle (which is already woefully overdue), so the -devel update from this will be an RC version.

@mascguy mascguy merged commit d281d6a into macports:master Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants