In <[EMAIL PROTECTED]>, Marcel Moolenaar wrote: > It seems to me that when there's a PATH= assignment you don't want to > add anything to the cache or alternatively, clear the cache after > execution of the command having a PATH= assignment. The first solution is better, but the source messes with the hashtable too directly in too many places. Appended diff does the second route. Does it fix your problems? Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <[EMAIL PROTECTED]> http://www.cons.org/cracauer/ Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536
? test2 ? l ? test1 ? sh.core ? builtins.c ? builtins.h ? mknodes ? nodes.h ? nodes.c ? mksyntax ? syntax.c ? syntax.h ? token.h ? y.tab.h ? y.tab.c ? arith.c ? arith_lex.c ? sh ? mkinit ? init.c ? sh.1.gz Index: Makefile =================================================================== RCS file: /home/CVS-FreeBSD/src/bin/sh/Makefile,v retrieving revision 1.30 diff -c -r1.30 Makefile *** Makefile 1999/09/08 15:40:43 1.30 --- Makefile 1999/12/15 11:24:05 *************** *** 18,24 **** LDADD+= -ll -ledit -ltermcap LFLAGS= -8 # 8-bit lex scanner for arithmetic ! CFLAGS+=-DSHELL -I. -I${.CURDIR} # for debug: # CFLAGS+= -g -DDEBUG=2 --- 18,24 ---- LDADD+= -ll -ledit -ltermcap LFLAGS= -8 # 8-bit lex scanner for arithmetic ! CFLAGS+=-DSHELL -I. -I${.CURDIR} -g -Werror # for debug: # CFLAGS+= -g -DDEBUG=2 Index: eval.c =================================================================== RCS file: /home/CVS-FreeBSD/src/bin/sh/eval.c,v retrieving revision 1.26 diff -c -r1.26 eval.c *** eval.c 1999/11/29 19:10:59 1.26 --- eval.c 1999/12/15 11:24:05 *************** *** 612,623 **** --- 612,625 ---- volatile int e; char *lastarg; int realstatus; + int do_clearcmdentry; #if __GNUC__ /* Avoid longjmp clobbering */ (void) &argv; (void) &argc; (void) &lastarg; (void) &flags; + (void) &do_clearcmdentry; #endif /* First expand the arguments. */ *************** *** 626,631 **** --- 628,634 ---- arglist.lastp = &arglist.list; varlist.lastp = &varlist.list; varflag = 1; + do_clearcmdentry = 0; oexitstatus = exitstatus; exitstatus = 0; for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) { *************** *** 688,695 **** * is present */ for (sp = varlist.list ; sp ; sp = sp->next) ! if (strncmp(sp->text, PATH, sizeof(PATH) - 1) == 0) path = sp->text + sizeof(PATH) - 1; find_command(argv[0], &cmdentry, 1, path); if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */ --- 691,700 ---- * is present */ for (sp = varlist.list ; sp ; sp = sp->next) ! if (strncmp(sp->text, PATH, sizeof(PATH) - 1) == 0) { path = sp->text + sizeof(PATH) - 1; + do_clearcmdentry = 1; + } find_command(argv[0], &cmdentry, 1, path); if (cmdentry.cmdtype == CMDUNKNOWN) { /* command not found */ *************** *** 887,892 **** --- 892,899 ---- out: if (lastarg) setvar("_", lastarg, 0); + if (do_clearcmdentry) + clearcmdentry(0); popstackmark(&smark); } Index: exec.c =================================================================== RCS file: /home/CVS-FreeBSD/src/bin/sh/exec.c,v retrieving revision 1.13 diff -c -r1.13 exec.c *** exec.c 1999/08/27 23:15:11 1.13 --- exec.c 1999/12/15 11:24:05 *************** *** 104,110 **** STATIC void execinterp __P((char **, char **)); #endif STATIC void printentry __P((struct tblentry *, int)); - STATIC void clearcmdentry __P((int)); STATIC struct tblentry *cmdlookup __P((char *, int)); STATIC void delete_cmd_entry __P((void)); --- 104,109 ---- *************** *** 640,646 **** * PATH which has changed. */ ! STATIC void clearcmdentry(firstchange) int firstchange; { --- 639,645 ---- * PATH which has changed. */ ! void clearcmdentry(firstchange) int firstchange; { Index: exec.h =================================================================== RCS file: /home/CVS-FreeBSD/src/bin/sh/exec.h,v retrieving revision 1.8 diff -c -r1.8 exec.h *** exec.h 1999/08/27 23:15:12 1.8 --- exec.h 1999/12/15 11:24:05 *************** *** 69,71 **** --- 69,72 ---- void defun __P((char *, union node *)); int unsetfunc __P((char *)); int typecmd __P((int, char **)); + void clearcmdentry __P((int));