[libcxx-commits] [libcxx] [libc++][CI] Refactor creating inline files (PR #88250)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 10 05:35:05 PDT 2024


philnik777 wrote:

> > > See for example https://www.oreilly.com/library/view/bash-cookbook/0596526784/ch03s04.html.
> > 
> > 
> > According to that link it's important that `EOF` is the only thing in the end-line to make sure it's recognized as such, which is already the case.
> 
> Not exactly. See the warning message and in particular the 2. and 3. sentence which make it more clear:
> 
> > Just as trailing whitespace of any kind on your closing EOF delimiter prevents it from being recognized as the closing delimiter (see the warning in [Preventing Weird Behavior in a Here-Document](https://www.oreilly.com/library/view/bash-cookbook/0596526784/ch03s03.html)), so too will using a leading character other than just the tab character. If your script indents with spaces or a combination of spaces and tabs, don’t use that technique on here-documents. Either use just tabs, or keep it all flush left. Also, watch out for text editors that automatically ...

AFAICT this still applies to the `EOF` line, since the first sentence calls the delimiter out explicitly.

To break it down a bit:
```
cat <<EOF
Hello everyone,
  this is some indented text.
EOF
```
seems like it should print
```
Hello everyone,
  this is some indented text.
```
according to the here-doc rules. It also does exactly what I expect on my machine. So answer either
- Why exactly is this an improper here-doc block?, or
- How is it not analogous to the Dockerfile content?


https://github.com/llvm/llvm-project/pull/88250


More information about the libcxx-commits mailing list