@keszybz commented on this pull request.


> +     if [ "-" = "$fn" ]; then
+          parse <&0
+       else
+               [ -r "$fn" ] || continue
+               parse <"$fn"

Indentation is strange, also in other places.

> +[ -e "$ROOT"/etc/passwd ] || touch "$ROOT"/etc/passwd
+[ -e "$ROOT"/etc/shadow ] || touch "$ROOT"/etc/shadow
+[ -e "$ROOT"/etc/group ] || touch "$ROOT"/etc/group

Why? Shouldn't things work even if those files are missing?


> @@ -0,0 +1,150 @@
+#!/bin/sh

Shellcheck says:

In sysusers.sh line 57:
                hasuser "$user" || \\
                                   ^-- SC2288 (warning): This is interpreted as 
a command name ending with '\'. Double check syntax.


In sysusers.sh line 92:
                { [ "${line:0:1}" = '#' ] || [ "${line:0:1}" = ';' ]; } && 
continue
                     ^---------^ SC3057 (warning): In POSIX sh, string indexing 
is undefined.
                                                ^---------^ SC3057 (warning): 
In POSIX sh, string indexing is undefined.


In sysusers.sh line 96:
                case "${arr[0]}" in
                      ^-------^ SC2154 (warning): arr is referenced but not 
assigned.
                      ^-------^ SC3054 (warning): In POSIX sh, array references 
are undefined.


In sysusers.sh line 98:
                                if [[ "${arr[2]}" == *":"* ]]; then
                                   ^------------------------^ SC3010 (warning): 
In POSIX sh, [[ ]] is undefined.
                                       ^-------^ SC3054 (warning): In POSIX sh, 
array references are undefined.


In sysusers.sh line 99:
                                        user "${arr[1]}" "${arr[2]%:*}" 
"${arr[3]}" "${arr[2]#*:}" "${arr[4]}" "${arr[5]}"
                                              ^-------^ SC3054 (warning): In 
POSIX sh, array references are undefined.
                                                                         
^-------^ SC3054 (warning): In POSIX sh, array references are undefined.
                                                                                
                    ^-------^ SC3054 (warning): In POSIX sh, array references 
are undefined.
                                                                                
                                ^-------^ SC3054 (warning): In POSIX sh, array 
references are undefined.


In sysusers.sh line 101:
                                        group "${arr[1]}" "${arr[2]}"
                                               ^-------^ SC3054 (warning): In 
POSIX sh, array references are undefined.
                                                           ^-------^ SC3054 
(warning): In POSIX sh, array references are undefined.


In sysusers.sh line 102:
                                        user "${arr[1]}" "${arr[2]}" 
"${arr[3]}" "${arr[1]}" "${arr[4]}" "${arr[5]}"
                                              ^-------^ SC3054 (warning): In 
POSIX sh, array references are undefined.
                                                          ^-------^ SC3054 
(warning): In POSIX sh, array references are undefined.
                                                                      ^-------^ 
SC3054 (warning): In POSIX sh, array references are undefined.
                                                                                
  ^-------^ SC3054 (warning): In POSIX sh, array references are undefined.
                                                                                
              ^-------^ SC3054 (warning): In POSIX sh, array references are 
undefined.
                                                                                
                          ^-------^ SC3054 (warning): In POSIX sh, array 
references are undefined.


In sysusers.sh line 106:
                                group "${arr[1]}" "${arr[2]}"
                                       ^-------^ SC3054 (warning): In POSIX sh, 
array references are undefined.
                                                   ^-------^ SC3054 (warning): 
In POSIX sh, array references are undefined.


In sysusers.sh line 109:
                                group "${arr[2]}" "-"
                                       ^-------^ SC3054 (warning): In POSIX sh, 
array references are undefined.


In sysusers.sh line 110:
                                user "${arr[1]}" "-" "" "${arr[1]}" "" ""
                                      ^-------^ SC3054 (warning): In POSIX sh, 
array references are undefined.
                                                         ^-------^ SC3054 
(warning): In POSIX sh, array references are undefined.


In sysusers.sh line 111:
                                usermod "${arr[1]}" "${arr[2]}"
                                         ^-------^ SC3054 (warning): In POSIX 
sh, array references are undefined.
                                                     ^-------^ SC3054 
(warning): In POSIX sh, array references are undefined.


In sysusers.sh line 127:
        REPLACEDIR=`dirname "$REPLACE"`
                   ^------------------^ SC2006 (style): Use $(...) notation 
instead of legacy backticks `...`.

Did you mean: 
        REPLACEDIR=$(dirname "$REPLACE")


In sysusers.sh line 128:
        REPLACENAME=`basename "$REPLACE"`
                    ^-------------------^ SC2006 (style): Use $(...) notation 
instead of legacy backticks `...`.

Did you mean: 
        REPLACENAME=$(basename "$REPLACE")


In sysusers.sh line 129:
        if [[ "$REPLACEDIR" == "${SYSTEMDIR}" ]] ; then
           ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.


In sysusers.sh line 138:
        if [[ "$REPLACEDIR" == "$RUNTIMEDIR" ]] ; then
           ^-- SC3010 (warning): In POSIX sh, [[ ]] is undefined.

For more information:
  https://www.shellcheck.net/wiki/SC2154 -- arr is referenced but not assigned.
  https://www.shellcheck.net/wiki/SC2288 -- This is interpreted as a command ...
  https://www.shellcheck.net/wiki/SC3010 -- In POSIX sh, [[ ]] is undefined.


> @@ -0,0 +1,150 @@
+#!/bin/sh

It's generally good practice to have (new) shell code shellcheck-clean.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2573#pullrequestreview-1545070763
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2573/review/1545070...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to