From d231730525f543e661a8be96b832b714d5d52faa Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Fri, 12 Jan 2024 18:53:58 +0000 Subject: sourcekit-lsp: force-unwrap file handles in `swift-tools-support-core` --- .../compilers/swift/sourcekit-lsp/default.nix | 3 ++ .../patches/force-unwrap-file-handles.patch | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch (limited to 'pkgs/development/compilers/swift') diff --git a/pkgs/development/compilers/swift/sourcekit-lsp/default.nix b/pkgs/development/compilers/swift/sourcekit-lsp/default.nix index 5cf928dc424b3..caba3e3441f3e 100644 --- a/pkgs/development/compilers/swift/sourcekit-lsp/default.nix +++ b/pkgs/development/compilers/swift/sourcekit-lsp/default.nix @@ -40,6 +40,9 @@ stdenv.mkDerivation { swiftpmMakeMutable indexstore-db patch -p1 -d .build/checkouts/indexstore-db -i ${./patches/indexstore-db-macos-target.patch} + swiftpmMakeMutable swift-tools-support-core + patch -p1 -d .build/checkouts/swift-tools-support-core -i ${./patches/force-unwrap-file-handles.patch} + # This toggles a section specific to Xcode XCTest, which doesn't work on # Darwin, where we also use swift-corelibs-xctest. substituteInPlace Sources/LSPTestSupport/PerfTestCase.swift \ diff --git a/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch b/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch new file mode 100644 index 0000000000000..a2f2d38c37c81 --- /dev/null +++ b/pkgs/development/compilers/swift/sourcekit-lsp/patches/force-unwrap-file-handles.patch @@ -0,0 +1,33 @@ +From 8d9ab4b6ed24a97e8af0cc338a52aacdcf438b8c Mon Sep 17 00:00:00 2001 +From: Pavel Sobolev +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 -- cgit 1.4.1