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

Bugs that practically can't be fixed #214

Open
amaanq opened this issue Aug 30, 2023 · 1 comment
Open

Bugs that practically can't be fixed #214

amaanq opened this issue Aug 30, 2023 · 1 comment

Comments

@amaanq
Copy link
Member

amaanq commented Aug 30, 2023

As mentioned here, a few possible bash expressions are just not feasible to parse, and do have shellcheck emit errors about them too.

First is a command substitution with "$((" which is also used by arithmetic expansions - it's just impossible to distinguish them and shellcheck

$((use fancy || use taamey) && echo ttf)

we cannot know if it's one or the other without some really complex scanner logic - and shells have different behavior regarding this according to shellcheck, some don't allow it and some do, so please, do not do this.

Another one is..this monstrosity:

word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"

This makes me dizzy just thinking about it, but I'm pretty sure statefulness would be needed for stuff within quotes within escaped quotes - that's just too much (the main issue is the $)

Lastly, there's this:

[ -e "${EROOT}"/usr/lib/gtk-2.0/2.[^1]* ]

Which, according to shellcheck -e doesn't even work with globs, and I'm not sure if this is entirely valid anyways. Imo this is the easiest one to fix but I'm just unsure about its validity.

@Ordoviz
Copy link

Ordoviz commented Aug 31, 2023

Regarding [ -e "${EROOT}"/usr/lib/gtk-2.0/2.[^1]* ]: This is sloppy but valid code. Bash will expand the glob /usr/lib/gtk-2.0/2.[^1]* (since it's unquoted) and pass the matching filenames as arguments to the [ builtin.

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