Compare commits

...

3 Commits

Author SHA1 Message Date
m0vie 464f286214
Merge d91164af4f into c4d9559184 2026-08-11 19:20:13 +07:00
Colin Kinloch c4d9559184 main: Add systemd run0 equivalent to sudo 2026-08-07 12:11:51 -07:00
m0viefreak d91164af4f tests: Set ZSH explicitly make sure PATH is exported
'env -i' clears the complete environment, including PATH. In that
case, on most platforms, when excuting commands without PATH being
set, /usr/bin and /bin are searched, e.g. on Linux:

  $ strace env -i asdf |&  grep asdf
  execve("/usr/bin/env", ["env", "-i", "asdf"], 0x7ffc3e3c0890 /* 27 vars */) = 0
  execve("/bin/asdf", ["asdf"], 0x55be2da090d0 /* 0 vars */) = -1 ENOENT (No such file or directory)
  execve("/usr/bin/asdf", ["asdf"], 0x55be2da090d0 /* 0 vars */) = -1 ENOENT (No such file or directory)
  write(2, "\342\200\230asdf\342\200\231", 10‘asdf’) = 10

Howver, this does not hold on every platform. E.g. on Cygwin, so
such fallback paths are searched:

  $ strace env -i asdf |&  grep asdf
     37   25736 [main] env 3516 build_argv: argv[2] = 'asdf'
    643   30373 [main] env 3516 find_exec: find_exec (asdf)
     35   30408 [main] env 3516 find_exec: (null) = find_exec (asdf)
     36   30444 [main] env 3516 spawnve: spawnve (, asdf, 0x10040B000)
  ‘asdf’  199   53601 [main] env 3516 write: 10 = write(2, 0x10040B040, 10)

  $ env -i zsh
  env: ‘zsh’: No such file or directory

Therefore, we need to make sure that the default PATH is exported
from tests/test-highlighting.zsh.
2020-08-15 13:36:22 +02:00
3 changed files with 3 additions and 1 deletions

View File

@ -4,7 +4,7 @@ INSTALL?=install -c
PREFIX?=/usr/local PREFIX?=/usr/local
SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME) SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME) DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
ZSH?=zsh # zsh binary to run tests with ZSH?="`which zsh`" # zsh binary to run tests with
all: all:
cd docs && \ cd docs && \

View File

@ -354,6 +354,7 @@ _zsh_highlight_highlighter_main_paint()
'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags 'pkexec' '' # doesn't take short options; immune to #121 because it's usually not passed --option flags
# Not listed: -h, which has two different meanings. # Not listed: -h, which has two different meanings.
'sudo' Cgprtu:AEHPSbilns:eKkVv # as of sudo 1.8.21p2 'sudo' Cgprtu:AEHPSbilns:eKkVv # as of sudo 1.8.21p2
'run0' ugD:h # systemd 256.6
'stdbuf' ioe: 'stdbuf' ioe:
'eatmydata' '' 'eatmydata' ''
'catchsegv' '' 'catchsegv' ''

View File

@ -29,6 +29,7 @@
# ------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------
export PATH
setopt NO_UNSET WARN_CREATE_GLOBAL setopt NO_UNSET WARN_CREATE_GLOBAL
# Required for add-zle-hook-widget. # Required for add-zle-hook-widget.