[PATCH] D117933: [ELF] Don't consider directories of the same name as libraries

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 21 16:06:50 PST 2022


mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lld/test/ELF/deplibs-dir.s:13
+# RUN: llvm-ar rc %t.dir/baz/libfoo.a %tfoo.o
+# RUN: ld.lld %t.o -o /dev/null -L %t.dir/bar -L %t.dir/baz --trace 2>&1 | \
+# RUN:   FileCheck %s -DOBJ=%t.o -DDIR=%t.dir
----------------
Another good thing to test here is `-L%t.dir/notdir/foo` when `%t.dir/notdir` exists as a regular file.  With the old bug this will get "Not a directory" (ENOTDIR, which should also be treated the same as ENOENT).

Ideally, I think we'd also test that a regular file that cannot be opened fails as expected rather than being skipped.  That would need two matching files in the search path to be sure it doesn't go on and open the file that works.  e.g., make the first match in the path be a file without read permissions.  It might be hard to reproduce an existing but unopenable file across all operating systems.



================
Comment at: lld/test/ELF/deplibs-dir.s:17
+# CHECK:      [[OBJ]]
+# CHECK-NOT:  [[DIR]]{{[\\/]}}foo: Is a directory
+# CHECK-NOT:  [[DIR]]{{[\\/]}}bar{{[\\/]}}foo: Is a directory
----------------
Matching the exact perror text might not be reliable across operating systems, but for a negative match that might be tolerable.  Also of potential concern is if messages could ever get translated vs running under LC_ALL=C.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117933/new/

https://reviews.llvm.org/D117933



More information about the llvm-commits mailing list