mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2] ptxd_install_resolve_usr_grp: skip empty params
@ 2018-10-26 14:05 Andrej.Gantvorg
  0 siblings, 0 replies; only message in thread
From: Andrej.Gantvorg @ 2018-10-26 14:05 UTC (permalink / raw)
  To: ptxdist

Empty parameters may be passed to ptxd_install_resolve_usr_grp i.e. when
calling install_archive with UID/GID set to '-'. According to
documentation this should preserve the owner/group stored in the
archive. Without this patch, empty strings are mapped to the first entry
in /etc/{passwd,group} (usually 0) instead, thus breaking the documented
behaviour.

Signed-off-by: Andrej Gantvorg <andrej.gantvorg@wago.com>
---

Hello Michael,

sorry for having missed your comments!
Here's the adjusted version.

I've adjusted my mail config and hope this time the formatting will be ok.

Greets,
Andrej

 scripts/lib/ptxd_make_xpkg_pkg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index de0db4b..62fb302 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -79,12 +79,12 @@ export -f ptxd_install_getent_id
 # convert usr/grp that contain names into numeric values
 #
 ptxd_install_resolve_usr_grp() {
-    if ! [ 0 -le $usr ] 2>/dev/null; then
+    if [ -n "$usr" ] && ! [ 0 -le "$usr" ] 2>/dev/null; then
 	ptxd_install_getent_id usr || return
     else
 	unset usr_name
     fi
-    if ! [ 0 -le $grp ] 2>/dev/null; then
+    if [ -n "$grp" ] && ! [ 0 -le "$grp" ] 2>/dev/null; then
 	ptxd_install_getent_id grp || return
     else
 	unset grp_name
-- 
2.7.4

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-26 14:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 14:05 [ptxdist] [PATCH v2] ptxd_install_resolve_usr_grp: skip empty params Andrej.Gantvorg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox