[all-commits] [llvm/llvm-project] 327894: Fix `sed -e s at FOO@%/S@` and similar when there's @...

Daniel Sanders via All-commits all-commits at lists.llvm.org
Tue Dec 3 15:44:12 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 327894859cc41c1730807f8a179aa880203262f5
      https://github.com/llvm/llvm-project/commit/327894859cc41c1730807f8a179aa880203262f5
  Author: Daniel Sanders <daniel_l_sanders at apple.com>
  Date:   2019-12-03 (Tue, 03 Dec 2019)

  Changed paths:
    M clang/test/Index/index-module-with-vfs.m
    M clang/test/Modules/crash-vfs-ivfsoverlay.m
    M clang/test/Modules/double-quotes.m
    M clang/test/Modules/framework-public-includes-private.m
    M clang/test/VFS/external-names.c
    M clang/test/VFS/framework-import.m
    M clang/test/VFS/implicit-include.c
    M clang/test/VFS/include-mixed-real-and-virtual.c
    M clang/test/VFS/include-real-from-virtual.c
    M clang/test/VFS/include-virtual-from-real.c
    M clang/test/VFS/include.c
    M clang/test/VFS/incomplete-umbrella.m
    M clang/test/VFS/module-import.m
    M clang/test/VFS/module_missing_vfs.m
    M clang/test/VFS/real-path-found-first.m
    M clang/test/VFS/relative-path.c
    M clang/test/VFS/test_nonmodular.c
    M clang/test/VFS/umbrella-framework-import-skipnonexist.m
    M clang/test/VFS/vfsroot-include.c
    M clang/test/VFS/vfsroot-module.m
    M clang/test/VFS/vfsroot-with-overlay.c
    M llvm/utils/lit/lit/TestRunner.py

  Log Message:
  -----------
  Fix `sed -e s at FOO@%/S@` and similar when there's @'s in the working directory

Jenkins sometimes starts a new working directory by appending @2 (or
incrementing the number if the @n suffix is already there). This causes
several clang tests to fail as:
  s at INPUT_DIR@%/S/Inputs at g
gets expanded to the invalid:
  s at INPUT_DIR@/path/to/workdir at 2/Inputs at g
                               ~~~~~~~~~~
where the part marked with ~'s is interpreted as the flags. These are
invalid and the test fails.

Previous fixes simply exchanged the @ character for another like | but
that's just moving the problem. Address it by adding an expansion that
escapes the @ character we're using as a delimiter as well as other magic
characters in the replacement of sed's s@@@.

There's still room for expansions to cause trouble though. One I ran into
while testing this was that having a directory called foo at bar causes lots
of `CHECK-NOT: foo` directives to match. There's also things like
directories containing `\1`




More information about the All-commits mailing list