about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/swift/swiftpm
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-20 12:31:50 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-20 12:32:25 +0100
commitb7baf40e099b4215181fe7b0c63083b12ef2c7fb (patch)
treea6efabd31d05b6d0a36624729e80377bbbfb0149 /nixpkgs/pkgs/development/compilers/swift/swiftpm
parent710028664e26e85cb831a869b3da9f6993902255 (diff)
parent0799f514b1cd74878174939df79ac60ca5036673 (diff)
downloadnixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.gz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.bz2
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.lz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.xz
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.tar.zst
nixlib-b7baf40e099b4215181fe7b0c63083b12ef2c7fb.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/swift/swiftpm')
-rw-r--r--nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix5
-rw-r--r--nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch33
2 files changed, 38 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix b/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix
index e98d82d0d796..4a7a4ab63cce 100644
--- a/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix
+++ b/nixpkgs/pkgs/development/compilers/swift/swiftpm/default.nix
@@ -199,6 +199,10 @@ let
     name = "swift-tools-support-core";
     src = generated.sources.swift-tools-support-core;
 
+    patches = [
+      ./patches/force-unwrap-file-handles.patch
+    ];
+
     buildInputs = [
       swift-system
       sqlite
@@ -385,6 +389,7 @@ in stdenv.mkDerivation (commonAttrs // {
     swiftpmMakeMutable swift-tools-support-core
     substituteInPlace .build/checkouts/swift-tools-support-core/Sources/TSCTestSupport/XCTestCasePerf.swift \
       --replace 'canImport(Darwin)' 'false'
+    patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch}
 
     # Prevent a warning about SDK directories we don't have.
     swiftpmMakeMutable swift-driver
diff --git a/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch b/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch
new file mode 100644
index 000000000000..a2f2d38c37c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/swift/swiftpm/patches/force-unwrap-file-handles.patch
@@ -0,0 +1,33 @@
+From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001
+From: Pavel Sobolev <paveloom@riseup.net>
+Date: Tue, 21 Nov 2023 20:53:33 +0300
+Subject: [PATCH] Force-unwrap file handles.
+
+---
+ Sources/TSCBasic/FileSystem.swift | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Sources/TSCBasic/FileSystem.swift b/Sources/TSCBasic/FileSystem.swift
+index 3a63bdf..a1f3d9d 100644
+--- a/Sources/TSCBasic/FileSystem.swift
++++ b/Sources/TSCBasic/FileSystem.swift
+@@ -425,7 +425,7 @@ private class LocalFileSystem: FileSystem {
+         if fp == nil {
+             throw FileSystemError(errno: errno, path)
+         }
+-        defer { fclose(fp) }
++        defer { fclose(fp!) }
+
+         // Read the data one block at a time.
+         let data = BufferedOutputByteStream()
+@@ -455,7 +455,7 @@ private class LocalFileSystem: FileSystem {
+         if fp == nil {
+             throw FileSystemError(errno: errno, path)
+         }
+-        defer { fclose(fp) }
++        defer { fclose(fp!) }
+
+         // Write the data in one chunk.
+         var contents = bytes.contents
+--
+2.42.0