Fix 'fish_config' so that it works with unveil'd browsers. Also fix vmctl

completion.

All patches are upstreamed and will be included in the next fish release.
This commit is contained in:
abieber 2020-02-08 15:35:55 +00:00
parent 72aa1806a5
commit 2692a4a265
4 changed files with 110 additions and 6 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.11 2019/07/12 20:49:38 sthen Exp $
# $OpenBSD: Makefile,v 1.12 2020/02/08 15:35:55 abieber Exp $
COMMENT = friendly interactive shell
V = 3.0.2
DISTNAME = fish-$V
REVISION = 1
REVISION = 2
CATEGORIES = shells
@ -37,6 +37,7 @@ LIB_DEPENDS = devel/pcre2 \
RUN_DEPENDS = misc/gnugetopt
MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
MODPY_ADJ_FILES = share/tools/create_manpage_completions.py \
share/tools/deroff.py \
share/tools/web_config/webconfig.py

View File

@ -0,0 +1,20 @@
$OpenBSD: patch-share_completions_vmctl_fish,v 1.3 2020/02/08 15:35:55 abieber Exp $
https://github.com/fish-shell/fish-shell/pull/6523
Index: share/completions/vmctl.fish
--- share/completions/vmctl.fish.orig
+++ share/completions/vmctl.fish
@@ -1,4 +1,11 @@
+function __fish_get_vmctl_vms
+ for line in (vmctl status | string match -e -v "MAXMEM");
+ set a (string split " " $line)
+ and printf "%s " $a[-1]
+ end
+end
+
complete -c vmctl -xa 'console create load log reload reset start status stop pause unpause send receive' -n 'not __fish_seen_subcommand_from list console create load log reload reset start status stop pause unpause send receive'
-complete -c vmctl -n '__fish_seen_subcommand_from console reload reset start status stop pause unpause send receive' -xa '(vmctl status | string match -e -v "MAXMEM" | string replace -r "^(\s+\S+\s+){7}" "")'
+complete -c vmctl -n '__fish_seen_subcommand_from console reload reset start status stop pause unpause send receive' -xa (__fish_get_vmctl_vms)

View File

@ -0,0 +1,62 @@
$OpenBSD: patch-share_tools_web_config_webconfig_py,v 1.1 2020/02/08 15:35:55 abieber Exp $
https://github.com/fish-shell/fish-shell/pull/6522
Index: share/tools/web_config/webconfig.py
--- share/tools/web_config/webconfig.py.orig
+++ share/tools/web_config/webconfig.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/local/bin/python3.7
from __future__ import unicode_literals
from __future__ import print_function
@@ -21,6 +21,7 @@ import socket
import string
import subprocess
import sys
+import tempfile
from itertools import chain
FISH_BIN_PATH = False # will be set later
@@ -1172,31 +1173,13 @@ url = 'http://localhost:%d/%s/%s' % (PORT, authkey, in
# Create temporary file to hold redirect to real server. This prevents exposing
# the URL containing the authentication key on the command line (see
# CVE-2014-2914 or https://github.com/fish-shell/fish-shell/issues/1438).
-if 'XDG_CACHE_HOME' in os.environ:
- dirname = os.path.expanduser(os.path.expandvars('$XDG_CACHE_HOME/fish/'))
-else:
- dirname = os.path.expanduser('~/.cache/fish/')
-
-os.umask(0o0077)
-try:
- os.makedirs(dirname, 0o0700)
-except OSError as e:
- if e.errno == 17:
- pass
- else:
- raise e
-
-randtoken = ''.join(random.choice(string.ascii_uppercase + string.digits)
- for _ in range(6))
-filename = dirname + 'web_config-%s.html' % randtoken
-
-f = open(filename, 'w')
+f = tempfile.NamedTemporaryFile(prefix='web_config_', suffix='.html', mode='w')
f.write(redirect_template_html % (url, url))
-f.close()
+f.flush()
# Open temporary file as URL
# Use open on macOS >= 10.12.5 to work around #4035.
-fileurl = 'file://' + filename
+fileurl = 'file://' + f.name
print("Web config started at '%s'. Hit enter to stop." % fileurl)
if isMacOS10_12_5_OrLater():
subprocess.check_call(['open', fileurl])
@@ -1221,4 +1204,4 @@ except KeyboardInterrupt:
print("\nShutting down.")
# Clean up temporary file
-os.remove(filename)
+f.close()

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST,v 1.2 2019/01/23 00:53:06 abieber Exp $
@comment $OpenBSD: PLIST,v 1.3 2020/02/08 15:35:55 abieber Exp $
@shell bin/fish
@bin bin/fish_indent
@bin bin/fish_key_reader
@ -921,11 +921,14 @@ share/fish/man/man1/
@man share/fish/man/man1/wait.1
@man share/fish/man/man1/while.1
share/fish/tools/
${MODPY_COMMENT}share/fish/tools/${MODPY_PYCACHE}/
share/fish/tools/${MODPY_PYCACHE}create_manpage_completions.${MODPY_PYC_MAGIC_TAG}pyc
share/fish/tools/${MODPY_PYCACHE}deroff.${MODPY_PYC_MAGIC_TAG}pyc
share/fish/tools/create_manpage_completions.py
share/fish/tools/create_manpage_completions.pyc
share/fish/tools/deroff.py
share/fish/tools/deroff.pyc
share/fish/tools/web_config/
${MODPY_COMMENT}share/fish/tools/web_config/${MODPY_PYCACHE}/
share/fish/tools/web_config/${MODPY_PYCACHE}webconfig.${MODPY_PYC_MAGIC_TAG}pyc
share/fish/tools/web_config/delete.png
share/fish/tools/web_config/favicon.png
share/fish/tools/web_config/fishconfig.css
@ -963,17 +966,35 @@ share/fish/tools/web_config/sample_prompts/screen_savvy.fish
share/fish/tools/web_config/sample_prompts/sorin.fish
share/fish/tools/web_config/sample_prompts/terlar.fish
share/fish/tools/web_config/webconfig.py
share/fish/tools/web_config/webconfig.pyc
share/fish/vendor_completions.d/
share/fish/vendor_conf.d/
share/fish/vendor_functions.d/
share/locale/
share/locale/de/
share/locale/de/LC_MESSAGES/
share/locale/de/LC_MESSAGES/fish.mo
share/locale/en/
share/locale/en/LC_MESSAGES/
share/locale/en/LC_MESSAGES/fish.mo
share/locale/fr/
share/locale/fr/LC_MESSAGES/
share/locale/fr/LC_MESSAGES/fish.mo
share/locale/nb/
share/locale/nb/LC_MESSAGES/
share/locale/nb/LC_MESSAGES/fish.mo
share/locale/nn/
share/locale/nn/LC_MESSAGES/
share/locale/nn/LC_MESSAGES/fish.mo
share/locale/pl/
share/locale/pl/LC_MESSAGES/
share/locale/pl/LC_MESSAGES/fish.mo
share/locale/pt_BR/
share/locale/pt_BR/LC_MESSAGES/
share/locale/pt_BR/LC_MESSAGES/fish.mo
share/locale/sv/
share/locale/sv/LC_MESSAGES/
share/locale/sv/LC_MESSAGES/fish.mo
share/locale/zh_CN/
share/locale/zh_CN/LC_MESSAGES/
share/locale/zh_CN/LC_MESSAGES/fish.mo
share/pkgconfig/fish.pc