|
From: | Matias Fonzo |
Subject: | Re: [Dragora-members] Qi 2.0rc10 |
Date: | Sat, 18 Jul 2020 10:24:50 -0300 |
User-agent: | Roundcube Webmail/1.4.6 |
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. :-)
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 this code is to “set [a] random directory using 'name' as prefix”. How about using `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.
Thanks, Matías
[Prev in Thread] | Current Thread | [Next in Thread] |