|
From: | Matias Fonzo |
Subject: | Re: [Dragora-members] Qi 2.0rc10 |
Date: | Sat, 18 Jul 2020 11:59:27 -0300 |
User-agent: | Roundcube Webmail/1.4.6 |
El 2020-07-18 10:24, Matias Fonzo escribió:
El 2020-07-18 07:12, Michael Siegel escribió:Am 15.07.20 um 23:31 schrieb Matias Fonzo:El 2020-07-14 09:52, Michael Siegel escribió:Am 14.07.20 um 13:20 schrieb Matias Fonzo:There were a few more issues when I ran shellcheck on rc10, the most important being: In qi.in line 543: echo ",s/^\\(release\\)=.*/\\1=${release}/"$'\nw' | \^-- SC2039: InPOSIX sh, $'..' is undefined.That's needed for the input of ed(1). '$' means the last line in the buffer followed by the commands.I don't know how to do in another way in order to avoid the warning fromshellcheck.In qi.in line 881: rm -rf -- "$rootdir${packagedir}/$replace" ^-- SC2115: Use "${var:?}" to ensure this never expands to / .Note that rootdir is a prefix to a defined and given directory by the user. The same one is validated and qualify previously in Qi:We cannot use "${rootdir:?}" for every line marked by shellcheck because it will defeat its purpose of having a prefix directory, the value willbe equal to '?' if not defined - if we follow the suggestion from shellcheck...Okay, I see. So, there is no possibility that $packagedir might be empty?In theory, no.. because it is validated and qualified, previously. I'll probably make this readonly (once defined) now that you mention it. :-)
Done. This required some minor modifications so that packagedir could be fully readonly, since its value was changed from the upgrade mode to proceed with installation mode at the (custom) random location.
In qi.in line 1060: PRVDIR="${TMPDIR}/${name}.${RANDOM-0}$$" ^-- SC2039: In POSIX sh, RANDOM is undefined.If the shell does not define the environment variable RANDOM, its value will be equal to 0 here. Otherwise it takes advantage of RANDOM for theshells that define it.Well, the comment right above that line says that the purpose of thiscode is to “set [a] random directory using 'name' as prefix”. How aboutusing `mktemp -d' for creating that directory then?`mktemp' is used in the upgrade mode/action where it needs to be more random. The current composed $PRVDIR correspond to the extraction mode/action, must be a random directory for simple access.
Well, at a second glance, it made me do this with mktemp, since the previous lines took time and then mktemp was implemented as a requirement. Well, it's not out of place to use mktemp to avoid possible duplicate names, possible error. Thank you.
I'm attaching a new version of Qi in another email.
Thanks, Matías
[Prev in Thread] | Current Thread | [Next in Thread] |