NetBSD/usr.bin/make
pk ce3fe4630a Fix the bug addressed in revision 1.27 properly. Analysis of the problem
(see also PR#15179):

  When looking up names which directory components (i.e. having slashes,
  except when of the form `./name'), FindFile()/DirLookup() first looks
  the final filename component in the cache for each directory on the search
  path and then proceeds to match the prefixed directory components by
  comparing them to the trailing directory components of the the search
  path being probed.

  This is not correct. When looking for `bar/target' in a path `.../src/foo',
  you want it to come up with `.../src/foo/bar/target' (if it exists). There's
  no point in comparing the the `bar' prefix on the target to the `foo' suffix
  on the search path. Indeed, this will cause a false match if those prefix
  and suffix components are actually equal and search path itself also has a
  file called `target'. For example, looking for `foo/target' in `.../src/foo'
  will spuriously match `.../src/foo/target', not `.../src/foo/foo/target'.

  This last bug prompted the change in dir.c, rev 1.27, which happens
  to partially workaround it by avoiding the above matching code in the
  case of the `curdir' search path entry (at the cost of incurring an
  exorbitant amount of cache misses). The situation is unchanged however,
  when processing other entries on the search path (e.g. those other than
  `dot' and `cur').

Drop the prefix matching code in DirLookup() entirely and use DirFindDot()
and DirLookup() only for names without proper directory components (i.e.
`target' and `./target). Otherwise, non-absolute names are dealt with by
DirLookupSubdir(), while absolute names can be checked for an exact match
of the directory components prefix against the directories on the current
search path. This allows for the use of the file cache to check the
existence of the file and additionally, provides a shortcut out of
Dir_FindFile() if we have the prefix match but not a cache entry (this
is especially beneficial for searches in .CURDIR when it's not equal
to `dot').
2002-01-31 12:38:34 +00:00
..
lst.lib
PSD.doc precede, not preceed. 2001-08-20 12:00:46 +00:00
arch.c Clean up some MAKE_BOOTSTRAP issues wrt. MACHINE/MACHINE_ARCH. 2001-11-30 01:29:47 +00:00
bit.h
buf.c
buf.h
compat.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
cond.c
config.h Bleh, make the conditional work *correctly* this time (...teaches me not to 2002-01-16 03:40:29 +00:00
dir.c Fix the bug addressed in revision 1.27 properly. Analysis of the problem 2002-01-31 12:38:34 +00:00
dir.h Redo the hashtable for "." if .OBJDIR changes. 2001-11-12 21:58:17 +00:00
for.c Add 4th arg (flags) to Var_Set so that VarLoopExpand can tell it not 2001-06-12 23:36:17 +00:00
hash.c
hash.h
job.c When attempting to chdir to .CURDIR because Check_Cwd_Cmd says we need to 2001-10-16 18:06:29 +00:00
job.h A number of semi-related changes. 2001-06-01 20:33:37 +00:00
list.h
lst.h
main.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
make.1 outdent description of variable expansion modifiers 2001-12-23 10:51:56 +00:00
make.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
make.h Overhaul the initialization and handling of .OBJDIR: 2001-10-31 03:59:42 +00:00
Makefile Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
Makefile.boot Clean up some MAKE_BOOTSTRAP issues wrt. MACHINE/MACHINE_ARCH. 2001-11-30 01:29:47 +00:00
nonints.h Before we #define __attribute__ away, #undef it. 2002-01-18 03:36:00 +00:00
parse.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
pathnames.h
sprite.h
str.c
suff.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
targ.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
trace.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
trace.h
util.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00
var.c Fix major bug in make(1) ... due to shadowing of the dotLast path used for 2002-01-27 01:50:54 +00:00