mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PTXDIST] [PATCH] ptxd_install_resolve_usr_grp: skip empty params.
@ 2018-10-05  9:26 Andrej.Gantvorg
  2018-10-25 10:00 ` [ptxdist] " Andrej.Gantvorg
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej.Gantvorg @ 2018-10-05  9:26 UTC (permalink / raw)
  To: ptxdist

Empty parameters may be passed 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>
---
  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 b3f2f20f3..0ec1c9b2a 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 ! [ 0 -le "$usr" ] 2>/dev/null && ! [ -z "$usr" ] ; then
     ptxd_install_getent_id usr || return
      else
     unset usr_name
      fi
-    if ! [ 0 -le $grp ] 2>/dev/null; then
+    if ! [ 0 -le "$grp" ] 2>/dev/null && ! [ -z "$grp" ] ; then
     ptxd_install_getent_id grp || return
      else
     unset grp_name
-- 
2.11.3
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ptxd_install_resolve_usr_grp: skip empty params.
  2018-10-05  9:26 [ptxdist] [PTXDIST] [PATCH] ptxd_install_resolve_usr_grp: skip empty params Andrej.Gantvorg
@ 2018-10-25 10:00 ` Andrej.Gantvorg
  2018-10-25 16:09   ` Michael Olbrich
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej.Gantvorg @ 2018-10-25 10:00 UTC (permalink / raw)
  To: ptxdist

Hello Michael,

just wanted to ask whether you have already had an opportunity to have a 
look at this one?

Thank you,
Andrej

Am 05.10.2018 um 11:26 schrieb Andrej.Gantvorg@wago.com:
> Empty parameters may be passed 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>
> ---
>    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 b3f2f20f3..0ec1c9b2a 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 ! [ 0 -le "$usr" ] 2>/dev/null && ! [ -z "$usr" ] ; then
>       ptxd_install_getent_id usr || return
>        else
>       unset usr_name
>        fi
> -    if ! [ 0 -le $grp ] 2>/dev/null; then
> +    if ! [ 0 -le "$grp" ] 2>/dev/null && ! [ -z "$grp" ] ; then
>       ptxd_install_getent_id grp || return
>        else
>       unset grp_name
> 
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ptxd_install_resolve_usr_grp: skip empty params.
  2018-10-25 10:00 ` [ptxdist] " Andrej.Gantvorg
@ 2018-10-25 16:09   ` Michael Olbrich
  2018-10-26  9:34     ` Andrej.Gantvorg
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2018-10-25 16:09 UTC (permalink / raw)
  To: ptxdist

Hi,

On Thu, Oct 25, 2018 at 10:00:26AM +0000, Andrej.Gantvorg@wago.com wrote:
> just wanted to ask whether you have already had an opportunity to have a 
> look at this one?

It fell through the cracks on my end. Thanks for the reminder.

> Am 05.10.2018 um 11:26 schrieb Andrej.Gantvorg@wago.com:
> > Empty parameters may be passed 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>
> > ---

The white-spaces are broken in this patch, so it does not apply. Maybe send
it as an attachment instead.

> >    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 b3f2f20f3..0ec1c9b2a 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 ! [ 0 -le "$usr" ] 2>/dev/null && ! [ -z "$usr" ] ; then

if [ -n "$usr" ] && ...

> >       ptxd_install_getent_id usr || return
> >        else
> >       unset usr_name
> >        fi
> > -    if ! [ 0 -le $grp ] 2>/dev/null; then
> > +    if ! [ 0 -le "$grp" ] 2>/dev/null && ! [ -z "$grp" ] ; then

same here.

Michael

> >       ptxd_install_getent_id grp || return
> >        else
> >       unset grp_name
> > 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ptxd_install_resolve_usr_grp: skip empty params.
  2018-10-25 16:09   ` Michael Olbrich
@ 2018-10-26  9:34     ` Andrej.Gantvorg
  2018-10-26  9:43       ` Michael Olbrich
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej.Gantvorg @ 2018-10-26  9:34 UTC (permalink / raw)
  To: ptxdist

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

Hello,


> The white-spaces are broken in this patch, so it does not apply. Maybe send
> it as an attachment instead.

Here it is!


Greets,
Andrej

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ptxd_install_resolve_usr_grp-skip-empty-params.patch --]
[-- Type: text/x-patch; name="0001-ptxd_install_resolve_usr_grp-skip-empty-params.patch", Size: 1493 bytes --]

From 0a062f0179ae647bec338161aacf1a8a29414083 Mon Sep 17 00:00:00 2001
From: Andrej Gantvorg <andrej.gantvorg@wago.com>
Date: Fri, 5 Oct 2018 09:22:13 +0200
Subject: [PTXDIST PATCH] ptxd_install_resolve_usr_grp: skip empty params.
To: ptxdist@pengutronix.de

Empty parameters may be passed 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>
---
 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 b3f2f20f3..0ec1c9b2a 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 ! [ 0 -le "$usr" ] 2>/dev/null && ! [ -z "$usr" ] ; then
 	ptxd_install_getent_id usr || return
     else
 	unset usr_name
     fi
-    if ! [ 0 -le $grp ] 2>/dev/null; then
+    if ! [ 0 -le "$grp" ] 2>/dev/null && ! [ -z "$grp" ] ; then
 	ptxd_install_getent_id grp || return
     else
 	unset grp_name
-- 
2.11.3


[-- Attachment #3: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ptxd_install_resolve_usr_grp: skip empty params.
  2018-10-26  9:34     ` Andrej.Gantvorg
@ 2018-10-26  9:43       ` Michael Olbrich
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Olbrich @ 2018-10-26  9:43 UTC (permalink / raw)
  To: ptxdist

On Fri, Oct 26, 2018 at 09:34:51AM +0000, Andrej.Gantvorg@wago.com wrote:
> Hello,
> 
> 
> > The white-spaces are broken in this patch, so it does not apply. Maybe send
> > it as an attachment instead.
> 
> Here it is!

It applies now, but you did not address my other review.

Michael

> From 0a062f0179ae647bec338161aacf1a8a29414083 Mon Sep 17 00:00:00 2001
> From: Andrej Gantvorg <andrej.gantvorg@wago.com>
> Date: Fri, 5 Oct 2018 09:22:13 +0200
> Subject: [PTXDIST PATCH] ptxd_install_resolve_usr_grp: skip empty params.
> To: ptxdist@pengutronix.de
> 
> Empty parameters may be passed 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>
> ---
>  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 b3f2f20f3..0ec1c9b2a 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 ! [ 0 -le "$usr" ] 2>/dev/null && ! [ -z "$usr" ] ; then
>  	ptxd_install_getent_id usr || return
>      else
>  	unset usr_name
>      fi
> -    if ! [ 0 -le $grp ] 2>/dev/null; then
> +    if ! [ 0 -le "$grp" ] 2>/dev/null && ! [ -z "$grp" ] ; then
>  	ptxd_install_getent_id grp || return
>      else
>  	unset grp_name
> -- 
> 2.11.3
> 

> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2018-10-26  9:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05  9:26 [ptxdist] [PTXDIST] [PATCH] ptxd_install_resolve_usr_grp: skip empty params Andrej.Gantvorg
2018-10-25 10:00 ` [ptxdist] " Andrej.Gantvorg
2018-10-25 16:09   ` Michael Olbrich
2018-10-26  9:34     ` Andrej.Gantvorg
2018-10-26  9:43       ` Michael Olbrich

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