* [PATCH] utils/net/rtnet.in: fixes after shellcheck inspection
@ 2022-05-03 8:22 Mauro S.
2022-05-05 13:03 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-05-03 8:22 UTC (permalink / raw)
To: xenomai
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.in | 76 +++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb0a..06e796cd2 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
debug_func() {
echo "$*"
- eval $*
+ eval "$*"
}
usage() {
@@ -33,35 +33,35 @@ EOF
init_rtnet() {
modprobe rtnet >/dev/null || exit 1
modprobe rtipv4 >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
for dev in $REBIND_RT_NICS; do
- if [ -d /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+ if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
+ echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
fi
- echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+ echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
done
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
modprobe rt_loopback >/dev/null || exit 1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
modprobe rtcap >/dev/null || exit 1
fi
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
$RTIFCONFIG rtlo up 127.0.0.1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
ifconfig rteth0 up
ifconfig rteth0-mac up
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
ifconfig rtlo up
fi
fi
@@ -74,9 +74,9 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up $STATION_IP
+ $RTIFCONFIG rteth0 up "$STATION_IP"
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
@@ -96,7 +96,7 @@ submit_cfg() {
ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
;;
backup-master)
if [ ! "$STATION_IP" = "" ]; then
@@ -117,7 +117,7 @@ submit_cfg() {
fi
echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - "$STAGE_2_OPT"
;;
esac
@@ -142,16 +142,16 @@ start_master() {
# Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
# + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
$TDMACFG rteth0 slot 0 0
OFFSET=$TDMA_OFFSET
for SLAVE in $TDMA_SLAVES; do
echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR
\$NETMASK_OPT" | \
- $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
- OFFSET=$(($OFFSET+$TDMA_OFFSET))
+ $RTCFG rteth0 add "$SLAVE" -stage1 - "$STAGE_2_OPT"
+ OFFSET=$((OFFSET+TDMA_OFFSET))
done
else
# Get setup from TDMA_CONFIG file:
@@ -185,12 +185,12 @@ start_master() {
# slot ...
#
- if [ ! -r $TDMA_CONFIG ]; then
+ if [ ! -r "$TDMA_CONFIG" ]; then
echo "Could not read $TDMA_CONFIG"
exit 1
fi
- while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+ while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
case "$ARG1" in
"master:")
submit_cfg
@@ -217,7 +217,7 @@ start_master() {
STATION_MAC="$ARG2"
;;
"stage2")
- STATION_STAGE_2="$ARG2"
+ STATION_STAGE_2_SRC="$ARG2"
;;
"slot")
TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
@@ -233,13 +233,13 @@ start_master() {
TDMA_SLOTS="$TDMA_SLOTS;"
;;
esac
- done < $TDMA_CONFIG
+ done < "$TDMA_CONFIG"
submit_cfg
fi
- ifconfig vnic0 up $IPADDR $NETMASK_OPT
+ ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
- echo -n "Waiting for all slaves..."
+ echo "Waiting for all slaves..."
$RTCFG rteth0 wait
$RTCFG rteth0 ready
echo
@@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
shift 2
fi
-if [ -r $RTNETCFG ]; then
- . $RTNETCFG
+if [ -r "$RTNETCFG" ]; then
+ . "$RTNETCFG"
else
echo "Could not read $RTNETCFG"
exit 1
@@ -281,20 +281,20 @@ case "$1" in
start)
init_rtnet
- if [ $TDMA_MODE = "master" ]; then
+ if [ "$TDMA_MODE" = "master" ]; then
start_master
else
$TDMACFG rteth0 slave
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" "$NETMASK_OPT"
- echo -n "Stage 1: searching for master..."
- eval "`$RTCFG rteth0 client -c`"
+ echo "Stage 1: searching for master..."
+ eval "$($RTCFG rteth0 client -c)"
echo
- echo -n "Stage 2: waiting for other slaves..."
+ echo "Stage 2: waiting for other slaves..."
if [ ! "$STAGE_2_DST" = "" ]; then
- $RTCFG rteth0 announce -f $STAGE_2_DST
+ $RTCFG rteth0 announce -f "$STAGE_2_DST"
echo
eval "$STAGE_2_CMDS"
else
@@ -302,7 +302,7 @@ case "$1" in
echo
fi
- echo -n "Stage 3: waiting for common setup completion..."
+ echo "Stage 3: waiting for common setup completion..."
$RTCFG rteth0 ready
echo
fi
@@ -317,10 +317,10 @@ case "$1" in
$RTIFCONFIG rteth0 down 2>/dev/null
$RTIFCONFIG rtlo down 2>/dev/null
- rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
+ rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
for dev in $REBIND_RT_NICS; do
- echo 1 > /sys/bus/pci/devices/$dev/remove
+ echo 1 > /sys/bus/pci/devices/"$dev"/remove
done
if [ ! "$REBIND_RT_NICS" = "" ]; then
sleep 1
@@ -337,7 +337,7 @@ case "$1" in
capture)
modprobe rtnet >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
modprobe rtcap >/dev/null || exit 1
$RTIFCONFIG rteth0 up promisc
ifconfig rteth0 up
@@ -349,7 +349,7 @@ case "$1" in
modprobe rtipv4 >/dev/null || exit 1
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
modprobe rt_loopback >/dev/null || exit 1
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-03 8:22 [PATCH] utils/net/rtnet.in: fixes after shellcheck inspection Mauro S.
@ 2022-05-05 13:03 ` Jan Kiszka
2022-05-05 15:12 ` [PATCH v2] " Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-05-05 13:03 UTC (permalink / raw)
To: Mauro S., xenomai
On 03.05.22 10:22, Mauro S. via Xenomai wrote:
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.in | 76 +++++++++++++++++++++++-----------------------
> 1 file changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index f81a7bb0a..06e796cd2 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>
> debug_func() {
> echo "$*"
> - eval $*
> + eval "$*"
That may not work for all inputs as it breaks up formerly quoted
arguments and separates them by $IFS. You rather want "$@" to preserve
their structure.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-05 13:03 ` Jan Kiszka
@ 2022-05-05 15:12 ` Mauro S.
2022-05-05 15:25 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-05-05 15:12 UTC (permalink / raw)
To: xenomai
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.in | 76 +++++++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb0a..9f136b804 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
debug_func() {
echo "$*"
- eval $*
+ eval "$@"
}
usage() {
@@ -33,35 +33,35 @@ EOF
init_rtnet() {
modprobe rtnet >/dev/null || exit 1
modprobe rtipv4 >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
for dev in $REBIND_RT_NICS; do
- if [ -d /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+ if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
+ echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
fi
- echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+ echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
done
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
modprobe rt_loopback >/dev/null || exit 1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
modprobe rtcap >/dev/null || exit 1
fi
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
$RTIFCONFIG rtlo up 127.0.0.1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
ifconfig rteth0 up
ifconfig rteth0-mac up
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
ifconfig rtlo up
fi
fi
@@ -74,9 +74,9 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up $STATION_IP
+ $RTIFCONFIG rteth0 up "$STATION_IP"
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
@@ -96,7 +96,7 @@ submit_cfg() {
ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
;;
backup-master)
if [ ! "$STATION_IP" = "" ]; then
@@ -117,7 +117,7 @@ submit_cfg() {
fi
echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - "$STAGE_2_OPT"
;;
esac
@@ -142,16 +142,16 @@ start_master() {
# Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
# + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
$TDMACFG rteth0 slot 0 0
OFFSET=$TDMA_OFFSET
for SLAVE in $TDMA_SLAVES; do
echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR
\$NETMASK_OPT" | \
- $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
- OFFSET=$(($OFFSET+$TDMA_OFFSET))
+ $RTCFG rteth0 add "$SLAVE" -stage1 - "$STAGE_2_OPT"
+ OFFSET=$((OFFSET+TDMA_OFFSET))
done
else
# Get setup from TDMA_CONFIG file:
@@ -185,12 +185,12 @@ start_master() {
# slot ...
#
- if [ ! -r $TDMA_CONFIG ]; then
+ if [ ! -r "$TDMA_CONFIG" ]; then
echo "Could not read $TDMA_CONFIG"
exit 1
fi
- while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+ while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
case "$ARG1" in
"master:")
submit_cfg
@@ -217,7 +217,7 @@ start_master() {
STATION_MAC="$ARG2"
;;
"stage2")
- STATION_STAGE_2="$ARG2"
+ STATION_STAGE_2_SRC="$ARG2"
;;
"slot")
TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
@@ -233,13 +233,13 @@ start_master() {
TDMA_SLOTS="$TDMA_SLOTS;"
;;
esac
- done < $TDMA_CONFIG
+ done < "$TDMA_CONFIG"
submit_cfg
fi
- ifconfig vnic0 up $IPADDR $NETMASK_OPT
+ ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
- echo -n "Waiting for all slaves..."
+ echo "Waiting for all slaves..."
$RTCFG rteth0 wait
$RTCFG rteth0 ready
echo
@@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
shift 2
fi
-if [ -r $RTNETCFG ]; then
- . $RTNETCFG
+if [ -r "$RTNETCFG" ]; then
+ . "$RTNETCFG"
else
echo "Could not read $RTNETCFG"
exit 1
@@ -281,20 +281,20 @@ case "$1" in
start)
init_rtnet
- if [ $TDMA_MODE = "master" ]; then
+ if [ "$TDMA_MODE" = "master" ]; then
start_master
else
$TDMACFG rteth0 slave
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" "$NETMASK_OPT"
- echo -n "Stage 1: searching for master..."
- eval "`$RTCFG rteth0 client -c`"
+ echo "Stage 1: searching for master..."
+ eval "$($RTCFG rteth0 client -c)"
echo
- echo -n "Stage 2: waiting for other slaves..."
+ echo "Stage 2: waiting for other slaves..."
if [ ! "$STAGE_2_DST" = "" ]; then
- $RTCFG rteth0 announce -f $STAGE_2_DST
+ $RTCFG rteth0 announce -f "$STAGE_2_DST"
echo
eval "$STAGE_2_CMDS"
else
@@ -302,7 +302,7 @@ case "$1" in
echo
fi
- echo -n "Stage 3: waiting for common setup completion..."
+ echo "Stage 3: waiting for common setup completion..."
$RTCFG rteth0 ready
echo
fi
@@ -317,10 +317,10 @@ case "$1" in
$RTIFCONFIG rteth0 down 2>/dev/null
$RTIFCONFIG rtlo down 2>/dev/null
- rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
+ rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
for dev in $REBIND_RT_NICS; do
- echo 1 > /sys/bus/pci/devices/$dev/remove
+ echo 1 > /sys/bus/pci/devices/"$dev"/remove
done
if [ ! "$REBIND_RT_NICS" = "" ]; then
sleep 1
@@ -337,7 +337,7 @@ case "$1" in
capture)
modprobe rtnet >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
modprobe rtcap >/dev/null || exit 1
$RTIFCONFIG rteth0 up promisc
ifconfig rteth0 up
@@ -349,7 +349,7 @@ case "$1" in
modprobe rtipv4 >/dev/null || exit 1
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
modprobe rt_loopback >/dev/null || exit 1
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-05 15:12 ` [PATCH v2] " Mauro S.
@ 2022-05-05 15:25 ` Jan Kiszka
2022-05-05 15:39 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-05-05 15:25 UTC (permalink / raw)
To: Mauro S., xenomai
On 05.05.22 17:12, Mauro S. wrote:
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.in | 76 +++++++++++++++++++++++-----------------------
> 1 file changed, 38 insertions(+), 38 deletions(-)
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index f81a7bb0a..9f136b804 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>
> debug_func() {
> echo "$*"
> - eval $*
> + eval "$@"
> }
>
> usage() {
> @@ -33,35 +33,35 @@ EOF
> init_rtnet() {
> modprobe rtnet >/dev/null || exit 1
> modprobe rtipv4 >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>
> for dev in $REBIND_RT_NICS; do
> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
> fi
> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
> done
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> modprobe rt_loopback >/dev/null || exit 1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> modprobe rtcap >/dev/null || exit 1
> fi
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> $RTIFCONFIG rtlo up 127.0.0.1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> ifconfig rteth0 up
> ifconfig rteth0-mac up
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> ifconfig rtlo up
> fi
> fi
> @@ -74,9 +74,9 @@ init_rtnet() {
> submit_cfg() {
> case "$STATION_TYPE" in
> master)
> - $RTIFCONFIG rteth0 up $STATION_IP
> + $RTIFCONFIG rteth0 up "$STATION_IP"
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> eval "$TDMA_SLOTS"
>
> IPADDR=$STATION_IP
> @@ -96,7 +96,7 @@ submit_cfg() {
> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>
> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
> ;;
> backup-master)
> if [ ! "$STATION_IP" = "" ]; then
> @@ -117,7 +117,7 @@ submit_cfg() {
> fi
>
> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - "$STAGE_2_OPT"
> ;;
> esac
>
> @@ -142,16 +142,16 @@ start_master() {
> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> $TDMACFG rteth0 slot 0 0
>
> OFFSET=$TDMA_OFFSET
> for SLAVE in $TDMA_SLAVES; do
> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
> \$IPADDR \$NETMASK_OPT" | \
> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
> + $RTCFG rteth0 add "$SLAVE" -stage1 - "$STAGE_2_OPT"
> + OFFSET=$((OFFSET+TDMA_OFFSET))
> done
> else
> # Get setup from TDMA_CONFIG file:
> @@ -185,12 +185,12 @@ start_master() {
> # slot ...
> #
>
> - if [ ! -r $TDMA_CONFIG ]; then
> + if [ ! -r "$TDMA_CONFIG" ]; then
> echo "Could not read $TDMA_CONFIG"
> exit 1
> fi
>
> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> case "$ARG1" in
> "master:")
> submit_cfg
> @@ -217,7 +217,7 @@ start_master() {
> STATION_MAC="$ARG2"
> ;;
> "stage2")
> - STATION_STAGE_2="$ARG2"
> + STATION_STAGE_2_SRC="$ARG2"
> ;;
> "slot")
> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
> @@ -233,13 +233,13 @@ start_master() {
> TDMA_SLOTS="$TDMA_SLOTS;"
> ;;
> esac
> - done < $TDMA_CONFIG
> + done < "$TDMA_CONFIG"
> submit_cfg
> fi
>
> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Waiting for all slaves..."
> + echo "Waiting for all slaves..."
> $RTCFG rteth0 wait
> $RTCFG rteth0 ready
> echo
Ah, this one is another function (or more cosmetic) change: "-n" means
"no line-break", and therefore that empty "echo" at the end. You should
make both the observer and shellcheck happy by using
printf "Line without break"
instead. Same pattern also below.
> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
> shift 2
> fi
>
> -if [ -r $RTNETCFG ]; then
> - . $RTNETCFG
> +if [ -r "$RTNETCFG" ]; then
> + . "$RTNETCFG"
> else
> echo "Could not read $RTNETCFG"
> exit 1
> @@ -281,20 +281,20 @@ case "$1" in
> start)
> init_rtnet
>
> - if [ $TDMA_MODE = "master" ]; then
> + if [ "$TDMA_MODE" = "master" ]; then
> start_master
> else
> $TDMACFG rteth0 slave
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" "$NETMASK_OPT"
>
> - echo -n "Stage 1: searching for master..."
> - eval "`$RTCFG rteth0 client -c`"
> + echo "Stage 1: searching for master..."
> + eval "$($RTCFG rteth0 client -c)"
> echo
>
> - echo -n "Stage 2: waiting for other slaves..."
> + echo "Stage 2: waiting for other slaves..."
> if [ ! "$STAGE_2_DST" = "" ]; then
> - $RTCFG rteth0 announce -f $STAGE_2_DST
> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
> echo
> eval "$STAGE_2_CMDS"
> else
> @@ -302,7 +302,7 @@ case "$1" in
> echo
> fi
>
> - echo -n "Stage 3: waiting for common setup completion..."
> + echo "Stage 3: waiting for common setup completion..."
> $RTCFG rteth0 ready
> echo
> fi
> @@ -317,10 +317,10 @@ case "$1" in
> $RTIFCONFIG rteth0 down 2>/dev/null
> $RTIFCONFIG rtlo down 2>/dev/null
>
> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
> rttcp rtipv4 rtnet 2>/dev/null
> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
> rtudp rttcp rtipv4 rtnet 2>/dev/null
>
> for dev in $REBIND_RT_NICS; do
> - echo 1 > /sys/bus/pci/devices/$dev/remove
> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
> done
> if [ ! "$REBIND_RT_NICS" = "" ]; then
> sleep 1
> @@ -337,7 +337,7 @@ case "$1" in
>
> capture)
> modprobe rtnet >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
> modprobe rtcap >/dev/null || exit 1
> $RTIFCONFIG rteth0 up promisc
> ifconfig rteth0 up
> @@ -349,7 +349,7 @@ case "$1" in
> modprobe rtipv4 >/dev/null || exit 1
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> modprobe rt_loopback >/dev/null || exit 1
With that and if you also tested the result, we should be fine then.
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-05 15:25 ` Jan Kiszka
@ 2022-05-05 15:39 ` Mauro S.
2022-05-12 7:00 ` [PATCH v3] " Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-05-05 15:39 UTC (permalink / raw)
To: Jan Kiszka, xenomai
Il 05/05/22 17:25, Jan Kiszka ha scritto:
> On 05.05.22 17:12, Mauro S. wrote:
>> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
>> ---
>> utils/net/rtnet.in | 76 +++++++++++++++++++++++-----------------------
>> 1 file changed, 38 insertions(+), 38 deletions(-)
>>
>> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
>> index f81a7bb0a..9f136b804 100644
>> --- a/utils/net/rtnet.in
>> +++ b/utils/net/rtnet.in
>> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>>
>> debug_func() {
>> echo "$*"
>> - eval $*
>> + eval "$@"
>> }
>>
>> usage() {
>> @@ -33,35 +33,35 @@ EOF
>> init_rtnet() {
>> modprobe rtnet >/dev/null || exit 1
>> modprobe rtipv4 >/dev/null || exit 1
>> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
>> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>>
>> for dev in $REBIND_RT_NICS; do
>> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
>> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
>> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
>> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
>> fi
>> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
>> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
>> done
>>
>> for PROTOCOL in $RT_PROTOCOLS; do
>> - modprobe rt$PROTOCOL >/dev/null || exit 1
>> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
>> done
>>
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> modprobe rt_loopback >/dev/null || exit 1
>> fi
>>
>> - if [ $RTCAP = "yes" ]; then
>> + if [ "$RTCAP" = "yes" ]; then
>> modprobe rtcap >/dev/null || exit 1
>> fi
>>
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> $RTIFCONFIG rtlo up 127.0.0.1
>> fi
>>
>> - if [ $RTCAP = "yes" ]; then
>> + if [ "$RTCAP" = "yes" ]; then
>> ifconfig rteth0 up
>> ifconfig rteth0-mac up
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> ifconfig rtlo up
>> fi
>> fi
>> @@ -74,9 +74,9 @@ init_rtnet() {
>> submit_cfg() {
>> case "$STATION_TYPE" in
>> master)
>> - $RTIFCONFIG rteth0 up $STATION_IP
>> + $RTIFCONFIG rteth0 up "$STATION_IP"
>>
>> - $TDMACFG rteth0 master $TDMA_CYCLE
>> + $TDMACFG rteth0 master "$TDMA_CYCLE"
>> eval "$TDMA_SLOTS"
>>
>> IPADDR=$STATION_IP
>> @@ -96,7 +96,7 @@ submit_cfg() {
>> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>>
>> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
>> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
>> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
>> ;;
>> backup-master)
>> if [ ! "$STATION_IP" = "" ]; then
>> @@ -117,7 +117,7 @@ submit_cfg() {
>> fi
>>
>> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
>> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
>> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
>> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - "$STAGE_2_OPT"
>> ;;
>> esac
>>
>> @@ -142,16 +142,16 @@ start_master() {
>> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
>> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>>
>> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
>> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>>
>> - $TDMACFG rteth0 master $TDMA_CYCLE
>> + $TDMACFG rteth0 master "$TDMA_CYCLE"
>> $TDMACFG rteth0 slot 0 0
>>
>> OFFSET=$TDMA_OFFSET
>> for SLAVE in $TDMA_SLAVES; do
>> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
>> \$IPADDR \$NETMASK_OPT" | \
>> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
>> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
>> + $RTCFG rteth0 add "$SLAVE" -stage1 - "$STAGE_2_OPT"
>> + OFFSET=$((OFFSET+TDMA_OFFSET))
>> done
>> else
>> # Get setup from TDMA_CONFIG file:
>> @@ -185,12 +185,12 @@ start_master() {
>> # slot ...
>> #
>>
>> - if [ ! -r $TDMA_CONFIG ]; then
>> + if [ ! -r "$TDMA_CONFIG" ]; then
>> echo "Could not read $TDMA_CONFIG"
>> exit 1
>> fi
>>
>> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
>> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
>> case "$ARG1" in
>> "master:")
>> submit_cfg
>> @@ -217,7 +217,7 @@ start_master() {
>> STATION_MAC="$ARG2"
>> ;;
>> "stage2")
>> - STATION_STAGE_2="$ARG2"
>> + STATION_STAGE_2_SRC="$ARG2"
>> ;;
>> "slot")
>> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
>> @@ -233,13 +233,13 @@ start_master() {
>> TDMA_SLOTS="$TDMA_SLOTS;"
>> ;;
>> esac
>> - done < $TDMA_CONFIG
>> + done < "$TDMA_CONFIG"
>> submit_cfg
>> fi
>>
>> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
>> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>>
>> - echo -n "Waiting for all slaves..."
>> + echo "Waiting for all slaves..."
>> $RTCFG rteth0 wait
>> $RTCFG rteth0 ready
>> echo
>
> Ah, this one is another function (or more cosmetic) change: "-n" means
> "no line-break", and therefore that empty "echo" at the end. You should
> make both the observer and shellcheck happy by using
>
> printf "Line without break"
>
> instead. Same pattern also below.
Yes, you are right. I followed too strictly the shellcheck warnings :-)
Thanks.
>
>> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
>> shift 2
>> fi
>>
>> -if [ -r $RTNETCFG ]; then
>> - . $RTNETCFG
>> +if [ -r "$RTNETCFG" ]; then
>> + . "$RTNETCFG"
>> else
>> echo "Could not read $RTNETCFG"
>> exit 1
>> @@ -281,20 +281,20 @@ case "$1" in
>> start)
>> init_rtnet
>>
>> - if [ $TDMA_MODE = "master" ]; then
>> + if [ "$TDMA_MODE" = "master" ]; then
>> start_master
>> else
>> $TDMACFG rteth0 slave
>>
>> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
>> + $RTIFCONFIG rteth0 up "$IPADDR" "$NETMASK_OPT"
>>
>> - echo -n "Stage 1: searching for master..."
>> - eval "`$RTCFG rteth0 client -c`"
>> + echo "Stage 1: searching for master..."
>> + eval "$($RTCFG rteth0 client -c)"
>> echo
>>
>> - echo -n "Stage 2: waiting for other slaves..."
>> + echo "Stage 2: waiting for other slaves..."
>> if [ ! "$STAGE_2_DST" = "" ]; then
>> - $RTCFG rteth0 announce -f $STAGE_2_DST
>> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
>> echo
>> eval "$STAGE_2_CMDS"
>> else
>> @@ -302,7 +302,7 @@ case "$1" in
>> echo
>> fi
>>
>> - echo -n "Stage 3: waiting for common setup completion..."
>> + echo "Stage 3: waiting for common setup completion..."
>> $RTCFG rteth0 ready
>> echo
>> fi
>> @@ -317,10 +317,10 @@ case "$1" in
>> $RTIFCONFIG rteth0 down 2>/dev/null
>> $RTIFCONFIG rtlo down 2>/dev/null
>>
>> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
>> rttcp rtipv4 rtnet 2>/dev/null
>> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
>> rtudp rttcp rtipv4 rtnet 2>/dev/null
>>
>> for dev in $REBIND_RT_NICS; do
>> - echo 1 > /sys/bus/pci/devices/$dev/remove
>> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
>> done
>> if [ ! "$REBIND_RT_NICS" = "" ]; then
>> sleep 1
>> @@ -337,7 +337,7 @@ case "$1" in
>>
>> capture)
>> modprobe rtnet >/dev/null || exit 1
>> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
>> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>> modprobe rtcap >/dev/null || exit 1
>> $RTIFCONFIG rteth0 up promisc
>> ifconfig rteth0 up
>> @@ -349,7 +349,7 @@ case "$1" in
>> modprobe rtipv4 >/dev/null || exit 1
>>
>> for PROTOCOL in $RT_PROTOCOLS; do
>> - modprobe rt$PROTOCOL >/dev/null || exit 1
>> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
>> done
>>
>> modprobe rt_loopback >/dev/null || exit 1
>
> With that and if you also tested the result, we should be fine then.
>
> Jan
>
I'm testing it, I will send the final patch when tests are done.
Thanks
--
Mauro S.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-05 15:39 ` Mauro S.
@ 2022-05-12 7:00 ` Mauro S.
2022-06-23 6:37 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-05-12 7:00 UTC (permalink / raw)
To: xenomai
Remaning shellcheck warnings:
- "SC2086: Double quote to prevent globbing and word splitting."
line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
Suggested fix not applicable because these variables can be empty,
resulting in command failure due to "" in command line
- "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
STAGE_2_OPT is."
line 296. STAGE_2_DST comes from included RTNETCFG file
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb0a..cd24017b4 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
debug_func() {
echo "$*"
- eval $*
+ eval "$@"
}
usage() {
@@ -33,35 +33,35 @@ EOF
init_rtnet() {
modprobe rtnet >/dev/null || exit 1
modprobe rtipv4 >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
for dev in $REBIND_RT_NICS; do
- if [ -d /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+ if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
+ echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
fi
- echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+ echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
done
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
modprobe rt_loopback >/dev/null || exit 1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
modprobe rtcap >/dev/null || exit 1
fi
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
$RTIFCONFIG rtlo up 127.0.0.1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
ifconfig rteth0 up
ifconfig rteth0-mac up
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
ifconfig rtlo up
fi
fi
@@ -74,9 +74,9 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up $STATION_IP
+ $RTIFCONFIG rteth0 up "$STATION_IP"
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
@@ -96,7 +96,7 @@ submit_cfg() {
ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
;;
backup-master)
if [ ! "$STATION_IP" = "" ]; then
@@ -117,7 +117,7 @@ submit_cfg() {
fi
echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
;;
esac
@@ -142,16 +142,16 @@ start_master() {
# Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
# + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
$TDMACFG rteth0 slot 0 0
OFFSET=$TDMA_OFFSET
for SLAVE in $TDMA_SLAVES; do
echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR
\$NETMASK_OPT" | \
- $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
- OFFSET=$(($OFFSET+$TDMA_OFFSET))
+ $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
+ OFFSET=$((OFFSET+TDMA_OFFSET))
done
else
# Get setup from TDMA_CONFIG file:
@@ -185,12 +185,12 @@ start_master() {
# slot ...
#
- if [ ! -r $TDMA_CONFIG ]; then
+ if [ ! -r "$TDMA_CONFIG" ]; then
echo "Could not read $TDMA_CONFIG"
exit 1
fi
- while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+ while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
case "$ARG1" in
"master:")
submit_cfg
@@ -217,7 +217,7 @@ start_master() {
STATION_MAC="$ARG2"
;;
"stage2")
- STATION_STAGE_2="$ARG2"
+ STATION_STAGE_2_SRC="$ARG2"
;;
"slot")
TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
@@ -233,16 +233,16 @@ start_master() {
TDMA_SLOTS="$TDMA_SLOTS;"
;;
esac
- done < $TDMA_CONFIG
+ done < "$TDMA_CONFIG"
submit_cfg
fi
- ifconfig vnic0 up $IPADDR $NETMASK_OPT
+ ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
- echo -n "Waiting for all slaves..."
+ printf "Waiting for all slaves..."
$RTCFG rteth0 wait
$RTCFG rteth0 ready
- echo
+ printf "\n"
}
@@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
shift 2
fi
-if [ -r $RTNETCFG ]; then
- . $RTNETCFG
+if [ -r "$RTNETCFG" ]; then
+ . "$RTNETCFG"
else
echo "Could not read $RTNETCFG"
exit 1
@@ -281,30 +281,30 @@ case "$1" in
start)
init_rtnet
- if [ $TDMA_MODE = "master" ]; then
+ if [ "$TDMA_MODE" = "master" ]; then
start_master
else
$TDMACFG rteth0 slave
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- echo -n "Stage 1: searching for master..."
- eval "`$RTCFG rteth0 client -c`"
- echo
+ printf "Stage 1: searching for master..."
+ eval "$($RTCFG rteth0 client -c)"
+ printf "\n"
- echo -n "Stage 2: waiting for other slaves..."
+ printf "Stage 2: waiting for other slaves..."
if [ ! "$STAGE_2_DST" = "" ]; then
- $RTCFG rteth0 announce -f $STAGE_2_DST
- echo
+ $RTCFG rteth0 announce -f "$STAGE_2_DST"
+ printf "\n"
eval "$STAGE_2_CMDS"
else
$RTCFG rteth0 announce
- echo
+ printf "\n"
fi
- echo -n "Stage 3: waiting for common setup completion..."
+ printf "Stage 3: waiting for common setup completion..."
$RTCFG rteth0 ready
- echo
+ printf "\n"
fi
;;
@@ -317,10 +317,10 @@ case "$1" in
$RTIFCONFIG rteth0 down 2>/dev/null
$RTIFCONFIG rtlo down 2>/dev/null
- rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
+ rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
for dev in $REBIND_RT_NICS; do
- echo 1 > /sys/bus/pci/devices/$dev/remove
+ echo 1 > /sys/bus/pci/devices/"$dev"/remove
done
if [ ! "$REBIND_RT_NICS" = "" ]; then
sleep 1
@@ -337,7 +337,7 @@ case "$1" in
capture)
modprobe rtnet >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
modprobe rtcap >/dev/null || exit 1
$RTIFCONFIG rteth0 up promisc
ifconfig rteth0 up
@@ -349,7 +349,7 @@ case "$1" in
modprobe rtipv4 >/dev/null || exit 1
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
modprobe rt_loopback >/dev/null || exit 1
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-05-12 7:00 ` [PATCH v3] " Mauro S.
@ 2022-06-23 6:37 ` Mauro S.
2022-06-23 7:46 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-06-23 6:37 UTC (permalink / raw)
To: xenomai
Il 12/05/22 09:00, Mauro S. via Xenomai ha scritto:
> Remaning shellcheck warnings:
> - "SC2086: Double quote to prevent globbing and word splitting."
> line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
> Suggested fix not applicable because these variables can be empty,
> resulting in command failure due to "" in command line
> - "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
> STAGE_2_OPT is."
> line 296. STAGE_2_DST comes from included RTNETCFG file
>
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
> 1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index f81a7bb0a..cd24017b4 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>
> debug_func() {
> echo "$*"
> - eval $*
> + eval "$@"
> }
>
> usage() {
> @@ -33,35 +33,35 @@ EOF
> init_rtnet() {
> modprobe rtnet >/dev/null || exit 1
> modprobe rtipv4 >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>
> for dev in $REBIND_RT_NICS; do
> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
> fi
> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
> done
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> modprobe rt_loopback >/dev/null || exit 1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> modprobe rtcap >/dev/null || exit 1
> fi
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> $RTIFCONFIG rtlo up 127.0.0.1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> ifconfig rteth0 up
> ifconfig rteth0-mac up
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> ifconfig rtlo up
> fi
> fi
> @@ -74,9 +74,9 @@ init_rtnet() {
> submit_cfg() {
> case "$STATION_TYPE" in
> master)
> - $RTIFCONFIG rteth0 up $STATION_IP
> + $RTIFCONFIG rteth0 up "$STATION_IP"
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> eval "$TDMA_SLOTS"
>
> IPADDR=$STATION_IP
> @@ -96,7 +96,7 @@ submit_cfg() {
> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>
> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
> ;;
> backup-master)
> if [ ! "$STATION_IP" = "" ]; then
> @@ -117,7 +117,7 @@ submit_cfg() {
> fi
>
> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
> ;;
> esac
>
> @@ -142,16 +142,16 @@ start_master() {
> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> $TDMACFG rteth0 slot 0 0
>
> OFFSET=$TDMA_OFFSET
> for SLAVE in $TDMA_SLAVES; do
> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
> \$IPADDR \$NETMASK_OPT" | \
> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
> + $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
> + OFFSET=$((OFFSET+TDMA_OFFSET))
> done
> else
> # Get setup from TDMA_CONFIG file:
> @@ -185,12 +185,12 @@ start_master() {
> # slot ...
> #
>
> - if [ ! -r $TDMA_CONFIG ]; then
> + if [ ! -r "$TDMA_CONFIG" ]; then
> echo "Could not read $TDMA_CONFIG"
> exit 1
> fi
>
> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> case "$ARG1" in
> "master:")
> submit_cfg
> @@ -217,7 +217,7 @@ start_master() {
> STATION_MAC="$ARG2"
> ;;
> "stage2")
> - STATION_STAGE_2="$ARG2"
> + STATION_STAGE_2_SRC="$ARG2"
> ;;
> "slot")
> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
> @@ -233,16 +233,16 @@ start_master() {
> TDMA_SLOTS="$TDMA_SLOTS;"
> ;;
> esac
> - done < $TDMA_CONFIG
> + done < "$TDMA_CONFIG"
> submit_cfg
> fi
>
> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Waiting for all slaves..."
> + printf "Waiting for all slaves..."
> $RTCFG rteth0 wait
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> }
>
>
> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
> shift 2
> fi
>
> -if [ -r $RTNETCFG ]; then
> - . $RTNETCFG
> +if [ -r "$RTNETCFG" ]; then
> + . "$RTNETCFG"
> else
> echo "Could not read $RTNETCFG"
> exit 1
> @@ -281,30 +281,30 @@ case "$1" in
> start)
> init_rtnet
>
> - if [ $TDMA_MODE = "master" ]; then
> + if [ "$TDMA_MODE" = "master" ]; then
> start_master
> else
> $TDMACFG rteth0 slave
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Stage 1: searching for master..."
> - eval "`$RTCFG rteth0 client -c`"
> - echo
> + printf "Stage 1: searching for master..."
> + eval "$($RTCFG rteth0 client -c)"
> + printf "\n"
>
> - echo -n "Stage 2: waiting for other slaves..."
> + printf "Stage 2: waiting for other slaves..."
> if [ ! "$STAGE_2_DST" = "" ]; then
> - $RTCFG rteth0 announce -f $STAGE_2_DST
> - echo
> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
> + printf "\n"
> eval "$STAGE_2_CMDS"
> else
> $RTCFG rteth0 announce
> - echo
> + printf "\n"
> fi
>
> - echo -n "Stage 3: waiting for common setup completion..."
> + printf "Stage 3: waiting for common setup completion..."
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> fi
> ;;
>
> @@ -317,10 +317,10 @@ case "$1" in
> $RTIFCONFIG rteth0 down 2>/dev/null
> $RTIFCONFIG rtlo down 2>/dev/null
>
> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
> rttcp rtipv4 rtnet 2>/dev/null
> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
> rtudp rttcp rtipv4 rtnet 2>/dev/null
>
> for dev in $REBIND_RT_NICS; do
> - echo 1 > /sys/bus/pci/devices/$dev/remove
> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
> done
> if [ ! "$REBIND_RT_NICS" = "" ]; then
> sleep 1
> @@ -337,7 +337,7 @@ case "$1" in
>
> capture)
> modprobe rtnet >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
> modprobe rtcap >/dev/null || exit 1
> $RTIFCONFIG rteth0 up promisc
> ifconfig rteth0 up
> @@ -349,7 +349,7 @@ case "$1" in
> modprobe rtipv4 >/dev/null || exit 1
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> modprobe rt_loopback >/dev/null || exit 1
Hi all,
kind ping.
Thakns, regards
--
Mauro S.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 6:37 ` Mauro S.
@ 2022-06-23 7:46 ` Jan Kiszka
2022-06-23 8:05 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-06-23 7:46 UTC (permalink / raw)
To: Mauro S., xenomai
On 23.06.22 08:37, Mauro S. wrote:
> Il 12/05/22 09:00, Mauro S. via Xenomai ha scritto:
>> Remaning shellcheck warnings:
>> - "SC2086: Double quote to prevent globbing and word splitting."
>> line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
>> Suggested fix not applicable because these variables can be empty,
>> resulting in command failure due to "" in command line
>> - "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
>> STAGE_2_OPT is."
>> line 296. STAGE_2_DST comes from included RTNETCFG file
>>
>> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
>> ---
>> utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
>> 1 file changed, 43 insertions(+), 43 deletions(-)
>>
>> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
>> index f81a7bb0a..cd24017b4 100644
>> --- a/utils/net/rtnet.in
>> +++ b/utils/net/rtnet.in
>> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>>
>> debug_func() {
>> echo "$*"
>> - eval $*
>> + eval "$@"
>> }
>>
>> usage() {
>> @@ -33,35 +33,35 @@ EOF
>> init_rtnet() {
>> modprobe rtnet >/dev/null || exit 1
>> modprobe rtipv4 >/dev/null || exit 1
>> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
>> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>>
>> for dev in $REBIND_RT_NICS; do
>> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
>> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
>> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
>> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
>> fi
>> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
>> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
>> done
>>
>> for PROTOCOL in $RT_PROTOCOLS; do
>> - modprobe rt$PROTOCOL >/dev/null || exit 1
>> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
>> done
>>
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> modprobe rt_loopback >/dev/null || exit 1
>> fi
>>
>> - if [ $RTCAP = "yes" ]; then
>> + if [ "$RTCAP" = "yes" ]; then
>> modprobe rtcap >/dev/null || exit 1
>> fi
>>
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> $RTIFCONFIG rtlo up 127.0.0.1
>> fi
>>
>> - if [ $RTCAP = "yes" ]; then
>> + if [ "$RTCAP" = "yes" ]; then
>> ifconfig rteth0 up
>> ifconfig rteth0-mac up
>> - if [ $RT_LOOPBACK = "yes" ]; then
>> + if [ "$RT_LOOPBACK" = "yes" ]; then
>> ifconfig rtlo up
>> fi
>> fi
>> @@ -74,9 +74,9 @@ init_rtnet() {
>> submit_cfg() {
>> case "$STATION_TYPE" in
>> master)
>> - $RTIFCONFIG rteth0 up $STATION_IP
>> + $RTIFCONFIG rteth0 up "$STATION_IP"
>>
>> - $TDMACFG rteth0 master $TDMA_CYCLE
>> + $TDMACFG rteth0 master "$TDMA_CYCLE"
>> eval "$TDMA_SLOTS"
>>
>> IPADDR=$STATION_IP
>> @@ -96,7 +96,7 @@ submit_cfg() {
>> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>>
>> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
>> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
>> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
>> ;;
>> backup-master)
>> if [ ! "$STATION_IP" = "" ]; then
>> @@ -117,7 +117,7 @@ submit_cfg() {
>> fi
>>
>> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
>> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
>> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
>> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
>> ;;
>> esac
>>
>> @@ -142,16 +142,16 @@ start_master() {
>> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
>> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>>
>> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
>> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>>
>> - $TDMACFG rteth0 master $TDMA_CYCLE
>> + $TDMACFG rteth0 master "$TDMA_CYCLE"
>> $TDMACFG rteth0 slot 0 0
>>
>> OFFSET=$TDMA_OFFSET
>> for SLAVE in $TDMA_SLAVES; do
>> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
>> \$IPADDR \$NETMASK_OPT" | \
>> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
>> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
>> + $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
>> + OFFSET=$((OFFSET+TDMA_OFFSET))
>> done
>> else
>> # Get setup from TDMA_CONFIG file:
>> @@ -185,12 +185,12 @@ start_master() {
>> # slot ...
>> #
>>
>> - if [ ! -r $TDMA_CONFIG ]; then
>> + if [ ! -r "$TDMA_CONFIG" ]; then
>> echo "Could not read $TDMA_CONFIG"
>> exit 1
>> fi
>>
>> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
>> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
>> case "$ARG1" in
>> "master:")
>> submit_cfg
>> @@ -217,7 +217,7 @@ start_master() {
>> STATION_MAC="$ARG2"
>> ;;
>> "stage2")
>> - STATION_STAGE_2="$ARG2"
>> + STATION_STAGE_2_SRC="$ARG2"
>> ;;
>> "slot")
>> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
>> @@ -233,16 +233,16 @@ start_master() {
>> TDMA_SLOTS="$TDMA_SLOTS;"
>> ;;
>> esac
>> - done < $TDMA_CONFIG
>> + done < "$TDMA_CONFIG"
>> submit_cfg
>> fi
>>
>> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
>> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>>
>> - echo -n "Waiting for all slaves..."
>> + printf "Waiting for all slaves..."
>> $RTCFG rteth0 wait
>> $RTCFG rteth0 ready
>> - echo
>> + printf "\n"
>> }
>>
>>
>> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
>> shift 2
>> fi
>>
>> -if [ -r $RTNETCFG ]; then
>> - . $RTNETCFG
>> +if [ -r "$RTNETCFG" ]; then
>> + . "$RTNETCFG"
>> else
>> echo "Could not read $RTNETCFG"
>> exit 1
>> @@ -281,30 +281,30 @@ case "$1" in
>> start)
>> init_rtnet
>>
>> - if [ $TDMA_MODE = "master" ]; then
>> + if [ "$TDMA_MODE" = "master" ]; then
>> start_master
>> else
>> $TDMACFG rteth0 slave
>>
>> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
>> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>>
>> - echo -n "Stage 1: searching for master..."
>> - eval "`$RTCFG rteth0 client -c`"
>> - echo
>> + printf "Stage 1: searching for master..."
>> + eval "$($RTCFG rteth0 client -c)"
>> + printf "\n"
>>
>> - echo -n "Stage 2: waiting for other slaves..."
>> + printf "Stage 2: waiting for other slaves..."
>> if [ ! "$STAGE_2_DST" = "" ]; then
>> - $RTCFG rteth0 announce -f $STAGE_2_DST
>> - echo
>> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
>> + printf "\n"
>> eval "$STAGE_2_CMDS"
>> else
>> $RTCFG rteth0 announce
>> - echo
>> + printf "\n"
>> fi
>>
>> - echo -n "Stage 3: waiting for common setup completion..."
>> + printf "Stage 3: waiting for common setup completion..."
>> $RTCFG rteth0 ready
>> - echo
>> + printf "\n"
>> fi
>> ;;
>>
>> @@ -317,10 +317,10 @@ case "$1" in
>> $RTIFCONFIG rteth0 down 2>/dev/null
>> $RTIFCONFIG rtlo down 2>/dev/null
>>
>> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket
>> rtudp rttcp rtipv4 rtnet 2>/dev/null
>> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
>> rtudp rttcp rtipv4 rtnet 2>/dev/null
>>
>> for dev in $REBIND_RT_NICS; do
>> - echo 1 > /sys/bus/pci/devices/$dev/remove
>> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
>> done
>> if [ ! "$REBIND_RT_NICS" = "" ]; then
>> sleep 1
>> @@ -337,7 +337,7 @@ case "$1" in
>>
>> capture)
>> modprobe rtnet >/dev/null || exit 1
>> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
>> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>> modprobe rtcap >/dev/null || exit 1
>> $RTIFCONFIG rteth0 up promisc
>> ifconfig rteth0 up
>> @@ -349,7 +349,7 @@ case "$1" in
>> modprobe rtipv4 >/dev/null || exit 1
>>
>> for PROTOCOL in $RT_PROTOCOLS; do
>> - modprobe rt$PROTOCOL >/dev/null || exit 1
>> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
>> done
>>
>> modprobe rt_loopback >/dev/null || exit 1
>
> Hi all,
>
> kind ping.
>
> Thakns, regards
>
Thanks for the reminder, fell through the cracks.
But patch looks mangled. Could you resent in plain-text or via git
send-email?
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 7:46 ` Jan Kiszka
@ 2022-06-23 8:05 ` Mauro S.
2022-06-23 8:37 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-06-23 8:05 UTC (permalink / raw)
To: xenomai; +Cc: Jan Kiszka
Remaining shellcheck warnings:
- "SC2086: Double quote to prevent globbing and word splitting."
line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
Suggested fix not applicable because these variables can be empty,
resulting in command failure due to "" in command line
- "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
STAGE_2_OPT is."
line 296. STAGE_2_DST comes from included RTNETCFG file
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb0a..cd24017b4 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
debug_func() {
echo "$*"
- eval $*
+ eval "$@"
}
usage() {
@@ -33,35 +33,35 @@ EOF
init_rtnet() {
modprobe rtnet >/dev/null || exit 1
modprobe rtipv4 >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
for dev in $REBIND_RT_NICS; do
- if [ -d /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+ if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
+ echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
fi
- echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+ echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
done
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
modprobe rt_loopback >/dev/null || exit 1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
modprobe rtcap >/dev/null || exit 1
fi
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
$RTIFCONFIG rtlo up 127.0.0.1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
ifconfig rteth0 up
ifconfig rteth0-mac up
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
ifconfig rtlo up
fi
fi
@@ -74,9 +74,9 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up $STATION_IP
+ $RTIFCONFIG rteth0 up "$STATION_IP"
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
@@ -96,7 +96,7 @@ submit_cfg() {
ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
;;
backup-master)
if [ ! "$STATION_IP" = "" ]; then
@@ -117,7 +117,7 @@ submit_cfg() {
fi
echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
;;
esac
@@ -142,16 +142,16 @@ start_master() {
# Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
# + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
$TDMACFG rteth0 slot 0 0
OFFSET=$TDMA_OFFSET
for SLAVE in $TDMA_SLAVES; do
echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR
\$NETMASK_OPT" | \
- $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
- OFFSET=$(($OFFSET+$TDMA_OFFSET))
+ $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
+ OFFSET=$((OFFSET+TDMA_OFFSET))
done
else
# Get setup from TDMA_CONFIG file:
@@ -185,12 +185,12 @@ start_master() {
# slot ...
#
- if [ ! -r $TDMA_CONFIG ]; then
+ if [ ! -r "$TDMA_CONFIG" ]; then
echo "Could not read $TDMA_CONFIG"
exit 1
fi
- while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+ while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
case "$ARG1" in
"master:")
submit_cfg
@@ -217,7 +217,7 @@ start_master() {
STATION_MAC="$ARG2"
;;
"stage2")
- STATION_STAGE_2="$ARG2"
+ STATION_STAGE_2_SRC="$ARG2"
;;
"slot")
TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
@@ -233,16 +233,16 @@ start_master() {
TDMA_SLOTS="$TDMA_SLOTS;"
;;
esac
- done < $TDMA_CONFIG
+ done < "$TDMA_CONFIG"
submit_cfg
fi
- ifconfig vnic0 up $IPADDR $NETMASK_OPT
+ ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
- echo -n "Waiting for all slaves..."
+ printf "Waiting for all slaves..."
$RTCFG rteth0 wait
$RTCFG rteth0 ready
- echo
+ printf "\n"
}
@@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
shift 2
fi
-if [ -r $RTNETCFG ]; then
- . $RTNETCFG
+if [ -r "$RTNETCFG" ]; then
+ . "$RTNETCFG"
else
echo "Could not read $RTNETCFG"
exit 1
@@ -281,30 +281,30 @@ case "$1" in
start)
init_rtnet
- if [ $TDMA_MODE = "master" ]; then
+ if [ "$TDMA_MODE" = "master" ]; then
start_master
else
$TDMACFG rteth0 slave
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- echo -n "Stage 1: searching for master..."
- eval "`$RTCFG rteth0 client -c`"
- echo
+ printf "Stage 1: searching for master..."
+ eval "$($RTCFG rteth0 client -c)"
+ printf "\n"
- echo -n "Stage 2: waiting for other slaves..."
+ printf "Stage 2: waiting for other slaves..."
if [ ! "$STAGE_2_DST" = "" ]; then
- $RTCFG rteth0 announce -f $STAGE_2_DST
- echo
+ $RTCFG rteth0 announce -f "$STAGE_2_DST"
+ printf "\n"
eval "$STAGE_2_CMDS"
else
$RTCFG rteth0 announce
- echo
+ printf "\n"
fi
- echo -n "Stage 3: waiting for common setup completion..."
+ printf "Stage 3: waiting for common setup completion..."
$RTCFG rteth0 ready
- echo
+ printf "\n"
fi
;;
@@ -317,10 +317,10 @@ case "$1" in
$RTIFCONFIG rteth0 down 2>/dev/null
$RTIFCONFIG rtlo down 2>/dev/null
- rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
+ rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket rtudp
rttcp rtipv4 rtnet 2>/dev/null
for dev in $REBIND_RT_NICS; do
- echo 1 > /sys/bus/pci/devices/$dev/remove
+ echo 1 > /sys/bus/pci/devices/"$dev"/remove
done
if [ ! "$REBIND_RT_NICS" = "" ]; then
sleep 1
@@ -337,7 +337,7 @@ case "$1" in
capture)
modprobe rtnet >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
modprobe rtcap >/dev/null || exit 1
$RTIFCONFIG rteth0 up promisc
ifconfig rteth0 up
@@ -349,7 +349,7 @@ case "$1" in
modprobe rtipv4 >/dev/null || exit 1
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
modprobe rt_loopback >/dev/null || exit 1
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 8:05 ` Mauro S.
@ 2022-06-23 8:37 ` Jan Kiszka
2022-06-23 8:48 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-06-23 8:37 UTC (permalink / raw)
To: Mauro S., xenomai
On 23.06.22 10:05, Mauro S. wrote:
> Remaining shellcheck warnings:
> - "SC2086: Double quote to prevent globbing and word splitting."
> line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
> Suggested fix not applicable because these variables can be empty,
> resulting in command failure due to "" in command line
> - "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
> STAGE_2_OPT is."
> line 296. STAGE_2_DST comes from included RTNETCFG file
>
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
> 1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index f81a7bb0a..cd24017b4 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>
> debug_func() {
> echo "$*"
> - eval $*
> + eval "$@"
> }
>
> usage() {
> @@ -33,35 +33,35 @@ EOF
> init_rtnet() {
> modprobe rtnet >/dev/null || exit 1
> modprobe rtipv4 >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>
> for dev in $REBIND_RT_NICS; do
> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
> fi
> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
> done
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> modprobe rt_loopback >/dev/null || exit 1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> modprobe rtcap >/dev/null || exit 1
> fi
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> $RTIFCONFIG rtlo up 127.0.0.1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> ifconfig rteth0 up
> ifconfig rteth0-mac up
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> ifconfig rtlo up
> fi
> fi
> @@ -74,9 +74,9 @@ init_rtnet() {
> submit_cfg() {
> case "$STATION_TYPE" in
> master)
> - $RTIFCONFIG rteth0 up $STATION_IP
> + $RTIFCONFIG rteth0 up "$STATION_IP"
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> eval "$TDMA_SLOTS"
>
> IPADDR=$STATION_IP
> @@ -96,7 +96,7 @@ submit_cfg() {
> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>
> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
> ;;
> backup-master)
> if [ ! "$STATION_IP" = "" ]; then
> @@ -117,7 +117,7 @@ submit_cfg() {
> fi
>
> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
> ;;
> esac
>
> @@ -142,16 +142,16 @@ start_master() {
> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> $TDMACFG rteth0 slot 0 0
>
> OFFSET=$TDMA_OFFSET
> for SLAVE in $TDMA_SLAVES; do
> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
> \$IPADDR \$NETMASK_OPT" | \
> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
> + $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
> + OFFSET=$((OFFSET+TDMA_OFFSET))
> done
> else
> # Get setup from TDMA_CONFIG file:
> @@ -185,12 +185,12 @@ start_master() {
> # slot ...
> #
>
> - if [ ! -r $TDMA_CONFIG ]; then
> + if [ ! -r "$TDMA_CONFIG" ]; then
> echo "Could not read $TDMA_CONFIG"
> exit 1
> fi
>
> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> case "$ARG1" in
> "master:")
> submit_cfg
> @@ -217,7 +217,7 @@ start_master() {
> STATION_MAC="$ARG2"
> ;;
> "stage2")
> - STATION_STAGE_2="$ARG2"
> + STATION_STAGE_2_SRC="$ARG2"
> ;;
> "slot")
> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
> @@ -233,16 +233,16 @@ start_master() {
> TDMA_SLOTS="$TDMA_SLOTS;"
> ;;
> esac
> - done < $TDMA_CONFIG
> + done < "$TDMA_CONFIG"
> submit_cfg
> fi
>
> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Waiting for all slaves..."
> + printf "Waiting for all slaves..."
> $RTCFG rteth0 wait
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> }
>
>
> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
> shift 2
> fi
>
> -if [ -r $RTNETCFG ]; then
> - . $RTNETCFG
> +if [ -r "$RTNETCFG" ]; then
> + . "$RTNETCFG"
> else
> echo "Could not read $RTNETCFG"
> exit 1
> @@ -281,30 +281,30 @@ case "$1" in
> start)
> init_rtnet
>
> - if [ $TDMA_MODE = "master" ]; then
> + if [ "$TDMA_MODE" = "master" ]; then
> start_master
> else
> $TDMACFG rteth0 slave
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Stage 1: searching for master..."
> - eval "`$RTCFG rteth0 client -c`"
> - echo
> + printf "Stage 1: searching for master..."
> + eval "$($RTCFG rteth0 client -c)"
> + printf "\n"
>
> - echo -n "Stage 2: waiting for other slaves..."
> + printf "Stage 2: waiting for other slaves..."
> if [ ! "$STAGE_2_DST" = "" ]; then
> - $RTCFG rteth0 announce -f $STAGE_2_DST
> - echo
> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
> + printf "\n"
> eval "$STAGE_2_CMDS"
> else
> $RTCFG rteth0 announce
> - echo
> + printf "\n"
> fi
>
> - echo -n "Stage 3: waiting for common setup completion..."
> + printf "Stage 3: waiting for common setup completion..."
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> fi
> ;;
>
> @@ -317,10 +317,10 @@ case "$1" in
> $RTIFCONFIG rteth0 down 2>/dev/null
> $RTIFCONFIG rtlo down 2>/dev/null
>
> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
> rttcp rtipv4 rtnet 2>/dev/null
> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
> rtudp rttcp rtipv4 rtnet 2>/dev/null
>
Still wrapping and removing trailing whitespaces which are important for
patches.
Jan
> for dev in $REBIND_RT_NICS; do
> - echo 1 > /sys/bus/pci/devices/$dev/remove
> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
> done
> if [ ! "$REBIND_RT_NICS" = "" ]; then
> sleep 1
> @@ -337,7 +337,7 @@ case "$1" in
>
> capture)
> modprobe rtnet >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
> modprobe rtcap >/dev/null || exit 1
> $RTIFCONFIG rteth0 up promisc
> ifconfig rteth0 up
> @@ -349,7 +349,7 @@ case "$1" in
> modprobe rtipv4 >/dev/null || exit 1
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> modprobe rt_loopback >/dev/null || exit 1
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 8:37 ` Jan Kiszka
@ 2022-06-23 8:48 ` Mauro S.
2022-06-23 8:59 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-06-23 8:48 UTC (permalink / raw)
To: xenomai; +Cc: Jan Kiszka
Remaining shellcheck warnings:
- "SC2086: Double quote to prevent globbing and word splitting."
line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
Suggested fix not applicable because these variables can be empty,
resulting in command failure due to "" in command line
- "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but STAGE_2_OPT is."
line 296. STAGE_2_DST comes from included RTNETCFG file
Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
---
utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 43 deletions(-)
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index f81a7bb0a..cd24017b4 100644
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
debug_func() {
echo "$*"
- eval $*
+ eval "$@"
}
usage() {
@@ -33,35 +33,35 @@ EOF
init_rtnet() {
modprobe rtnet >/dev/null || exit 1
modprobe rtipv4 >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
for dev in $REBIND_RT_NICS; do
- if [ -d /sys/bus/pci/devices/$dev/driver ]; then
- echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+ if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
+ echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
fi
- echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+ echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
done
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
modprobe rt_loopback >/dev/null || exit 1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
modprobe rtcap >/dev/null || exit 1
fi
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
$RTIFCONFIG rtlo up 127.0.0.1
fi
- if [ $RTCAP = "yes" ]; then
+ if [ "$RTCAP" = "yes" ]; then
ifconfig rteth0 up
ifconfig rteth0-mac up
- if [ $RT_LOOPBACK = "yes" ]; then
+ if [ "$RT_LOOPBACK" = "yes" ]; then
ifconfig rtlo up
fi
fi
@@ -74,9 +74,9 @@ init_rtnet() {
submit_cfg() {
case "$STATION_TYPE" in
master)
- $RTIFCONFIG rteth0 up $STATION_IP
+ $RTIFCONFIG rteth0 up "$STATION_IP"
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
eval "$TDMA_SLOTS"
IPADDR=$STATION_IP
@@ -96,7 +96,7 @@ submit_cfg() {
ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
;;
backup-master)
if [ ! "$STATION_IP" = "" ]; then
@@ -117,7 +117,7 @@ submit_cfg() {
fi
echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
- $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+ $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
;;
esac
@@ -142,16 +142,16 @@ start_master() {
# Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
# + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- $TDMACFG rteth0 master $TDMA_CYCLE
+ $TDMACFG rteth0 master "$TDMA_CYCLE"
$TDMACFG rteth0 slot 0 0
OFFSET=$TDMA_OFFSET
for SLAVE in $TDMA_SLAVES; do
echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR \$NETMASK_OPT" | \
- $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
- OFFSET=$(($OFFSET+$TDMA_OFFSET))
+ $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
+ OFFSET=$((OFFSET+TDMA_OFFSET))
done
else
# Get setup from TDMA_CONFIG file:
@@ -185,12 +185,12 @@ start_master() {
# slot ...
#
- if [ ! -r $TDMA_CONFIG ]; then
+ if [ ! -r "$TDMA_CONFIG" ]; then
echo "Could not read $TDMA_CONFIG"
exit 1
fi
- while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+ while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
case "$ARG1" in
"master:")
submit_cfg
@@ -217,7 +217,7 @@ start_master() {
STATION_MAC="$ARG2"
;;
"stage2")
- STATION_STAGE_2="$ARG2"
+ STATION_STAGE_2_SRC="$ARG2"
;;
"slot")
TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
@@ -233,16 +233,16 @@ start_master() {
TDMA_SLOTS="$TDMA_SLOTS;"
;;
esac
- done < $TDMA_CONFIG
+ done < "$TDMA_CONFIG"
submit_cfg
fi
- ifconfig vnic0 up $IPADDR $NETMASK_OPT
+ ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
- echo -n "Waiting for all slaves..."
+ printf "Waiting for all slaves..."
$RTCFG rteth0 wait
$RTCFG rteth0 ready
- echo
+ printf "\n"
}
@@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
shift 2
fi
-if [ -r $RTNETCFG ]; then
- . $RTNETCFG
+if [ -r "$RTNETCFG" ]; then
+ . "$RTNETCFG"
else
echo "Could not read $RTNETCFG"
exit 1
@@ -281,30 +281,30 @@ case "$1" in
start)
init_rtnet
- if [ $TDMA_MODE = "master" ]; then
+ if [ "$TDMA_MODE" = "master" ]; then
start_master
else
$TDMACFG rteth0 slave
- $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+ $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
- echo -n "Stage 1: searching for master..."
- eval "`$RTCFG rteth0 client -c`"
- echo
+ printf "Stage 1: searching for master..."
+ eval "$($RTCFG rteth0 client -c)"
+ printf "\n"
- echo -n "Stage 2: waiting for other slaves..."
+ printf "Stage 2: waiting for other slaves..."
if [ ! "$STAGE_2_DST" = "" ]; then
- $RTCFG rteth0 announce -f $STAGE_2_DST
- echo
+ $RTCFG rteth0 announce -f "$STAGE_2_DST"
+ printf "\n"
eval "$STAGE_2_CMDS"
else
$RTCFG rteth0 announce
- echo
+ printf "\n"
fi
- echo -n "Stage 3: waiting for common setup completion..."
+ printf "Stage 3: waiting for common setup completion..."
$RTCFG rteth0 ready
- echo
+ printf "\n"
fi
;;
@@ -317,10 +317,10 @@ case "$1" in
$RTIFCONFIG rteth0 down 2>/dev/null
$RTIFCONFIG rtlo down 2>/dev/null
- rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp rttcp rtipv4 rtnet 2>/dev/null
+ rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket rtudp rttcp rtipv4 rtnet 2>/dev/null
for dev in $REBIND_RT_NICS; do
- echo 1 > /sys/bus/pci/devices/$dev/remove
+ echo 1 > /sys/bus/pci/devices/"$dev"/remove
done
if [ ! "$REBIND_RT_NICS" = "" ]; then
sleep 1
@@ -337,7 +337,7 @@ case "$1" in
capture)
modprobe rtnet >/dev/null || exit 1
- modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+ modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
modprobe rtcap >/dev/null || exit 1
$RTIFCONFIG rteth0 up promisc
ifconfig rteth0 up
@@ -349,7 +349,7 @@ case "$1" in
modprobe rtipv4 >/dev/null || exit 1
for PROTOCOL in $RT_PROTOCOLS; do
- modprobe rt$PROTOCOL >/dev/null || exit 1
+ modprobe rt"$PROTOCOL" >/dev/null || exit 1
done
modprobe rt_loopback >/dev/null || exit 1
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 8:48 ` Mauro S.
@ 2022-06-23 8:59 ` Jan Kiszka
2022-06-23 9:16 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-06-23 8:59 UTC (permalink / raw)
To: Mauro S., xenomai
On 23.06.22 10:48, Mauro S. wrote:
> Remaining shellcheck warnings:
> - "SC2086: Double quote to prevent globbing and word splitting."
> line 120, 153, 289 (variables STAGE_2_OPT and NETMASK_OPT)
> Suggested fix not applicable because these variables can be empty,
> resulting in command failure due to "" in command line
> - "SC2153: Possible misspelling: STAGE_2_DST may not be assigned, but
> STAGE_2_OPT is."
> line 296. STAGE_2_DST comes from included RTNETCFG file
>
> Signed-off-by: Mauro Salvini <mau.salvi@tin.it>
> ---
> utils/net/rtnet.in | 86 +++++++++++++++++++++++-----------------------
> 1 file changed, 43 insertions(+), 43 deletions(-)
>
> diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
> index f81a7bb0a..cd24017b4 100644
> --- a/utils/net/rtnet.in
> +++ b/utils/net/rtnet.in
> @@ -9,7 +9,7 @@ RTNETCFG="@sysconfdir@/rtnet.conf"
>
> debug_func() {
> echo "$*"
> - eval $*
> + eval "$@"
> }
>
> usage() {
> @@ -33,35 +33,35 @@ EOF
> init_rtnet() {
> modprobe rtnet >/dev/null || exit 1
> modprobe rtipv4 >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
>
> for dev in $REBIND_RT_NICS; do
> - if [ -d /sys/bus/pci/devices/$dev/driver ]; then
> - echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
> + if [ -d /sys/bus/pci/devices/"$dev"/driver ]; then
> + echo "$dev" > /sys/bus/pci/devices/"$dev"/driver/unbind
> fi
> - echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
> + echo "$dev" > /sys/bus/pci/drivers/"$RT_DRIVER"/bind
> done
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> modprobe rt_loopback >/dev/null || exit 1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> modprobe rtcap >/dev/null || exit 1
> fi
>
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> $RTIFCONFIG rtlo up 127.0.0.1
> fi
>
> - if [ $RTCAP = "yes" ]; then
> + if [ "$RTCAP" = "yes" ]; then
> ifconfig rteth0 up
> ifconfig rteth0-mac up
> - if [ $RT_LOOPBACK = "yes" ]; then
> + if [ "$RT_LOOPBACK" = "yes" ]; then
> ifconfig rtlo up
> fi
> fi
> @@ -74,9 +74,9 @@ init_rtnet() {
> submit_cfg() {
> case "$STATION_TYPE" in
> master)
> - $RTIFCONFIG rteth0 up $STATION_IP
> + $RTIFCONFIG rteth0 up "$STATION_IP"
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> eval "$TDMA_SLOTS"
>
> IPADDR=$STATION_IP
> @@ -96,7 +96,7 @@ submit_cfg() {
> ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
>
> echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 -
> ;;
> backup-master)
> if [ ! "$STATION_IP" = "" ]; then
> @@ -117,7 +117,7 @@ submit_cfg() {
> fi
>
> echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master
> $TDMA_CYCLE -b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
> - $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
> + $RTCFG rteth0 add "$RTCFG_CLIENT" -stage1 - $STAGE_2_OPT
> ;;
> esac
>
> @@ -142,16 +142,16 @@ start_master() {
> # Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
> # + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - $TDMACFG rteth0 master $TDMA_CYCLE
> + $TDMACFG rteth0 master "$TDMA_CYCLE"
> $TDMACFG rteth0 slot 0 0
>
> OFFSET=$TDMA_OFFSET
> for SLAVE in $TDMA_SLAVES; do
> echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up
> \$IPADDR \$NETMASK_OPT" | \
> - $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
> - OFFSET=$(($OFFSET+$TDMA_OFFSET))
> + $RTCFG rteth0 add "$SLAVE" -stage1 - $STAGE_2_OPT
> + OFFSET=$((OFFSET+TDMA_OFFSET))
> done
> else
> # Get setup from TDMA_CONFIG file:
> @@ -185,12 +185,12 @@ start_master() {
> # slot ...
> #
>
> - if [ ! -r $TDMA_CONFIG ]; then
> + if [ ! -r "$TDMA_CONFIG" ]; then
> echo "Could not read $TDMA_CONFIG"
> exit 1
> fi
>
> - while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> + while read -r ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
> case "$ARG1" in
> "master:")
> submit_cfg
> @@ -217,7 +217,7 @@ start_master() {
> STATION_MAC="$ARG2"
> ;;
> "stage2")
> - STATION_STAGE_2="$ARG2"
> + STATION_STAGE_2_SRC="$ARG2"
> ;;
> "slot")
> TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
> @@ -233,16 +233,16 @@ start_master() {
> TDMA_SLOTS="$TDMA_SLOTS;"
> ;;
> esac
> - done < $TDMA_CONFIG
> + done < "$TDMA_CONFIG"
> submit_cfg
> fi
>
> - ifconfig vnic0 up $IPADDR $NETMASK_OPT
> + ifconfig vnic0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Waiting for all slaves..."
> + printf "Waiting for all slaves..."
> $RTCFG rteth0 wait
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> }
>
>
> @@ -251,8 +251,8 @@ if [ "$1" = "-cf" ]; then
> shift 2
> fi
>
> -if [ -r $RTNETCFG ]; then
> - . $RTNETCFG
> +if [ -r "$RTNETCFG" ]; then
> + . "$RTNETCFG"
> else
> echo "Could not read $RTNETCFG"
> exit 1
> @@ -281,30 +281,30 @@ case "$1" in
> start)
> init_rtnet
>
> - if [ $TDMA_MODE = "master" ]; then
> + if [ "$TDMA_MODE" = "master" ]; then
> start_master
> else
> $TDMACFG rteth0 slave
>
> - $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
> + $RTIFCONFIG rteth0 up "$IPADDR" $NETMASK_OPT
>
> - echo -n "Stage 1: searching for master..."
> - eval "`$RTCFG rteth0 client -c`"
> - echo
> + printf "Stage 1: searching for master..."
> + eval "$($RTCFG rteth0 client -c)"
> + printf "\n"
>
> - echo -n "Stage 2: waiting for other slaves..."
> + printf "Stage 2: waiting for other slaves..."
> if [ ! "$STAGE_2_DST" = "" ]; then
> - $RTCFG rteth0 announce -f $STAGE_2_DST
> - echo
> + $RTCFG rteth0 announce -f "$STAGE_2_DST"
> + printf "\n"
> eval "$STAGE_2_CMDS"
> else
> $RTCFG rteth0 announce
> - echo
> + printf "\n"
> fi
>
> - echo -n "Stage 3: waiting for common setup completion..."
> + printf "Stage 3: waiting for common setup completion..."
> $RTCFG rteth0 ready
> - echo
> + printf "\n"
> fi
> ;;
>
> @@ -317,10 +317,10 @@ case "$1" in
> $RTIFCONFIG rteth0 down 2>/dev/null
> $RTIFCONFIG rtlo down 2>/dev/null
>
> - rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp
> rttcp rtipv4 rtnet 2>/dev/null
> + rmmod tdma rtmac rtcfg rtcap rt_loopback "$RT_DRIVER" rtpacket
> rtudp rttcp rtipv4 rtnet 2>/dev/null
>
> for dev in $REBIND_RT_NICS; do
> - echo 1 > /sys/bus/pci/devices/$dev/remove
> + echo 1 > /sys/bus/pci/devices/"$dev"/remove
> done
> if [ ! "$REBIND_RT_NICS" = "" ]; then
> sleep 1
> @@ -337,7 +337,7 @@ case "$1" in
>
> capture)
> modprobe rtnet >/dev/null || exit 1
> - modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
> + modprobe "$RT_DRIVER" "$RT_DRIVER_OPTIONS" >/dev/null || exit 1
> modprobe rtcap >/dev/null || exit 1
> $RTIFCONFIG rteth0 up promisc
> ifconfig rteth0 up
> @@ -349,7 +349,7 @@ case "$1" in
> modprobe rtipv4 >/dev/null || exit 1
>
> for PROTOCOL in $RT_PROTOCOLS; do
> - modprobe rt$PROTOCOL >/dev/null || exit 1
> + modprobe rt"$PROTOCOL" >/dev/null || exit 1
> done
>
> modprobe rt_loopback >/dev/null || exit 1
Please use git send-email in the future - I've fixed up the
misformatting manually this time and merged to next.
Thanks,
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 8:59 ` Jan Kiszka
@ 2022-06-23 9:16 ` Mauro S.
2022-06-23 9:35 ` Jan Kiszka
0 siblings, 1 reply; 15+ messages in thread
From: Mauro S. @ 2022-06-23 9:16 UTC (permalink / raw)
To: xenomai; +Cc: Jan Kiszka
Il 23/06/22 10:59, Jan Kiszka ha scritto:
> On 23.06.22 10:48, Mauro S. wrote:
>
> Please use git send-email in the future - I've fixed up the
> misformatting manually this time and merged to next.
>
> Thanks,
> Jan
>
Ok, sorry for the noise.
I'm using Thunderbird in plain text, with text wrapping disabled.
I see the patch correctly formatted, both when I send it and when I receive it,
but probably Thunderbird does something "magic"...
Thanks for merging.
--
Mauro S.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 9:16 ` Mauro S.
@ 2022-06-23 9:35 ` Jan Kiszka
2022-06-23 10:16 ` Mauro S.
0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2022-06-23 9:35 UTC (permalink / raw)
To: Mauro S., xenomai
On 23.06.22 11:16, Mauro S. wrote:
> Il 23/06/22 10:59, Jan Kiszka ha scritto:
>> On 23.06.22 10:48, Mauro S. wrote:
>>
>> Please use git send-email in the future - I've fixed up the
>> misformatting manually this time and merged to next.
>>
>> Thanks,
>> Jan
>>
>
> Ok, sorry for the noise.
>
> I'm using Thunderbird in plain text, with text wrapping disabled.
> I see the patch correctly formatted, both when I send it and when I
> receive it,
> but probably Thunderbird does something "magic"...
I'm using TB for single patches as well - with
https://addons.thunderbird.net/de/thunderbird/addon/toggle-line-wrap/.
BTW, you can check how your patch is received here:
https://lore.kernel.org/xenomai/eae8a831-fc6d-b297-f03d-d477e9ef61ca@tin.it/T/#m7da3e7f94ca18470aad6861eafcbce338f6ccad4
Jan
--
Siemens AG, Technology
Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3] utils/net/rtnet.in: fixes after shellcheck inspection
2022-06-23 9:35 ` Jan Kiszka
@ 2022-06-23 10:16 ` Mauro S.
0 siblings, 0 replies; 15+ messages in thread
From: Mauro S. @ 2022-06-23 10:16 UTC (permalink / raw)
To: xenomai; +Cc: Jan Kiszka
Il 23/06/22 11:35, Jan Kiszka ha scritto:
> On 23.06.22 11:16, Mauro S. wrote:
>> Il 23/06/22 10:59, Jan Kiszka ha scritto:
>>> On 23.06.22 10:48, Mauro S. wrote:
>>>
>>> Please use git send-email in the future - I've fixed up the
>>> misformatting manually this time and merged to next.
>>>
>>> Thanks,
>>> Jan
>>>
>>
>> Ok, sorry for the noise.
>>
>> I'm using Thunderbird in plain text, with text wrapping disabled.
>> I see the patch correctly formatted, both when I send it and when I
>> receive it,
>> but probably Thunderbird does something "magic"...
>
> I'm using TB for single patches as well - with
> https://addons.thunderbird.net/de/thunderbird/addon/toggle-line-wrap/.
>
> BTW, you can check how your patch is received here:
> https://lore.kernel.org/xenomai/eae8a831-fc6d-b297-f03d-d477e9ef61ca@tin.it/T/#m7da3e7f94ca18470aad6861eafcbce338f6ccad4
>
> Jan
>
Many thanks Jan.
Now I set up git send-email to avoid future problems.
Regards
--
Mauro S.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-06-23 10:17 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 8:22 [PATCH] utils/net/rtnet.in: fixes after shellcheck inspection Mauro S.
2022-05-05 13:03 ` Jan Kiszka
2022-05-05 15:12 ` [PATCH v2] " Mauro S.
2022-05-05 15:25 ` Jan Kiszka
2022-05-05 15:39 ` Mauro S.
2022-05-12 7:00 ` [PATCH v3] " Mauro S.
2022-06-23 6:37 ` Mauro S.
2022-06-23 7:46 ` Jan Kiszka
2022-06-23 8:05 ` Mauro S.
2022-06-23 8:37 ` Jan Kiszka
2022-06-23 8:48 ` Mauro S.
2022-06-23 8:59 ` Jan Kiszka
2022-06-23 9:16 ` Mauro S.
2022-06-23 9:35 ` Jan Kiszka
2022-06-23 10:16 ` Mauro S.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.