-
Notifications
You must be signed in to change notification settings - Fork 1
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
Several syntax errors on bash versions shipped in many distros #5
Comments
There's also many misspellings, including at least one command. Line 306: |
Temporary files should be created with mktemp, a temp directory is entirely unnecessary. |
Thanks for mktemp mention 👍 |
I've provided what I believe to be a fix. Are lines 156-158 of quickget just for debug? It looks that way, as it just prints out the URL, hash, etc, which doesn't need to be presented to the end user. |
My intent by creating a TMPDIR in quickget was to provide a consistent place for any temporary files and the guaranty that they will get deleted no matter how the script is ended. I agree using mktemp for the directory is a better solution but just making temporary files that don;t get deleted is not. Looks like you method of passing associative arrays back from a function works with less bash restrictions than the way I did it. Thanks |
I notice that your refactor still has a test for Bash 4+. Version 5 has been circulating for some years now and is fairly standard. Have your tested your refactored code on Bash 4? I wonder if you should consider moving that test to 5+ |
I am not opposed to moving to 5+ but I think this should follow quickemu |
I think it is wrong to test a script on Bash 5 and then just let people on Bash 4 go ahead and use it without any warning. This is what I originally did with qqX:
But writing this has made me I think that I want to improve this a bit further, also for myself. I don't like just telling people to update and kicking them out of the door either. Basically, I just copy and pasted @ flexiondotorg 's code and gave it a bit more UX info ... So, on reflection, I am now doing this with qqX for the new release:
I think this works better. Also given that we/you are refactoring/restructuring pretty much most of quickget, we shouldn't ignore this bit just because it is not fixed in quickemu. Two wrongs don't make a right ... Paste this into a script and set the value to 6. See what you think. |
I currently have an Ubuntu 22.04-based system, with Bash 5.1.16 installed.
Line 13 causes the first issue. I'm not sure The formatting leaves BASE_DIR with a blank string regardless of where it's run from, so unless you're already within the quickget directory, the command will fail. Instead,
$(dirname "${0}")
could be used to find the directory quickget is stored in. Changing directories also should not be used unless absolutely necessary, as it could cause other unforeseen issues. Instead, each specific command should call the directory. Rather than running 'ls' after changing into the ${PLUGINS} directory, for example, you should usels ${PLUGINS}
.All of the plugins are completely broken on Bash 5.1.16, but they do work on Bash 5.2.26. The error specifically is with the lines using the
@k
operator on an array. Here's the error a bash shell prior to version 5.2 will throw../quickget_plugins/alma.plug: line 48: ${editions[@]@k}: bad substitution
. I believe this loop is what you need to achieve the same functionality in other bash versions.for edition in "${!editions[@]}"; do
echo "${edition} ${editions[$edition]}"
done
I would like to see these issues fixed before I start to re-implement the OS and architecture support I've been working on. The original quickget requires a bash version of 4.0, this must at least work on bash versions prior to the very newest 5.2 to be able to replace it.
The text was updated successfully, but these errors were encountered: