Conversation
postmodern
left a comment
There was a problem hiding this comment.
Spotted a few things. We may want to disable a few more of the ShellCheck rules, since they might not correctly be matching the code.
| while IFS="" read -r line; do | ||
| if [[ "$line" == "$key:"* ]]; then | ||
| echo "${line##$key:*([[:space:]])}" | ||
| echo "${line##"$key":*([[:space:]])}" |
There was a problem hiding this comment.
Are quotes really needed within bash variable substitutions?
var1="foo bar"
var2="foo bar baz"
echo "${var2#$var1 }"There was a problem hiding this comment.
I don't think so, but shellcheck disagrees :D
There was a problem hiding this comment.
Wait, which version of ShellCheck are you using? I'm on 0.7.2, which might be older than your version, which might explain why I'm not seeing those warnings?
| ruby_dependencies=() | ||
| while IFS='' read -r line; do | ||
| ruby_dependencies+=("$line") | ||
| done < <(fetch "$ruby/$file" "$package_manager" || return $?) |
There was a problem hiding this comment.
We actually need the implicit shell-splitting here. fetch "$ruby/$file" "$package_manager" will read the dependencies.txt file and return the apt: pkg1 pkg2 ... line that matches the "$package_manager", but without the apt: prefix. It is then implicitly splatted into an Array of individual package names. Reading each line would cause ruby_dependencies to become a singleton Array that contains the whole line (ex: ("pkg1 pkg2 pkg3")).
There was a problem hiding this comment.
Hmm, agree. I just followed (blindly) what Shellcheck WIKI was proposing :D
| local missing_pkgs=($(pacman -T "$@")) | ||
| local missing_pkgs=() | ||
| while IFS='' read -r line; do | ||
| missing_pkgs+=("$line") |
There was a problem hiding this comment.
I'm not a Arch user so I can't verify this, can you double check if pacman -T outputs the missing packages one per-line or a single-line with the package names separated by spaces?
https://archlinux.org/pacman/pacman.8.html
There was a problem hiding this comment.
Don't have Arch installed, either. I'm just maintaining Gentoo ebuild in ::guru overlay, and currently I simply disable make check :D
There was a problem hiding this comment.
Wait, I forgot I can check using the archlinux docker image.
|
Looking at some of the ShellCheck errors, I think When you put a command inside of |
|
I'm fine if those checks will be disabled (globally or locally via comments). Just went the lazy approach by doing what SC proposes and making sure tests pass after that on my machine :D |
Resolves: #442