[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Dragora-members] Qi 2.0rc10
From: |
Michael Siegel |
Subject: |
Re: [Dragora-members] Qi 2.0rc10 |
Date: |
Sat, 18 Jul 2020 12:12:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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: In
>> POSIX 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 from
> shellcheck.
>
>>
>> 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 will
> be 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 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 the
> shells 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?
Best
Michael