Compare commits

...
15 Commits
Author SHA1 Message Date
Jonathan Flat 4f1a3aceb1 Merge pull request #433 from apple/automerge/merge-main-2026-11-20_09-06
Merge `release/1.9.x` into `main`
2026-11-20 08:37:19 -08:00
Charles Zablit 1dc5cdc944 Merge pull request #417 from charles-zablit/cz/cmake/cmp0157
[CMake] Require CMake 3.29 to enable CMP0157
2026-11-19 12:07:29 +00:00
Guillaume Lessard 781b0cfab5 Remove testNotInSlashTmp()
This test was very dependent on details of the testing environment, and failed or succeeded according to details we don't seem to control in CI. In the end, this test was only reliable on macOS at desk. Accordingly,
we delete it.
2026-11-18 16:05:03 -08:00
hxperlandClaude Opus 5 e96ba28879 Unbacktick the target parameter name so DocC recognises it
`FileDescriptor.duplicate(as:retryOnInterrupt:)` writes its first
parameter entry as ``- `target`:`` rather than `- target:`. DocC matches
parameter documentation by the bare identifier, so the backticked entry
is not associated with the parameter: the description is dropped from
the rendered parameter list and DocC reports the parameter as
undocumented.

The `duplicate(as:options:retryOnInterrupt:)` overload twenty lines
below documents the same parameter without backticks, which is what
this changes the first overload to match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MDv2d3fEYCVWGpu7AgD4qq
2026-11-18 16:03:46 -08:00
Jonathan Flat c0e3eea428 Merge pull request #430 from apple/automerge/merge-main-2026-11-18_09-06 2026-11-18 08:37:43 -07:00
Guillaume Lessard 53b1815f41 Test pipe2 with O_CLOFORK on FreeBSD 2026-11-17 15:48:00 -08:00
Guillaume Lessard 8e71dd3e0d Fix tests when testing with an SDK mismatch 2026-11-17 15:48:00 -08:00
Rick Newton-Rogers 677e51f1f2 Bump swiftlang/github-workflows to 0.0.18
The new workflows use macOS Golden Gate rather than macOS Tahoe by default.
2026-11-17 15:48:00 -08:00
Jonathan Flat cf29202fc7 Merge pull request #427 from apple/automerge/merge-main-2026-11-15_09-05
Merge `release/1.9.x` into `main`
2026-11-15 14:00:11 -07:00
Guillaume Lessard 406f7634f1 Merge pull request #424 from heckj/fix-setuid-setgid-doc-references
Point setUserID and setGroupID docs at the chmod(2) man page
2026-11-13 16:59:55 -08:00
Joe Heck 1da023b4ca Point setUserID and setGroupID docs at the chmod(2) man page
The docs for FilePermissions.setUserID and setGroupID referred to the setuid(2) and setgid(2) man pages. Those pages describe system calls that change a process's IDs. The permission bits are documented in chmod(2) as S_ISUID and S_ISGID. This matches how saveText already refers to S_ISVTX.
2026-11-13 15:46:58 -08:00
Jonathan Flat abc83c2de1 Merge pull request #422 from apple/automerge/merge-main-2026-11-13_09-06
Merge `release/1.9.x` into `main`
2026-11-13 11:18:20 -07:00
Charles Zablit 2949c1bfcb [CI] Install CMake 4.0.2 for CMake validation 2026-11-13 16:56:07 +01:00
Charles Zablit fa6a245b37 [CMake] Require CMake 3.29 to enable CMP0157 2026-11-13 16:55:10 +01:00
Jonathan Flat 762c819b0f Merge pull request #420 from apple/automerge/merge-main-2026-11-11_09-06
Merge `release/1.9.x` into `main`
2026-11-11 10:02:22 -07:00
8 changed files with 50 additions and 25 deletions

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ on:
jobs:
create_merge_pr:
name: Create PR to merge release branch into main branch
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.17
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.18
with:
base_branch: main
head_branch: release/1.9.x
+1 -1
View File
@@ -10,7 +10,7 @@ on:
jobs:
create_merge_pr:
name: Create PR to merge previous release branch into current release branch
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.17
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.18
with:
base_branch: release/1.9.x
head_branch: release/1.8.x
+7 -4
View File
@@ -10,7 +10,7 @@ on:
jobs:
tests:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.17
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.18
with:
swift_flags: "-Xbuild-tools-swiftc -DSYSTEM_CI"
linux_os_versions: '["noble", "jammy", "focal"]'
@@ -52,7 +52,7 @@ jobs:
build-abi-stable:
name: Build ABI Stable
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.17
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.18
with:
enable_linux_checks: false
enable_macos_checks: true
@@ -75,7 +75,10 @@ jobs:
uses: actions/checkout@v6
- name: Install Dependencies
shell: bash
run: apt update && apt install -y cmake ninja-build jq
run: |
apt update && apt install -y curl ninja-build jq
curl -fsSL "https://github.com/Kitware/CMake/releases/download/v4.0.2/cmake-4.0.2-linux-$(uname -m).tar.gz" \
| tar --strip-components=1 -xz -C /usr/local
- name: Configure Project
shell: bash
run: |
@@ -102,7 +105,7 @@ jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.17
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.18
with:
license_header_check_project_name: "Swift.org"
# https://github.com/apple/swift-system/issues/224
+1 -1
View File
@@ -7,7 +7,7 @@ Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
#]]
cmake_minimum_required(VERSION 3.16.0)
cmake_minimum_required(VERSION 3.29)
project(SwiftSystem
LANGUAGES C Swift)
+1 -1
View File
@@ -381,7 +381,7 @@ extension FileDescriptor {
/// Duplicates this file descriptor and returns the newly created copy.
///
/// - Parameters:
/// - `target`: The desired target file descriptor, or `nil`, in which case
/// - target: The desired target file descriptor, or `nil`, in which case
/// the copy is assigned to the file descriptor with the lowest raw value
/// that is not currently in use by the process.
/// - retryOnInterrupt: Whether to retry the duplicate operation
+4 -2
View File
@@ -113,13 +113,15 @@ public struct FilePermissions: OptionSet, Sendable, Hashable, Codable {
/// Indicates that the file is executed as the owner.
///
/// For more information, see the `setuid(2)` man page.
/// For more information, see the `chmod(2)` man page's
/// discussion of `S_ISUID` (the set-user-ID bit).
@_alwaysEmitIntoClient
public static var setUserID: FilePermissions { .init(rawValue: 0o4000) }
/// Indicates that the file is executed as the group.
///
/// For more information, see the `setgid(2)` man page.
/// For more information, see the `chmod(2)` man page's
/// discussion of `S_ISGID` (the set-group-ID bit).
@_alwaysEmitIntoClient
public static var setGroupID: FilePermissions { .init(rawValue: 0o2000) }
+35 -6
View File
@@ -179,11 +179,12 @@ final class FileOperationsTest: XCTestCase {
}
func testAdHocPipeWithOptions() throws {
#if !SYSTEM_PACKAGE_DARWIN || canImport(Darwin, _version: 428)
guard #available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) else {
throw XCTSkip("pipe2 and PipeOptions require Darwin 27 or newer")
}
// Ad-hoc test testing `Pipe` functionality.
// We cannot test `Pipe` using `MockTestCase` because it calls `pipe` with a pointer to an array local to the `Pipe`, the address of which we do not know prior to invoking `Pipe`.
// Ad-hoc test: `MockTestCase` can't match the pointer to the local array
// that `pipe` receives, because its address isn't known in advance.
let options: FileDescriptor.PipeOptions = [.closeOnExec]
let pipe: (readEnd: FileDescriptor, writeEnd: FileDescriptor)
pipe = try FileDescriptor.pipe(options: options)
@@ -194,16 +195,20 @@ final class FileOperationsTest: XCTestCase {
_ = try pipe.writeEnd.write(UnsafeRawBufferPointer($0))
}
let readLen = 3
let readBytes = try Array<UInt8>(unsafeUninitializedCapacity: readLen) { buf, count in
let readBytes = try Array<UInt8>(unsafeUninitializedCapacity: readLen) {
buf, count in
count = try pipe.readEnd.read(into: UnsafeMutableRawBufferPointer(buf))
}
XCTAssertEqual(readBytes, Array(abc.utf8))
}
}
#else
throw XCTSkip("pipe2 requires a Darwin SDK for anyAppleOS 27 or newer")
#endif
}
#if canImport(Darwin, _version: 428) // The macOS 27 SDK defines O_CLOFORK.
func testAdHocPipeCloseOnFork() throws {
#if canImport(Darwin, _version: 428)
guard #available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) else {
throw XCTSkip("pipe2 and PipeOptions require anyAppleOS 27 or newer")
}
@@ -212,11 +217,31 @@ final class FileOperationsTest: XCTestCase {
let pipe = try FileDescriptor.pipe(options: .closeOnFork)
try pipe.readEnd.closeAfter {
try pipe.writeEnd.closeAfter {
XCTAssertEqual(fcntl(pipe.readEnd.rawValue, F_GETFD) & FD_CLOFORK, FD_CLOFORK)
let flags = fcntl(pipe.readEnd.rawValue, F_GETFD)
XCTAssertEqual(flags & FD_CLOFORK, FD_CLOFORK)
}
}
#elseif os(FreeBSD)
let pipe: (readEnd: FileDescriptor, writeEnd: FileDescriptor)
do {
pipe = try FileDescriptor.pipe(options: .closeOnFork)
} catch {
if (error as? Errno) == .invalidArgument {
throw XCTSkip("pipe2 does not support O_CLOFORK before FreeBSD 15")
}
throw error
}
try pipe.readEnd.closeAfter {
try pipe.writeEnd.closeAfter {
let flags = fcntl(pipe.readEnd.rawValue, F_GETFD)
XCTAssertEqual(flags & FD_CLOEXEC, 0)
XCTAssertNotEqual(flags, 0)
}
}
#else
throw XCTSkip("O_CLOFORK requires a Darwin SDK for anyAppleOS 27 or newer")
#endif
}
#endif
#endif // !os(WASI)
#if !os(Windows)
@@ -258,6 +283,7 @@ final class FileOperationsTest: XCTestCase {
}
func testAdHocDuplicate3() throws {
#if !SYSTEM_PACKAGE_DARWIN || canImport(Darwin, _version: 428)
guard #available(macOS 27.0, iOS 27.0, watchOS 27.0, tvOS 27.0, visionOS 27.0, *) else {
throw XCTSkip("dup3 and DuplicateOptions require Darwin 27 or newer")
}
@@ -292,6 +318,9 @@ final class FileOperationsTest: XCTestCase {
}
}
}
#else
throw XCTSkip("dup3 requires a Darwin SDK for anyAppleOS 27 or newer")
#endif
}
#endif // !os(Windows)
@@ -16,15 +16,6 @@ import XCTest
#endif
final class TemporaryPathTest: XCTestCase {
#if SYSTEM_PACKAGE_DARWIN
func testNotInSlashTmp() throws {
try withTemporaryFilePath(basename: "NotInSlashTmp") { path in
// We shouldn't be using "/tmp" on Darwin
XCTAssertNotEqual(path.components.first!, "tmp")
}
}
#endif
func testUnique() throws {
try withTemporaryFilePath(basename: "test") { path in
let strPath = String(decoding: path)