Skip to content

Commit

Permalink
command -x: fix bypassing path-bound built-ins again (re: be79e4e)
Browse files Browse the repository at this point in the history
Symptom, after compiling ksh with support for dynamic libraries
(this will again become possible soon, we're currently testing it),
if the virtual /opt/ast/bin directory for path-bound built-ins is
first in $PATH:

   $ ksh -c 'command -vx cat; command -vx cat'
   /opt/ast/bin/cat
   /bin/cat

This already showed up in a regression test failure for the
dynamically linked ksh:

   path.sh[1008]: FAIL: 'command -vx' breakage (expected status 0,
   /bin/cat; got status 0, /opt/ast/bin/cat)

src/cmd/ksh93/sh/path.c: path_absolute():
- Add missing check for SH_XARG shell state bit.
  • Loading branch information
McDutchie committed Jan 25, 2024
1 parent e16b01e commit e63feba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ Pathcomp_t *path_absolute(const char *name, Pathcomp_t *pp, int flag)
np->nvenv = dll;
goto found;
}
if(*stkptr(sh.stk,PATH_OFFSET)=='/' && nv_search(stkptr(sh.stk,PATH_OFFSET),sh.bltin_tree,0))
if(!sh_isstate(SH_XARG) && *stkptr(sh.stk,PATH_OFFSET)=='/' && nv_search(stkptr(sh.stk,PATH_OFFSET),sh.bltin_tree,0))
goto found;
if(fp)
free(fp);
Expand Down

0 comments on commit e63feba

Please sign in to comment.