From 5796d72f12092c130663393707fb15a7036f4570 Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 18 Dec 2024 17:15:34 +0100 Subject: [PATCH] bump(main/fish): 4.0.0 - build ctermid - add custom libc crate patch for 32bit android builds - backport FindRust.cmake rustup fix This backports: https://github.com/fish-shell/fish-shell/commit/b38551dde9daaab501b4f20d5d16a65bef9fa43f Co-authored-by: Jia Yuan Lo Co-authored-by: Yaksh Bariya Co-authored-by: Robert Kirkman Co-authored-by: AminurAlam <64137875+AminurAlam@users.noreply.github.com> --- packages/fish/CMakeLists.txt.patch | 23 --- packages/fish/Cargo.toml.patch | 11 ++ packages/fish/WIFSTOPPED.patch | 13 -- .../apt-autocompletion-sources-paths.patch | 12 -- .../fish/backport-cmake-FindRust.cmake.patch | 45 ++++++ packages/fish/build.rs.patch | 13 ++ packages/fish/build.sh | 69 +++++--- .../fish/create_manpage_completions.py.patch | 12 -- packages/fish/ctermid.c | 33 ++++ ...bc-src-unix-linux_like-android-mod.rs.diff | 95 +++++++++++ .../libc-src-unix-linux_like-android.diff | 153 ++++++++++++++++++ ...tions-__fish_print_apt_packages.fish.patch | 19 --- packages/fish/src-fish.cpp.patch | 12 -- packages/fish/src-path.cpp.patch | 59 ------- 14 files changed, 393 insertions(+), 176 deletions(-) delete mode 100644 packages/fish/CMakeLists.txt.patch create mode 100644 packages/fish/Cargo.toml.patch delete mode 100644 packages/fish/WIFSTOPPED.patch delete mode 100644 packages/fish/apt-autocompletion-sources-paths.patch create mode 100644 packages/fish/backport-cmake-FindRust.cmake.patch create mode 100644 packages/fish/build.rs.patch delete mode 100644 packages/fish/create_manpage_completions.py.patch create mode 100644 packages/fish/ctermid.c create mode 100644 packages/fish/libc-src-unix-linux_like-android-mod.rs.diff create mode 100644 packages/fish/libc-src-unix-linux_like-android.diff delete mode 100644 packages/fish/share-functions-__fish_print_apt_packages.fish.patch delete mode 100644 packages/fish/src-fish.cpp.patch delete mode 100644 packages/fish/src-path.cpp.patch diff --git a/packages/fish/CMakeLists.txt.patch b/packages/fish/CMakeLists.txt.patch deleted file mode 100644 index a2a6c486da8ea94..000000000000000 --- a/packages/fish/CMakeLists.txt.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ./CMakeLists.txt 2021-07-04 13:00:34.583855568 +0530 -+++ ./CMakeLists.txt.mod 2021-07-04 13:01:48.993855539 +0530 -@@ -30,11 +30,6 @@ - set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}") - endif() - --# Error out when linking statically, it doesn't work. --if (CMAKE_EXE_LINKER_FLAGS MATCHES ".*-static.*") -- message(FATAL_ERROR "Fish does not support static linking") --endif() -- - # Force colored warnings in Ninja's output, if the compiler has -fdiagnostics-color support. - # Rationale in https://github.com/ninja-build/ninja/issues/814 - if (CMAKE_GENERATOR STREQUAL "Ninja" AND -@@ -185,7 +180,7 @@ - target_sources(fishlib PRIVATE ${FISH_HEADERS}) - target_link_libraries(fishlib - ${CURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY} Threads::Threads ${CMAKE_DL_LIBS} -- ${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY}) -+ ${PCRE2_LIB} ${Intl_LIBRARIES} ${ATOMIC_LIBRARY} -landroid-spawn) - target_include_directories(fishlib PRIVATE - ${CURSES_INCLUDE_DIRS}) - diff --git a/packages/fish/Cargo.toml.patch b/packages/fish/Cargo.toml.patch new file mode 100644 index 000000000000000..e6016504847ae79 --- /dev/null +++ b/packages/fish/Cargo.toml.patch @@ -0,0 +1,11 @@ +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -31,7 +31,7 @@ + bitflags = "2.5.0" + errno = "0.3.0" + lazy_static = "1.4.0" +-libc = "0.2.155" ++libc = "0.2.170" + # lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo. + # disabling default features uses the stdlib instead, but it doubles the time to rewrite the history + # files as of 22 April 2024. diff --git a/packages/fish/WIFSTOPPED.patch b/packages/fish/WIFSTOPPED.patch deleted file mode 100644 index 26d7aacd57d305c..000000000000000 --- a/packages/fish/WIFSTOPPED.patch +++ /dev/null @@ -1,13 +0,0 @@ -https://github.com/termux/termux-packages/issues/15677 - ---- a/src/proc.h -+++ b/src/proc.h -@@ -117,7 +117,7 @@ - } - - /// \return if we are stopped (as in SIGSTOP). -- bool stopped() const { return WIFSTOPPED(status_); } -+ bool stopped() const { return WIFSTOPPED(status_) && !WIFCONTINUED(status_); } - - /// \return if we are continued (as in SIGCONT). - bool continued() const { return WIFCONTINUED(status_); } diff --git a/packages/fish/apt-autocompletion-sources-paths.patch b/packages/fish/apt-autocompletion-sources-paths.patch deleted file mode 100644 index 63f5eefe9637411..000000000000000 --- a/packages/fish/apt-autocompletion-sources-paths.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff '--color=auto' -uNr fish-3.7.1/share/completions/apt.fish fish-3.7.1.mod/share/completions/apt.fish ---- fish-3.7.1/share/completions/apt.fish 2024-03-19 11:40:45.000000000 +0800 -+++ fish-3.7.1.mod/share/completions/apt.fish 2024-04-02 19:37:37.743032486 +0800 -@@ -28,7 +28,7 @@ - # but /etc/apt/sources.list.d/ may or may not contain any files so using a fish - # wildcard glob may complain loudly if no files match the pattern so we use `find`. - # The trailing `sort -u` is largely decorative. -- cat (find /etc/apt/sources.list /etc/apt/sources.list.d/ -name "*.list") | string replace -rf '^\s*deb *(?:\[.*?\])? (?:[^ ]+) +([^ ]+) .*' '$1' | sort -u -+ cat (find @TERMUX_PREFIX@/etc/apt/sources.list @TERMUX_PREFIX@/etc/apt/sources.list.d/ -name "*.list") | string replace -rf '^\s*deb *(?:\[.*?\])? (?:[^ ]+) +([^ ]+) .*' '$1' | sort -u - end - - complete -c apt -f diff --git a/packages/fish/backport-cmake-FindRust.cmake.patch b/packages/fish/backport-cmake-FindRust.cmake.patch new file mode 100644 index 000000000000000..78db84222325cfa --- /dev/null +++ b/packages/fish/backport-cmake-FindRust.cmake.patch @@ -0,0 +1,45 @@ +From b38551dde9daaab501b4f20d5d16a65bef9fa43f Mon Sep 17 00:00:00 2001 +From: Peter Ammon +Date: Wed, 5 Mar 2025 21:37:21 -0800 +Subject: [PATCH] Drag FindRust.cmake back into the land of the living + +rustup has changed its output for 'rustup toolchain list --verbose`. +Teach FindRust.cmake about it, so that it may shamble on. + +This was reported against BSD and also affects macOS and ALSO affects Linux; our +CI just doesn't have a new enough rustup. Anyways we can't have nice things. +--- + cmake/FindRust.cmake | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake +index cf68c4e27a21..493104accad5 100644 +--- a/cmake/FindRust.cmake ++++ b/cmake/FindRust.cmake +@@ -306,18 +306,23 @@ if (Rust_RESOLVE_RUSTUP_TOOLCHAINS) + set(_DISCOVERED_TOOLCHAINS_VERSION "") + + foreach(_TOOLCHAIN_RAW ${_TOOLCHAINS_RAW}) +- if (_TOOLCHAIN_RAW MATCHES "([a-zA-Z0-9\\._\\-]+)[ \t\r\n]?(\\(default\\) \\(override\\)|\\(default\\)|\\(override\\))?[ \t\r\n]+(.+)") ++ # We're going to try to parse the output of `rustup toolchain list --verbose`. ++ # We expect output like this: ++ # stable-random-toolchain-junk (parenthesized-random-stuff-like-active-or-default) /path/to/toolchain/blah/more-blah ++ # In the following regex, we capture the toolchain name, any parenthesized stuff, and then the path. ++ message(STATUS "Parsing toolchain: ${_TOOLCHAIN_RAW}") ++ if (_TOOLCHAIN_RAW MATCHES "([^\t ]+)[\t ]*(\\(.*\\))?[\t ]*(.+)") + set(_TOOLCHAIN "${CMAKE_MATCH_1}") + set(_TOOLCHAIN_TYPE "${CMAKE_MATCH_2}") + + set(_TOOLCHAIN_PATH "${CMAKE_MATCH_3}") + set(_TOOLCHAIN_${_TOOLCHAIN}_PATH "${CMAKE_MATCH_3}") + +- if (_TOOLCHAIN_TYPE MATCHES ".*\\(default\\).*") ++ if (_TOOLCHAIN_TYPE MATCHES "default") + set(_TOOLCHAIN_DEFAULT "${_TOOLCHAIN}") + endif() + +- if (_TOOLCHAIN_TYPE MATCHES ".*\\(override\\).*") ++ if (_TOOLCHAIN_TYPE MATCHES "override") + set(_TOOLCHAIN_OVERRIDE "${_TOOLCHAIN}") + endif() + diff --git a/packages/fish/build.rs.patch b/packages/fish/build.rs.patch new file mode 100644 index 000000000000000..cce59a753483562 --- /dev/null +++ b/packages/fish/build.rs.patch @@ -0,0 +1,13 @@ +--- a/build.rs ++++ b/build.rs +@@ -96,7 +96,9 @@ fn detect_cfgs(target: &mut Target) { + Ok(target.has_symbol("localeconv_l")) + }), + ("FISH_USE_POSIX_SPAWN", &|target| { +- Ok(target.has_header("spawn.h")) ++ // the command 'fish -c "uname"', and most other uses of fish's -c argument, ++ // are not working if this is enabled. ++ Ok(false) + }), + ("HAVE_PIPE2", &|target| { + Ok(target.has_symbol("pipe2")) diff --git a/packages/fish/build.sh b/packages/fish/build.sh index 2789c1dbfb66db0..acbd7cf8c647e18 100644 --- a/packages/fish/build.sh +++ b/packages/fish/build.sh @@ -2,10 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://fishshell.com/ TERMUX_PKG_DESCRIPTION="The user-friendly command line shell" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="3.7.1" -TERMUX_PKG_REVISION=2 +TERMUX_PKG_VERSION="4.0.0" TERMUX_PKG_SRCURL=https://github.com/fish-shell/fish-shell/releases/download/$TERMUX_PKG_VERSION/fish-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=614c9f5643cd0799df391395fa6bbc3649427bb839722ce3b114d3bbc1a3b250 +TERMUX_PKG_SHA256=2fda5bd970357064d8d4c896e08285ba59965ca2a8c4829ca8a82bf3b89c69f3 TERMUX_PKG_AUTO_UPDATE=true # fish calls 'tput' from ncurses-utils, at least when cancelling (Ctrl+C) a command line. # man is needed since fish calls apropos during command completion. @@ -13,33 +12,51 @@ TERMUX_PKG_DEPENDS="bc, libandroid-support, libandroid-spawn, libc++, ncurses, n TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DBUILD_DOCS=OFF +-DFISH_USE_SYSTEM_PCRE2=ON +-DMAC_CODESIGN_ID=OFF +-DWITH_GETTEXT=OFF " termux_step_pre_configure() { - # fish releases tarballs that conflict with the way the toolchain - # currently is by putting a file in the tarball - # named "version" (not visible directly in the source code on github, - # generated by this code in fish's release workflow: - # https://github.com/fish-shell/fish-shell/blob/master/build_tools/make_tarball.sh#L69 ) - # and, crucially, also placing the folder containing that file named "version" - # in the include path of building fish (since right next to this in the same folder, - # fish does have a file named "config.h" that it uses) - # here is the upstream, conflicting instance of file in internal llvm - # include path named "version" that is probably what propogates into the NDK's - # equivalent file, - # /home/builder/.termux-build/_cache/android-r27b-api-24-v1/sysroot/usr/include/c++/v1/version - # https://github.com/llvm/llvm-project/blob/main/libcxx/include/version - mv version fish_version - find build_tools -type f -exec sed -i {} \ - -e 's/cat version/cat fish_version/g' \ - -e 's/test -f version/test -f fish_version/g' \; - CXXFLAGS+=" $CPPFLAGS" + termux_setup_cmake + termux_setup_ninja + termux_setup_rust + + # FindRust.cmake auto pick thumbv7neon-linux-androideabi + [[ "${TERMUX_ARCH}" == "arm" ]] && TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DCMAKE_ANDROID_ARM_MODE=ON" + + # older than Android 8 dont have ctermid + "${CC}" ${CPPFLAGS} ${CFLAGS} -c ${TERMUX_PKG_BUILDER_DIR}/ctermid.c + "${AR}" cru libctermid.a ctermid.o + + # cmake invokes rustc directly leaving CARGO_TARGET_*_RUSTFLAGS unused + local -u env_host="${CARGO_TARGET_NAME//-/_}" + export RUSTFLAGS=$(env | grep CARGO_TARGET_${env_host}_RUSTFLAGS | cut -d'=' -f2-) + RUSTFLAGS+=" -C link-arg=-landroid-spawn" + RUSTFLAGS+=" -L${TERMUX_PKG_BUILDDIR} -C link-arg=-l:libctermid.a" + + : "${CARGO_HOME:=${HOME}/.cargo}" + export CARGO_HOME + + rm -rf "$CARGO_HOME"/registry/src/*/libc-* + cargo fetch --target "${CARGO_TARGET_NAME}" + + local libc p + for libc in "${CARGO_HOME}"/registry/src/*/libc-*; do + for p in "${TERMUX_PKG_BUILDER_DIR}"/libc-*.diff; do + [[ -f "${p}" ]] && patch -p1 -d "${libc}" -i "${p}" || termux_error_exit "fish: failed to apply patch '$p'" + done + done } termux_step_post_make_install() { - cat >> $TERMUX_PREFIX/etc/fish/config.fish <> "$TERMUX_PREFIX/etc/fish/config.fish" <<-EOF + function __fish_command_not_found_handler --on-event fish_command_not_found + $TERMUX_PREFIX/libexec/termux/command-not-found \$argv[1] + end + EOF +} + +termux_step_post_massage() { + rm -rf "$CARGO_HOME"/registry/src/*/libc-* } diff --git a/packages/fish/create_manpage_completions.py.patch b/packages/fish/create_manpage_completions.py.patch deleted file mode 100644 index b3f31e7abc2ebd8..000000000000000 --- a/packages/fish/create_manpage_completions.py.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -u -r ../fish-3.2.0/share/tools/create_manpage_completions.py ./share/tools/create_manpage_completions.py ---- ../fish-3.2.0/share/tools/create_manpage_completions.py.o 2021-03-18 00:14:41.517297567 +0530 -+++ ./share/tools/create_manpage_completions.py 2021-03-18 00:44:55.699988162 +0530 -@@ -971,7 +971,7 @@ - def get_paths_from_man_locations(): - # Return all the paths to man(1) and man(8) files in the manpath - -- parent_paths = [] -+ parent_paths = ["@TERMUX_PREFIX@/share/man"] - - # Most (GNU, macOS, Haiku) modern implementations of man support being called with `--path`. - # Traditional implementations require a second `manpath` program: examples include FreeBSD and Solaris. diff --git a/packages/fish/ctermid.c b/packages/fish/ctermid.c new file mode 100644 index 000000000000000..4efdbec3152f801 --- /dev/null +++ b/packages/fish/ctermid.c @@ -0,0 +1,33 @@ +/* +Copyright © 2005-2020 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// redefine ctermid since ndk-patches/*/stdio.h.patch inline ctermid +#define ctermid ctermid_orig +#include +#include +#undef ctermid + +char *ctermid(char *s) +{ + return s ? strcpy(s, "/dev/tty") : "/dev/tty"; +} diff --git a/packages/fish/libc-src-unix-linux_like-android-mod.rs.diff b/packages/fish/libc-src-unix-linux_like-android-mod.rs.diff new file mode 100644 index 000000000000000..d9a35039114f59a --- /dev/null +++ b/packages/fish/libc-src-unix-linux_like-android-mod.rs.diff @@ -0,0 +1,95 @@ +--- a/src/unix/linux_like/android/mod.rs ++++ b/src/unix/linux_like/android/mod.rs +@@ -54,6 +54,92 @@ + pub type posix_spawn_file_actions_t = *mut c_void; + pub type posix_spawnattr_t = *mut c_void; + ++pub const POSIX_SPAWN_USEVFORK: c_int = 64; ++pub const POSIX_SPAWN_SETSID: c_int = 128; ++ ++pub const POSIX_SPAWN_RESETIDS: c_int = 0x01; ++pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02; ++pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x04; ++pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x08; ++pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x10; ++pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x20; ++ ++extern "C" { ++ pub fn posix_spawn( ++ pid: *mut crate::pid_t, ++ path: *const c_char, ++ file_actions: *const crate::posix_spawn_file_actions_t, ++ attrp: *const crate::posix_spawnattr_t, ++ argv: *const *mut c_char, ++ envp: *const *mut c_char, ++ ) -> c_int; ++ pub fn posix_spawnp( ++ pid: *mut crate::pid_t, ++ file: *const c_char, ++ file_actions: *const crate::posix_spawn_file_actions_t, ++ attrp: *const crate::posix_spawnattr_t, ++ argv: *const *mut c_char, ++ envp: *const *mut c_char, ++ ) -> c_int; ++ pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int; ++ pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int; ++ pub fn posix_spawnattr_getsigdefault( ++ attr: *const posix_spawnattr_t, ++ default: *mut crate::sigset_t, ++ ) -> c_int; ++ pub fn posix_spawnattr_setsigdefault( ++ attr: *mut posix_spawnattr_t, ++ default: *const crate::sigset_t, ++ ) -> c_int; ++ pub fn posix_spawnattr_getsigmask( ++ attr: *const posix_spawnattr_t, ++ default: *mut crate::sigset_t, ++ ) -> c_int; ++ pub fn posix_spawnattr_setsigmask( ++ attr: *mut posix_spawnattr_t, ++ default: *const crate::sigset_t, ++ ) -> c_int; ++ pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int; ++ pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int; ++ pub fn posix_spawnattr_getpgroup( ++ attr: *const posix_spawnattr_t, ++ flags: *mut crate::pid_t, ++ ) -> c_int; ++ pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int; ++ pub fn posix_spawnattr_getschedpolicy( ++ attr: *const posix_spawnattr_t, ++ flags: *mut c_int, ++ ) -> c_int; ++ pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int; ++ pub fn posix_spawnattr_getschedparam( ++ attr: *const posix_spawnattr_t, ++ param: *mut crate::sched_param, ++ ) -> c_int; ++ pub fn posix_spawnattr_setschedparam( ++ attr: *mut posix_spawnattr_t, ++ param: *const crate::sched_param, ++ ) -> c_int; ++ ++ pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int; ++ pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int; ++ pub fn posix_spawn_file_actions_addopen( ++ actions: *mut posix_spawn_file_actions_t, ++ fd: c_int, ++ path: *const c_char, ++ oflag: c_int, ++ mode: crate::mode_t, ++ ) -> c_int; ++ pub fn posix_spawn_file_actions_addclose( ++ actions: *mut posix_spawn_file_actions_t, ++ fd: c_int, ++ ) -> c_int; ++ pub fn posix_spawn_file_actions_adddup2( ++ actions: *mut posix_spawn_file_actions_t, ++ fd: c_int, ++ newfd: c_int, ++ ) -> c_int; ++} ++ + s! { + pub struct stack_t { + pub ss_sp: *mut c_void, diff --git a/packages/fish/libc-src-unix-linux_like-android.diff b/packages/fish/libc-src-unix-linux_like-android.diff new file mode 100644 index 000000000000000..b225b5ab2666579 --- /dev/null +++ b/packages/fish/libc-src-unix-linux_like-android.diff @@ -0,0 +1,153 @@ +diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs +index 42be94d42..53e2f7687 100644 +--- a/src/unix/linux_like/android/b32/mod.rs ++++ b/src/unix/linux_like/android/b32/mod.rs +@@ -3,7 +3,9 @@ use crate::prelude::*; + // The following definitions are correct for arm and i686, + // but may be wrong for mips + +-pub type mode_t = u16; ++pub type mode_t = c_ushort; ++pub type ino_t = u64; ++pub type off_t = i32; + pub type off64_t = c_longlong; + pub type sigset_t = c_ulong; + pub type socklen_t = i32; +@@ -28,7 +30,7 @@ s! { + pub st_dev: c_ulonglong, + __pad0: [c_uchar; 4], + __st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +@@ -50,7 +52,7 @@ s! { + pub st_dev: c_ulonglong, + __pad0: [c_uchar; 4], + __st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs +index b678eb8da..5bf8edcdb 100644 +--- a/src/unix/linux_like/android/b64/aarch64/mod.rs ++++ b/src/unix/linux_like/android/b64/aarch64/mod.rs +@@ -9,7 +9,7 @@ s! { + pub struct stat { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +@@ -32,7 +32,7 @@ s! { + pub struct stat64 { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: crate::nlink_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs +index cc407e113..3185af39b 100644 +--- a/src/unix/linux_like/android/b64/mod.rs ++++ b/src/unix/linux_like/android/b64/mod.rs +@@ -4,6 +4,8 @@ use crate::prelude::*; + // but may be wrong for mips64 + + pub type mode_t = u32; ++pub type ino_t = c_ulong; ++pub type off_t = i64; + pub type off64_t = i64; + pub type socklen_t = u32; + +diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs +index c4dc98e01..cb0a281cc 100644 +--- a/src/unix/linux_like/android/b64/riscv64/mod.rs ++++ b/src/unix/linux_like/android/b64/riscv64/mod.rs +@@ -10,7 +10,7 @@ s! { + pub struct stat { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: c_uint, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +@@ -33,7 +33,7 @@ s! { + pub struct stat64 { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_nlink: c_uint, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, +diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs +index ce2d70999..874913aff 100644 +--- a/src/unix/linux_like/android/b64/x86_64/mod.rs ++++ b/src/unix/linux_like/android/b64/x86_64/mod.rs +@@ -11,7 +11,7 @@ s! { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, + pub st_nlink: c_ulong, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: crate::dev_t, +@@ -31,7 +31,7 @@ s! { + pub st_dev: crate::dev_t, + pub st_ino: crate::ino_t, + pub st_nlink: c_ulong, +- pub st_mode: c_uint, ++ pub st_mode: crate::mode_t, + pub st_uid: crate::uid_t, + pub st_gid: crate::gid_t, + pub st_rdev: crate::dev_t, +diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs +index 5debbe8fb..44a39aa87 100644 +--- a/src/unix/linux_like/android/mod.rs ++++ b/src/unix/linux_like/android/mod.rs +@@ -5,7 +5,6 @@ use crate::prelude::*; + pub type clock_t = c_long; + pub type time_t = c_long; + pub type suseconds_t = c_long; +-pub type off_t = c_long; + pub type blkcnt_t = c_ulong; + pub type blksize_t = c_ulong; + pub type nlink_t = u32; +@@ -21,7 +20,6 @@ pub type fsblkcnt_t = c_ulong; + pub type nfds_t = c_uint; + pub type rlim_t = c_ulong; + pub type dev_t = c_ulong; +-pub type ino_t = c_ulong; + pub type ino64_t = u64; + pub type __CPU_BITTYPE = c_ulong; + pub type idtype_t = c_int; +@@ -528,16 +526,16 @@ s_no_extra_traits! { + } + + pub struct dirent { +- pub d_ino: u64, +- pub d_off: i64, ++ pub d_ino: crate::ino_t, ++ pub d_off: crate::off_t, + pub d_reclen: c_ushort, + pub d_type: c_uchar, + pub d_name: [c_char; 256], + } + + pub struct dirent64 { +- pub d_ino: u64, +- pub d_off: i64, ++ pub d_ino: crate::ino64_t, ++ pub d_off: crate::off_t, + pub d_reclen: c_ushort, + pub d_type: c_uchar, + pub d_name: [c_char; 256], diff --git a/packages/fish/share-functions-__fish_print_apt_packages.fish.patch b/packages/fish/share-functions-__fish_print_apt_packages.fish.patch deleted file mode 100644 index 716df48b0ff8984..000000000000000 --- a/packages/fish/share-functions-__fish_print_apt_packages.fish.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/share/functions/__fish_print_apt_packages.fish -+++ b/share/functions/__fish_print_apt_packages.fish -@@ -9,7 +9,7 @@ - - set -l search_term (commandline -ct | string replace -ar '[\'"\\\\]' '' | string lower) - -- if ! test -f /var/lib/dpkg/status -+ if ! test -f @TERMUX_PREFIX@/var/lib/dpkg/status - return 1 - end - -@@ -59,6 +59,6 @@ - print pkg "\t" desc - installed=0 # Prevent multiple description translations from being printed - } --}' , fish first checks whether is present in /bin/ or not. If it is found, then it will execute the command. But as we are using termux-exec, fish will actually try to execute in @TERMUX_PREFIX@/bin/. - -An example of this:- -/bin/ls: -1) Fish will first try find whether ls binary exists in /bin and whether user has permissions to execute it -2) If both the above are true, fish will try to execute /bin/ls. -3) But since we are using termux-exec, the path will be remapped to @TERMUX_PREFIX@/bin/ls -4) This is a *highly* inconsistent behaviour. - -This can cause weird bugs when a script tries to execute with hardcoded paths, it might get errors about command not found even if it exists, because fish is checking it at the wrong place. - -This patch has been tested to fix the bug -diff --git a/src/path.cpp b/src/path.cpp -index d5a649e0e..ad4e84278 100644 ---- a/src/path.cpp -+++ b/src/path.cpp -@@ -30,7 +30,7 @@ - #include "wutil.h" // IWYU pragma: keep - - // PREFIX is defined at build time. --static const wcstring_list_t kDefaultPath({L"/bin", L"/usr/bin", PREFIX L"/bin"}); -+static const wcstring_list_t kDefaultPath({PREFIX L"/bin"}); - - static get_path_result_t path_get_path_core(const wcstring &cmd, const wcstring_list_t &pathsv) { - const get_path_result_t noent_res{ENOENT, wcstring{}}; -@@ -52,11 +52,19 @@ static get_path_result_t path_get_path_c - return noent_res; - } - -+ wcstring _cmd; -+ if (string_prefixes_string(L"/bin/", cmd)) { -+ _cmd = L"@TERMUX_PREFIX@" + cmd; -+ } else if (string_prefixes_string(L"/usr/bin/", cmd)) { -+ _cmd = L"@TERMUX_BASE_DIR@" + cmd; -+ } else { -+ _cmd = cmd; -+ } - // If the command has a slash, it must be an absolute or relative path and thus we don't bother - // looking for a matching command. -- if (cmd.find(L'/') != wcstring::npos) { -- int merr = test_path(cmd); -- return get_path_result_t{merr, cmd}; -+ if (_cmd.find(L'/') != wcstring::npos) { -+ int merr = test_path(_cmd); -+ return get_path_result_t{merr, _cmd}; - } - - get_path_result_t best = noent_res; -@@ -66,7 +74,7 @@ static get_path_result_t path_get_path_core(const wcstring &cmd, const wcstring_ - for (const auto &next_path : pathsv) { - if (next_path.empty()) continue; - proposed_path = next_path; -- append_path_component(proposed_path, cmd); -+ append_path_component(proposed_path, _cmd); - int merr = test_path(proposed_path); - if (merr == 0) { - // We found one.