[oe-commits] Julian Pidancet : Fix the --root option in shadow-native programs

git version control git at git.openembedded.org
Fri Oct 7 14:46:03 UTC 2011


Module: openembedded-core.git
Branch: master-next
Commit: 2cfa60f099554fbdd398261a9ad3791e6ed9c37b
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=2cfa60f099554fbdd398261a9ad3791e6ed9c37b

Author: Julian Pidancet <julian.pidancet at gmail.com>
Date:   Fri Oct  7 01:13:40 2011 +0100

Fix the --root option in shadow-native programs

The add_root_cmd_options.patch that we apply to shadow-native allow the
various programs from the shadow utility package to chroot() so they can
be used to modify etc/passwd and etc/group if they are located in a
sysroot.

Some of the shadow programs (gpasswd, useradd and usermod) need to parse
the command line in two passes. But we can't use getopt_long() twice
because getopt_long() reorders the command line arguments, and
consequently corrupts the option parsing during the second pass.

This patch fixes this issue by replacing the first pass by a very simple
manual walk of the command line to handle the --root argument.

This change is a patch of another patch, I apologize if it is
difficult to read. But IMHO it wouldn't make sense to put the patch for
this issue in another separated file.

The --root options in groupadd and useradd are needed to make the
useradd class work, and this issue was preventing to use useradd and
groupadd long options while using the class.

Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 .../shadow/files/add_root_cmd_options.patch        |  189 ++++++++++----------
 1 files changed, 98 insertions(+), 91 deletions(-)

Diff:   http://git.openembedded.org/?p=openembedded-core.git/?a=commitdiff;h=2cfa60f099554fbdd398261a9ad3791e6ed9c37b




More information about the Openembedded-commits mailing list