~mil/mepo-devel

3 2

Non Posix-Compliance found

Details
Message ID
<CNMGENEL2IK1.EDA2DJ58TFLP@PhilippN-Vostro-5490>
DKIM signature
pass
Download raw message
Hi again, sorry for flooding this list.

I don't know how important that is for Mepo, but I think it should at
least be noted that in in `mepo_ui_helper_menu.sh`, `xargs` is invoked
with the -d flag, which is not standardized by POSIX, and not
implemented by busybox xargs. Maybe you should consider an alternative.
The first construct that comes to my mind right now is doing something
ugly like

while read -r option; do
  CHOICES="$CHOICES \"$option\""
  done
  zenity <options> $CHOICES # Note the omission of quotes around CHOICES

I'm sure there is a better alternative, I just can't think of it right
now (which could be related to the fact that I haven't slept in 24h),
maybe it's possible to do something with awk, but unfortunately I
don't
know awk. However, I think you get the idea that POSIX compliance is
important, especially with the fact in mind that postmarketOS, uses
just
busybox coreutils.

Regards,
laalsaas
Details
Message ID
<87k051kqvy.fsf@aol.com>
In-Reply-To
<CNMGENEL2IK1.EDA2DJ58TFLP@PhilippN-Vostro-5490> (view parent)
DKIM signature
pass
Download raw message
> However, I think you get the idea that POSIX compliance is important, especially with the fact in mind that postmarketOS, uses just busybox coreutils.

I too would prefer POSIX compliance. Grepping the codebase, I see a few references to ignoring shellcheck[1] warnings, but no Git hooks or anything, so I'm supposing it's up to the devs to use shellcheck on their own?? I know it catches some POSIX compliance issues but misses others[2], but it could be a step in the right direction!

~ Hendursaga

[1] https://www.shellcheck.net/
[2] https://github.com/koalaman/shellcheck/issues/2125
Details
Message ID
<23f229e4-0b9e-4373-886b-cc3e136eb8ff@app.fastmail.com>
In-Reply-To
<CNMGENEL2IK1.EDA2DJ58TFLP@PhilippN-Vostro-5490> (view parent)
DKIM signature
pass
Download raw message
On Sat, Oct 15, 2022, at 7:18 AM, laalsaas wrote:
> Hi again, sorry for flooding this list.
>
> I don't know how important that is for Mepo, but I think it should at
> least be noted that in in `mepo_ui_helper_menu.sh`, `xargs` is invoked
> with the -d flag, which is not standardized by POSIX, and not
> implemented by busybox xargs. Maybe you should consider an alternative.
> The first construct that comes to my mind right now is doing something
> ugly like
>
> while read -r option; do
>   CHOICES="$CHOICES \"$option\""
>   done
>   zenity <options> $CHOICES # Note the omission of quotes around CHOICES
>
> I'm sure there is a better alternative, I just can't think of it right
> now (which could be related to the fact that I haven't slept in 24h),
> maybe it's possible to do something with awk, but unfortunately I
> don't
> know awk. However, I think you get the idea that POSIX compliance is
> important, especially with the fact in mind that postmarketOS, uses
> just
> busybox coreutils.
>
> Regards,
> laalsaas

Hi laalsaas,

Completely agreed on my end that using `xargs -d` is not ideal since its
non-POSIX. The -d flag here needed for feeding the params into zenity
was the sole reason for the introduction of `findutils` as a dependency
in 1.0 and I would love to get rid of this dependency.

I've played around with alternatives for a bit and couldn't get things
to cooperate without `xargs -d` however; including with the while loop
suggestion you provided.

If you manage to figure out a directly POSIX compatible way so that we
can get rid of using findutils/GNU xargs as a dependency please send to
the list as patch and I'll take a look and apply.

Also no need to apologize about flooding the list - your feedback
and looking into these things to improve the codebase is very much
appreciated.

Miles
Details
Message ID
<f2955927-217b-4476-9035-e1ac6d04b633@app.fastmail.com>
In-Reply-To
<87k051kqvy.fsf@aol.com> (view parent)
DKIM signature
pass
Download raw message
On Sat, Oct 15, 2022, at 12:12 PM, Hendursaga wrote:
>> However, I think you get the idea that POSIX compliance is important, especially with the fact in mind that postmarketOS, uses just busybox coreutils.
>
> I too would prefer POSIX compliance. Grepping the codebase, I see a few 
> references to ignoring shellcheck[1] warnings, but no Git hooks or 
> anything, so I'm supposing it's up to the devs to use shellcheck on 
> their own?? I know it catches some POSIX compliance issues but misses 
> others[2], but it could be a step in the right direction!
>
> ~ Hendursaga
>
> [1] https://www.shellcheck.net/
> [2] https://github.com/koalaman/shellcheck/issues/2125

There is a script in `scriptsdev/` to run shellcheck against all scripts
that I had been using earlier on in development but unforunately fell
out of sync with. It's on my todo list to reinstate shellcheck - it
seems there are only a few errors; thanks for the reminder.

Ideally / eventually instituting CI, git hook as you mentioned, or similar
(atleast prior to tagging) to make sure all scripts always pass shellcheck
would be ideal.
Reply to thread Export thread (mbox)