diff --git a/.gitignore b/.gitignore index fdc63ad..d7df4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /fish-3.0.0.tar.gz /fish-3.0.2.tar.gz /fish-3.1.0.tar.gz +/fish-3.1.0.tar.gz.asc diff --git a/0001-iothread-Add-missing-cstdint-include.patch b/0001-iothread-Add-missing-cstdint-include.patch deleted file mode 100644 index a6988d3..0000000 --- a/0001-iothread-Add-missing-cstdint-include.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 24e6cfa8097b8946db51f4076b59496a658fcbf5 Mon Sep 17 00:00:00 2001 -From: Igor Raits -Date: Fri, 14 Feb 2020 20:45:19 +0100 -Subject: [PATCH] iothread: Add missing cstdint include - -This will fix build with GCC 10+. - -Fixes: https://github.com/fish-shell/fish-shell/issues/6604 -Signed-off-by: Igor Raits ---- - src/iothread.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/iothread.h b/src/iothread.h -index 5d91b2b34..64f783e87 100644 ---- a/src/iothread.h -+++ b/src/iothread.h -@@ -4,6 +4,7 @@ - - #include - -+#include - #include - #include - --- -2.25.0 - diff --git a/0001-parser-Stop-crashing-when-cwd-isn-t-readable.patch b/0001-parser-Stop-crashing-when-cwd-isn-t-readable.patch new file mode 100644 index 0000000..11aeb5d --- /dev/null +++ b/0001-parser-Stop-crashing-when-cwd-isn-t-readable.patch @@ -0,0 +1,56 @@ +From b54f5ba56e6315028186af5d9e3b914dfae5a74f Mon Sep 17 00:00:00 2001 +From: Fabian Homborg +Date: Fri, 14 Feb 2020 17:18:27 +0100 +Subject: [PATCH 1/4] parser: Stop crashing when cwd isn't readable + +Everything seems to be working, so instead of crashing just print an +error and return. + +Fixes #6597 + +(cherry picked from commit ceba851d44dea68b9e1b2b551e37fd6834767357) +--- + src/parser.cpp | 2 +- + tests/checks/init-unreadable-cwd.fish | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 1 deletion(-) + create mode 100644 tests/checks/init-unreadable-cwd.fish + +diff --git a/src/parser.cpp b/src/parser.cpp +index 381b8ac06..1eae37392 100644 +--- a/src/parser.cpp ++++ b/src/parser.cpp +@@ -85,7 +85,7 @@ parser_t::parser_t(std::shared_ptr vars) : variables(std::move(vars + int cwd = open_cloexec(".", O_RDONLY); + if (cwd < 0) { + perror("Unable to open the current working directory"); +- abort(); ++ return; + } + libdata().cwd_fd = std::make_shared(cwd); + } +diff --git a/tests/checks/init-unreadable-cwd.fish b/tests/checks/init-unreadable-cwd.fish +new file mode 100644 +index 000000000..fee220847 +--- /dev/null ++++ b/tests/checks/init-unreadable-cwd.fish +@@ -0,0 +1,17 @@ ++#RUN: %fish -C 'set -g fish %fish' %s ++# Test that fish doesn't crash if cwd is unreadable at the start (#6597) ++ ++set -l oldpwd $PWD ++set -l tmpdir (mktemp -d) ++ ++# $fish might be a relative path (e.g. "../test/root/bin/fish") ++set -l fish (builtin realpath $fish) ++cd $tmpdir ++chmod 000 . ++$fish -c 'echo Look Ma! No crashing!' ++#CHECK: Look Ma! No crashing! ++#CHECKERR: Unable to open the current working directory: Permission denied ++ ++# Careful here, Solaris' rm tests if the directory is in $PWD, so we need to cd back ++cd $oldpwd ++rmdir $tmpdir +-- +2.25.0 + diff --git a/0002-iothread-Include-cstdint.patch b/0002-iothread-Include-cstdint.patch new file mode 100644 index 0000000..f20d22b --- /dev/null +++ b/0002-iothread-Include-cstdint.patch @@ -0,0 +1,31 @@ +From ca740a87d86009badba0b4e767836eaee449e0a4 Mon Sep 17 00:00:00 2001 +From: Fabian Homborg +Date: Fri, 14 Feb 2020 20:41:17 +0100 +Subject: [PATCH 2/4] iothread: Include cstdint + +For uint64_t. + +Needed for some configurations with glibc. + +Fixes #6604. + +(cherry picked from commit d80d39dd6a0576e5923184815832b0938356530c) +--- + src/iothread.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/iothread.cpp b/src/iothread.cpp +index 21017fbe7..9e252260b 100644 +--- a/src/iothread.cpp ++++ b/src/iothread.cpp +@@ -14,6 +14,7 @@ + + #include + #include ++#include // for uint64_t + #include + #include + +-- +2.25.0 + diff --git a/0003-iothread-include-cstdint-correctly.patch b/0003-iothread-include-cstdint-correctly.patch new file mode 100644 index 0000000..0ad805a --- /dev/null +++ b/0003-iothread-include-cstdint-correctly.patch @@ -0,0 +1,44 @@ +From ebf8bc0db4a089c575e9208c07fd8ae8c869c7da Mon Sep 17 00:00:00 2001 +From: Fabian Homborg +Date: Fri, 14 Feb 2020 20:51:54 +0100 +Subject: [PATCH 3/4] iothread: include cstdint, correctly + +Yeah, this was needed in the *header*. + +God I hate headers. + +Fixes #6604, for real this time + +(cherry picked from commit f79ff7209627cc12e55cadf8b275a00ed4a378e7) +--- + src/iothread.cpp | 1 - + src/iothread.h | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/iothread.cpp b/src/iothread.cpp +index 9e252260b..21017fbe7 100644 +--- a/src/iothread.cpp ++++ b/src/iothread.cpp +@@ -14,7 +14,6 @@ + + #include + #include +-#include // for uint64_t + #include + #include + +diff --git a/src/iothread.h b/src/iothread.h +index 5d91b2b34..bdb045dfc 100644 +--- a/src/iothread.h ++++ b/src/iothread.h +@@ -4,6 +4,7 @@ + + #include + ++#include // for uint64_t + #include + #include + +-- +2.25.0 + diff --git a/0004-Fix-build-on-32-bit-systems.patch b/0004-Fix-build-on-32-bit-systems.patch new file mode 100644 index 0000000..354dfb9 --- /dev/null +++ b/0004-Fix-build-on-32-bit-systems.patch @@ -0,0 +1,35 @@ +From 4d2bb0681fab9ffa019483974a8bca8551ec5d7f Mon Sep 17 00:00:00 2001 +From: Fabian Homborg +Date: Sat, 15 Feb 2020 10:10:59 +0100 +Subject: [PATCH 4/4] Fix build on 32-bit systems + +This was a weird case of the integer converseys. + +Fixes #6609. + +(cherry picked from commit 399a71645e76ec103c32dae4caa0778b4bf57eaa) +--- + src/wutil.cpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/wutil.cpp b/src/wutil.cpp +index ea7bdf694..1d1f0764a 100644 +--- a/src/wutil.cpp ++++ b/src/wutil.cpp +@@ -305,10 +305,11 @@ int fd_check_is_remote(int fd) { + } + // Linux has constants for these like NFS_SUPER_MAGIC, SMB_SUPER_MAGIC, CIFS_MAGIC_NUMBER but + // these are in varying headers. Simply hard code them. +- switch (buf.f_type) { ++ // NOTE: The cast is necessary for 32-bit systems because of the 4-byte CIFS_MAGIC_NUMBER ++ switch ((unsigned int)buf.f_type) { + case 0x6969: // NFS_SUPER_MAGIC + case 0x517B: // SMB_SUPER_MAGIC +- case 0xFF534D42: // CIFS_MAGIC_NUMBER ++ case 0xFF534D42u: // CIFS_MAGIC_NUMBER + return 1; + default: + // Other FSes are assumed local. +-- +2.25.0 + diff --git a/fish.spec b/fish.spec index a2056b0..94f2c4a 100644 --- a/fish.spec +++ b/fish.spec @@ -27,7 +27,13 @@ Summary: Friendly interactive shell License: GPLv2 and BSD and ISC and LGPLv2+ and MIT URL: https://fishshell.com Source0: https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.gz -Patch0001: 0001-iothread-Add-missing-cstdint-include.patch +Source1: https://github.com/fish-shell/fish-shell/releases/download/%{version}/%{name}-%{version}.tar.gz.asc +Source2: gpgkey-003837986104878835FA516D7A67D962D88A709A.gpg +# Backported from upstream +Patch0001: 0001-parser-Stop-crashing-when-cwd-isn-t-readable.patch +Patch0002: 0002-iothread-Include-cstdint.patch +Patch0003: 0003-iothread-include-cstdint-correctly.patch +Patch0004: 0004-Fix-build-on-32-bit-systems.patch BuildRequires: cmake >= 3.2 BuildRequires: ninja-build @@ -37,6 +43,7 @@ BuildRequires: gettext BuildRequires: doxygen BuildRequires: ncurses-devel BuildRequires: pcre2-devel +BuildRequires: gnupg2 BuildRequires: python3-devel %global __python %{__python3} @@ -55,6 +62,7 @@ nothing to learn or configure. %prep %autosetup -p1 +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' rm -vrf pcre2-* # Change the bundled scripts to invoke the python binary directly. diff --git a/gpgkey-003837986104878835FA516D7A67D962D88A709A.gpg b/gpgkey-003837986104878835FA516D7A67D962D88A709A.gpg new file mode 100644 index 0000000..79c7b47 Binary files /dev/null and b/gpgkey-003837986104878835FA516D7A67D962D88A709A.gpg differ diff --git a/sources b/sources index 4092e8b..4a1d631 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (fish-3.1.0.tar.gz) = 143e462b5329790fa9834e135109e1397c3525756a0209d0ec68a53f7d2a1f581cd45fbbdcde6a5b53dff447da18ed6a62277993d851e7b18ef7f1a6b6d49cff +SHA512 (fish-3.1.0.tar.gz.asc) = 7d99a513653298ea1866445bb9a29f5c6844f49ab6354993eee4416d427061926b351ecf511ac53692feafa73878a473a80c8122d3d9f240789797e0708807f4