ssh kitten: Fix executable permission missing from kitty bootstrap script

Fixes #5438
This commit is contained in:
Kovid Goyal 2022-08-29 18:20:09 +05:30
parent 16a4845a72
commit c68b82e4d0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 26 additions and 3 deletions

View File

@ -35,6 +35,11 @@ mouse anywhere in the current command to move the cursor there. See
Detailed list of changes 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] 0.26.0 [2022-08-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -3,6 +3,7 @@
import os import os
import stat
import sys import sys
import unittest import unittest
from functools import partial 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.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(logo_png_file), f'Logo file: {logo_png_file}')
self.assertTrue(os.path.exists(zsh), f'Shell integration: {zsh}') 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): if getattr(sys, 'frozen', False):
self.assertTrue(os.path.isdir(local_docs()), f'Local docs: {local_docs()}') self.assertTrue(os.path.isdir(local_docs()), f'Local docs: {local_docs()}')
@ -76,8 +85,8 @@ class TestBuild(BaseTest):
del pygments del pygments
def test_docs_url(self): def test_docs_url(self):
from kitty.utils import docs_url
from kitty.constants import website_url from kitty.constants import website_url
from kitty.utils import docs_url
def run_tests(p, base, suffix='.html'): def run_tests(p, base, suffix='.html'):
def t(x, e): def t(x, e):

View File

@ -1363,10 +1363,19 @@ def package(args: Options, bundle_type: str) -> None:
f.seek(0), f.truncate(), f.write(raw) f.seek(0), f.truncate(), f.write(raw)
compile_python(libdir) 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 root, dirs, files in os.walk(libdir):
for f_ in files: for f_ in files:
path = os.path.join(root, f_) 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: if not is_macos:
create_linux_bundle_gunk(ddir, args.libdir_name) create_linux_bundle_gunk(ddir, args.libdir_name)