All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name
@ 2020-08-24 12:41 Heiko Thiery
  2020-08-24 19:49 ` Matthew Weber
  2020-08-24 20:21 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko Thiery @ 2020-08-24 12:41 UTC (permalink / raw)
  To: buildroot

When building on a host that has no name specified for the used group in
/etc/group the script in install step will fail due to missing group name.

CMake Error at CMakeLists.txt:80 (message):
  Learning server module group failed: id: cannot find name for group ID 8000

The patch was taken from upstream and modified manually because of merge
conflicts.

Fixes:
http://autobuild.buildroot.net/results/f197ca1def9dc1292e1e784757f2da9d95484431/

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
---
 ...support-using-current-user-for-SR-mo.patch | 98 +++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch

diff --git a/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch b/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch
new file mode 100644
index 0000000000..45257b2ff4
--- /dev/null
+++ b/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch
@@ -0,0 +1,98 @@
+From 36ee1f33bceb0c2a7899e28d75c0d05408b561f1 Mon Sep 17 00:00:00 2001
+From: Michal Vasko <mvasko@cesnet.cz>
+Date: Mon, 24 Aug 2020 13:47:40 +0200
+Subject: [PATCH] scripts FEATURE support using current user for SR modules
+
+Mostly for special cases user/group configuration
+when the user/group cannot be retrieved normally.
+
+Fixes #701
+
+Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
+[patch taken from upstream:
+https://github.com/CESNET/netopeer2/commit/12a82701e10651fbdedb1524b27edf3bb2377488]
+Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
+---
+ CMakeLists.txt   | 10 +++++-----
+ scripts/setup.sh | 23 +++++++++++++++++++----
+ 2 files changed, 24 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2d4175e..95e7e61 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -68,19 +68,19 @@ if(NOT MODULES_OWNER)
+     OUTPUT_VARIABLE MODULES_OWNER OUTPUT_STRIP_TRAILING_WHITESPACE
+     ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
+     if(RET)
+-        message(FATAL_ERROR "Learning server module user failed: ${ERROR_STR}")
++        message(WARNING "Learning server module user failed (${ERROR_STR}), the current user will be used.")
+     endif()
+ endif()
+-set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules")
+-if(NOT MODULES_GROUP)
++set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules, empty means the current user")
++if(NOT MODULES_GROUP AND MODULES_OWNER)
+     execute_process(COMMAND id -gn ${MODULES_OWNER} RESULT_VARIABLE RET
+     OUTPUT_VARIABLE MODULES_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE
+     ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
+     if(RET)
+-        message(FATAL_ERROR "Learning server module group failed: ${ERROR_STR}")
++        message(WARNING "Learning server module group failed (${ERROR_STR}), the current user group will be used.")
+     endif()
+ endif()
+-set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to")
++set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to, empty means the current user group")
+ 
+ # set prefix for the PID file
+ if(NOT PIDFILE_PREFIX)
+diff --git a/scripts/setup.sh b/scripts/setup.sh
+index 7175bc4..b5d1406 100755
+--- a/scripts/setup.sh
++++ b/scripts/setup.sh
+@@ -1,7 +1,8 @@
+ #!/bin/bash
+ 
+-# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS, NP2_MODULE_OWNER, NP2_MODULE_GROUP must be defined when executing this script!
+-if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" -o -z "$NP2_MODULE_OWNER" -o -z "$NP2_MODULE_GROUP" ]; then
++# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS must be defined and NP2_MODULE_OWNER, NP2_MODULE_GROUP will be used if
++# defined when executing this script!
++if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" ]; then
+     echo "Required environment variables not defined!"
+     exit 1
+ fi
+@@ -33,7 +34,14 @@ MODULES=(
+ 
+ # functions
+ INSTALL_MODULE() {
+-    $SYSREPOCTL -a -i $MODDIR/$1 -s $MODDIR -p $PERMS -o $OWNER -g $GROUP -v2
++    CMD="'$SYSREPOCTL' -a -i $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
++    if [ ! -z ${OWNER} ]; then
++        CMD="$CMD -o '$OWNER'"
++    fi
++    if [ ! -z ${GROUP} ]; then
++        CMD="$CMD -g '$GROUP'"
++    fi
++    eval $CMD
+     local rc=$?
+     if [ $rc -ne 0 ]; then
+         exit $rc
+@@ -41,7 +49,14 @@ INSTALL_MODULE() {
+ }
+ 
+ UPDATE_MODULE() {
+-    $SYSREPOCTL -a -U $MODDIR/$1 -s $MODDIR -p $PERMS -o $OWNER -g $GROUP -v2
++    CMD="'$SYSREPOCTL' -a -U $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
++    if [ ! -z ${OWNER} ]; then
++        CMD="$CMD -o '$OWNER'"
++    fi
++    if [ ! -z ${GROUP} ]; then
++        CMD="$CMD -g '$GROUP'"
++    fi
++    eval $CMD
+     local rc=$?
+     if [ $rc -ne 0 ]; then
+         exit $rc
+-- 
+2.20.1
+
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name
  2020-08-24 12:41 [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name Heiko Thiery
@ 2020-08-24 19:49 ` Matthew Weber
  2020-08-24 20:21 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Weber @ 2020-08-24 19:49 UTC (permalink / raw)
  To: buildroot

Heiko,


On Mon, Aug 24, 2020 at 7:43 AM Heiko Thiery <heiko.thiery@gmail.com> wrote:
>
> When building on a host that has no name specified for the used group in
> /etc/group the script in install step will fail due to missing group name.
>
> CMake Error at CMakeLists.txt:80 (message):
>   Learning server module group failed: id: cannot find name for group ID 8000
>

When cross compiling we still don't want it to actually be using the
host systems users/groups as part of the build.  However with how
Buildroot finalizes the root filesystem this will all get fixed up
before a user would use the rootfs on target.

Reviewed-by: Matthew Weber <matthew.weber@rockwellcollins.com>

> The patch was taken from upstream and modified manually because of merge
> conflicts.
>
> Fixes:
> http://autobuild.buildroot.net/results/f197ca1def9dc1292e1e784757f2da9d95484431/
>
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
>  ...support-using-current-user-for-SR-mo.patch | 98 +++++++++++++++++++
>  1 file changed, 98 insertions(+)
>  create mode 100644 package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch
>
> diff --git a/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch b/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch
> new file mode 100644
> index 0000000000..45257b2ff4
> --- /dev/null
> +++ b/package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch
> @@ -0,0 +1,98 @@
> +From 36ee1f33bceb0c2a7899e28d75c0d05408b561f1 Mon Sep 17 00:00:00 2001
> +From: Michal Vasko <mvasko@cesnet.cz>
> +Date: Mon, 24 Aug 2020 13:47:40 +0200
> +Subject: [PATCH] scripts FEATURE support using current user for SR modules
> +
> +Mostly for special cases user/group configuration
> +when the user/group cannot be retrieved normally.
> +
> +Fixes #701
> +
> +Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> +[patch taken from upstream:
> +https://github.com/CESNET/netopeer2/commit/12a82701e10651fbdedb1524b27edf3bb2377488]
> +Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> +---
> + CMakeLists.txt   | 10 +++++-----
> + scripts/setup.sh | 23 +++++++++++++++++++----
> + 2 files changed, 24 insertions(+), 9 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 2d4175e..95e7e61 100755
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -68,19 +68,19 @@ if(NOT MODULES_OWNER)
> +     OUTPUT_VARIABLE MODULES_OWNER OUTPUT_STRIP_TRAILING_WHITESPACE
> +     ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
> +     if(RET)
> +-        message(FATAL_ERROR "Learning server module user failed: ${ERROR_STR}")
> ++        message(WARNING "Learning server module user failed (${ERROR_STR}), the current user will be used.")
> +     endif()
> + endif()
> +-set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules")
> +-if(NOT MODULES_GROUP)
> ++set(MODULES_OWNER "${MODULES_OWNER}" CACHE STRING "System user that will become the owner of server modules, empty means the current user")
> ++if(NOT MODULES_GROUP AND MODULES_OWNER)
> +     execute_process(COMMAND id -gn ${MODULES_OWNER} RESULT_VARIABLE RET
> +     OUTPUT_VARIABLE MODULES_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE
> +     ERROR_VARIABLE ERROR_STR OUTPUT_STRIP_TRAILING_WHITESPACE)
> +     if(RET)
> +-        message(FATAL_ERROR "Learning server module group failed: ${ERROR_STR}")
> ++        message(WARNING "Learning server module group failed (${ERROR_STR}), the current user group will be used.")
> +     endif()
> + endif()
> +-set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to")
> ++set(MODULES_GROUP "${MODULES_GROUP}" CACHE STRING "System group that the server modules will belong to, empty means the current user group")
> +
> + # set prefix for the PID file
> + if(NOT PIDFILE_PREFIX)
> +diff --git a/scripts/setup.sh b/scripts/setup.sh
> +index 7175bc4..b5d1406 100755
> +--- a/scripts/setup.sh
> ++++ b/scripts/setup.sh
> +@@ -1,7 +1,8 @@
> + #!/bin/bash
> +
> +-# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS, NP2_MODULE_OWNER, NP2_MODULE_GROUP must be defined when executing this script!
> +-if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" -o -z "$NP2_MODULE_OWNER" -o -z "$NP2_MODULE_GROUP" ]; then
> ++# env variables NP2_MODULE_DIR, NP2_MODULE_PERMS must be defined and NP2_MODULE_OWNER, NP2_MODULE_GROUP will be used if
> ++# defined when executing this script!
> ++if [ -z "$NP2_MODULE_DIR" -o -z "$NP2_MODULE_PERMS" ]; then
> +     echo "Required environment variables not defined!"
> +     exit 1
> + fi
> +@@ -33,7 +34,14 @@ MODULES=(
> +
> + # functions
> + INSTALL_MODULE() {
> +-    $SYSREPOCTL -a -i $MODDIR/$1 -s $MODDIR -p $PERMS -o $OWNER -g $GROUP -v2
> ++    CMD="'$SYSREPOCTL' -a -i $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
> ++    if [ ! -z ${OWNER} ]; then
> ++        CMD="$CMD -o '$OWNER'"
> ++    fi
> ++    if [ ! -z ${GROUP} ]; then
> ++        CMD="$CMD -g '$GROUP'"
> ++    fi
> ++    eval $CMD
> +     local rc=$?
> +     if [ $rc -ne 0 ]; then
> +         exit $rc
> +@@ -41,7 +49,14 @@ INSTALL_MODULE() {
> + }
> +
> + UPDATE_MODULE() {
> +-    $SYSREPOCTL -a -U $MODDIR/$1 -s $MODDIR -p $PERMS -o $OWNER -g $GROUP -v2
> ++    CMD="'$SYSREPOCTL' -a -U $MODDIR/$1 -s '$MODDIR' -p '$PERMS' -v2"
> ++    if [ ! -z ${OWNER} ]; then
> ++        CMD="$CMD -o '$OWNER'"
> ++    fi
> ++    if [ ! -z ${GROUP} ]; then
> ++        CMD="$CMD -g '$GROUP'"
> ++    fi
> ++    eval $CMD
> +     local rc=$?
> +     if [ $rc -ne 0 ]; then
> +         exit $rc
> +--
> +2.20.1
> +
> --
> 2.20.1
>


-- 

Matthew Weber | Associate Director Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 295 7349 | FAX: +1 319 263 6099

matthew.weber at collins.com | collinsaerospace.com



CONFIDENTIALITY WARNING: This message may contain proprietary and/or
privileged information of Collins Aerospace and its affiliated
companies. If you are not the intended recipient, please 1) Do not
disclose, copy, distribute or use this message or its contents. 2)
Advise the sender by return email. 3) Delete all copies (including all
attachments) from your computer. Your cooperation is greatly
appreciated.


Any export restricted material should be shared using my
matthew.weber at corp.rockwellcollins.com address.


ALPHA BRAVO COLLINS | Aerospace Redefined

         __ l __

 \- - - -o-(_)-o- - - -/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name
  2020-08-24 12:41 [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name Heiko Thiery
  2020-08-24 19:49 ` Matthew Weber
@ 2020-08-24 20:21 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2020-08-24 20:21 UTC (permalink / raw)
  To: buildroot

On Mon, 24 Aug 2020 14:41:47 +0200
Heiko Thiery <heiko.thiery@gmail.com> wrote:

> When building on a host that has no name specified for the used group in
> /etc/group the script in install step will fail due to missing group name.
> 
> CMake Error at CMakeLists.txt:80 (message):
>   Learning server module group failed: id: cannot find name for group ID 8000
> 
> The patch was taken from upstream and modified manually because of merge
> conflicts.
> 
> Fixes:
> http://autobuild.buildroot.net/results/f197ca1def9dc1292e1e784757f2da9d95484431/
> 
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
> Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> Cc: Matthew Weber <matthew.weber@rockwellcollins.com>
> ---
>  ...support-using-current-user-for-SR-mo.patch | 98 +++++++++++++++++++
>  1 file changed, 98 insertions(+)
>  create mode 100644 package/netopeer2/0003-scripts-FEATURE-support-using-current-user-for-SR-mo.patch

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-24 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 12:41 [Buildroot] [PATCH 1/1] package/netopeer2: add patch to solve issue with empty group name Heiko Thiery
2020-08-24 19:49 ` Matthew Weber
2020-08-24 20:21 ` Thomas Petazzoni

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.