diff --git a/docs/changelog.rst b/docs/changelog.rst index 93af3bbee..2502605e5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -35,6 +35,11 @@ mouse anywhere in the current command to move the cursor there. See Detailed list of changes ------------------------------------- +0.26.1 [future] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- ssh kitten: Fix executable permission missing from kitty bootstrap script (:iss:`5438`) + 0.26.0 [2022-08-29] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty_tests/check_build.py b/kitty_tests/check_build.py index f1ed3a6c1..87a2edd16 100644 --- a/kitty_tests/check_build.py +++ b/kitty_tests/check_build.py @@ -3,6 +3,7 @@ import os +import stat import sys import unittest from functools import partial @@ -58,7 +59,15 @@ class TestBuild(BaseTest): self.assertTrue(os.path.isdir(terminfo_dir), f'Terminfo dir: {terminfo_dir}') self.assertTrue(os.path.exists(logo_png_file), f'Logo file: {logo_png_file}') self.assertTrue(os.path.exists(zsh), f'Shell integration: {zsh}') - self.assertTrue(os.access(os.path.join(shell_integration_dir, 'ssh', 'askpass.py'), os.X_OK)) + + def is_executable(x): + mode = os.stat(x).st_mode + q = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH + return mode & q == q + + for x in ('kitty', 'askpass.py'): + x = os.path.join(shell_integration_dir, 'ssh', x) + self.assertTrue(is_executable(x), f'{x} is not executable') if getattr(sys, 'frozen', False): self.assertTrue(os.path.isdir(local_docs()), f'Local docs: {local_docs()}') @@ -76,8 +85,8 @@ class TestBuild(BaseTest): del pygments def test_docs_url(self): - from kitty.utils import docs_url from kitty.constants import website_url + from kitty.utils import docs_url def run_tests(p, base, suffix='.html'): def t(x, e): diff --git a/setup.py b/setup.py index 8da6a7032..08571c8d2 100755 --- a/setup.py +++ b/setup.py @@ -1363,10 +1363,19 @@ def package(args: Options, bundle_type: str) -> None: f.seek(0), f.truncate(), f.write(raw) compile_python(libdir) + + def should_be_executable(path: str) -> bool: + if path.endswith('.so'): + return True + q = path.split(os.sep)[-2:] + if len(q) == 2 and q[0] == 'ssh' and q[1] in ('askpass.py', 'kitty'): + return True + return False + for root, dirs, files in os.walk(libdir): for f_ in files: path = os.path.join(root, f_) - os.chmod(path, 0o755 if f_.endswith('.so') or os.path.basename(f_) == 'askpass.py' else 0o644) + os.chmod(path, 0o755 if should_be_executable(path) else 0o644) if not is_macos: create_linux_bundle_gunk(ddir, args.libdir_name)