1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Actually deactivate CDPATH when unsetting it

After 'unset CDPATH', CDPATH continued to work as if nothing
happened. Unsetting it should be a valid way to deactivate it.

This bug is in every ksh93 version.

src/cmd/ksh93/bltins/cd_pwd.c: b_cd():
- Fix a manifest logic error: first check if CDPATH (CDPNOD) is
  unset before assigning to 'cdpath', not the other way around.
  Setting the 'cdpath' pointer is what activates the CDPATH search.
This commit is contained in:
Martijn Dekker 2021-12-28 23:53:08 +00:00
parent de511cfbc2
commit 57ed1efc2c
3 changed files with 5 additions and 1 deletions

2
NEWS
View file

@ -5,6 +5,8 @@ Any uppercase BUG_* names are modernish shell bug IDs.
2021-12-28:
- Fixed a bug that caused CDPATH to continue working after unsetting it.
- Added three options to the ulimit builtin with the same names and
functionality as in Bash:
- 'ulimit -k' sets the maximum number of kqueues.

View file

@ -140,7 +140,7 @@ int b_cd(int argc, char *argv[],Shbltin_t *context)
&& !(dir[0]=='.' && (dir[1]=='/' || dir[1]==0))
&& !(dir[0]=='.' && dir[1]=='.' && (dir[2]=='/' || dir[2]==0)))
{
if(!(cdpath = (Pathcomp_t*)shp->cdpathlist) && (dp=sh_scoped(shp,CDPNOD)->nvalue.cp))
if((dp=sh_scoped(&sh,CDPNOD)->nvalue.cp) && !(cdpath = (Pathcomp_t*)shp->cdpathlist))
{
if(cdpath=path_addpath(shp,(Pathcomp_t*)0,dp,PATH_CDPATH))
{

View file

@ -305,6 +305,8 @@ x=$(cd ${tmp#/})
if [[ $x != $tmp ]]
then err_exit "CDPATH ${tmp#/} does not display new directory"
fi
unset CDPATH
cd "${tmp#/}" >/dev/null 2>&1 && err_exit "CDPATH not deactivated after unset"
cd "$tmp" || exit
TMOUT=100
(TMOUT=20)