Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

echo "<< EOF" causes rest of file to be ignored #472

Open
TexasDex opened this issue Jan 10, 2025 · 1 comment
Open

echo "<< EOF" causes rest of file to be ignored #472

TexasDex opened this issue Jan 10, 2025 · 1 comment

Comments

@TexasDex
Copy link

Yes I know it's a bit strange, but there's a good reason for a line like that: When run in debug mode, my script will output the command, args, and heredoc input to stdout, instead of running the command. The user can then copy/paste the command to run it independently.

However, when kcov processes my script it stops at the line in the title.

This can be duplicated with the following toy shell script:

#!/bin/bash

echo "Yes"
if true; then
	echo 1
fi
echo "<< EOF"
echo "What about this line?"
echo "Nope"

The last two lines will run and output when executing the shell script, when run inside of kcov or outside. However, the kcov results will not show the last two lines as green or red.

kcov_bug

When I comment out the line it works just fine.

I assume something in kcov is detecting heredocs and ignoring them, but that detection is overzealous and the line results in a false positive.

@SimonKagstrom
Copy link
Owner

Yes, you're right. The bash-parser has never been any good, and should really be rewritten as a proper language parser. It's not something I've planned to do myself though.

There is a basic bash parser which can be used if the regular one goes astray. It has more false positives/negatives, but sometimes avoids getting totally lost instead. It can be used by kcov --configure=bash-use-basic-parser=1 [other arguments as before]. Not sure if that helps here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy