[Libguestfs] [PATCH] daemon: Remove custom Augeas lenses.
Richard W.M. Jones
rjones at redhat.com
Fri Oct 24 15:25:59 UTC 2014
On Fri, Oct 24, 2014 at 05:09:19PM +0200, Pino Toscano wrote:
> On Friday 24 October 2014 16:00:15 Richard W.M. Jones wrote:
> > Don't carry around Augeas lenses. It is fragile, since if the lens is
> > added to upstream Augeas but the version number has not changed, then
> > Augeas won't parse the target file at all. This specifically causes
> > password adjustments to fail in RHEL 7.1.
>
> I disagree with this patch, in the current situation.
> The two lenses we carry have not been part of any Augeas release (last
> is 1.2.0, done months ago), thus this would break the password changing
> and the user removal from /etc/shadow, and the LVM filtering.
Why don't we carry the Augeas lenses downstream in Fedora until
Augeas 1.2.<whatever> is out?
I'm also sending an email to augeas-devel to encourage them to make
an upstream release.
Rich.
> What has broken in RHEL 7.1 is the local addition of the lenses, and
> thus what's needed to fix it is the local disabling of our lenses. Patch
> attached for it.
>
> This patch could be okay for me (modulo change below) once Augeas >=
> 1.2.1 is released.
>
> > diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
> > index 72fe6ac..d119f9e 100644
> > --- a/daemon/lvm-filter.c
> > +++ b/daemon/lvm-filter.c
> > @@ -133,18 +133,6 @@ set_filter (char *const *filters)
> > return -1;
> > }
> >
> > - r = aug_transform (aug, "guestfs_lvm_conf", "/lvm/lvm.conf",
> > - 0 /* = included */);
> > - if (r == -1) {
> > - AUGEAS_ERROR ("aug_transform");
> > - return -1;
> > - }
> > -
> > - if (aug_load (aug) == -1) {
> > - AUGEAS_ERROR ("aug_load");
> > - return -1;
> > - }
> > -
> > /* Remove all the old filters ... */
> > r = aug_rm (aug, "/files/lvm/lvm.conf/devices/dict/filter/list/*");
> > if (r == -1) {
>
> Note this part is needed, since within the local lvm config tree the
> configuration file is /lvm/lvm.conf, thus the transform is needed (see
> the change in the patch).
>
> --
> Pino Toscano
> diff --git a/appliance/Makefile.am b/appliance/Makefile.am
> index 7b30bbe..c7eca20 100644
> --- a/appliance/Makefile.am
> +++ b/appliance/Makefile.am
> @@ -82,8 +82,6 @@ supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_c
> mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc tmp-d/usr/share/guestfs
> ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
> ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
> - ln $(srcdir)/guestfs_lvm_conf.aug tmp-d/usr/share/guestfs/guestfs_lvm_conf.aug
> - ln $(srcdir)/guestfs_shadow.aug tmp-d/usr/share/guestfs/guestfs_shadow.aug
> ( cd tmp-d && tar zcf - * ) > $@-t
> rm -r tmp-d
> mv $@-t $@
> diff --git a/daemon/augeas.c b/daemon/augeas.c
> index ce49726..7753e67 100644
> --- a/daemon/augeas.c
> +++ b/daemon/augeas.c
> @@ -134,7 +134,7 @@ do_aug_init (const char *root, int flags)
> }
>
> /* Pass AUG_NO_ERR_CLOSE so we can display detailed errors. */
> - aug = aug_init (buf, "/usr/share/guestfs/", flags | AUG_NO_ERR_CLOSE);
> + aug = aug_init (buf, NULL, flags | AUG_NO_ERR_CLOSE);
>
> if (!aug) {
> reply_with_error ("augeas initialization failed");
> @@ -148,6 +148,8 @@ do_aug_init (const char *root, int flags)
> return -1;
> }
>
> + /* We already have the needed lenses in RHEL 7 */
> +#if 0
> if (!augeas_is_version (1, 2, 1)) {
> int r = aug_transform (aug, "guestfs_shadow", "/etc/shadow",
> 0 /* = included */);
> @@ -166,6 +168,7 @@ do_aug_init (const char *root, int flags)
> }
> }
> }
> +#endif
>
> return 0;
> }
> diff --git a/daemon/lvm-filter.c b/daemon/lvm-filter.c
> index 72fe6ac..d1e6466 100644
> --- a/daemon/lvm-filter.c
> +++ b/daemon/lvm-filter.c
> @@ -122,7 +122,7 @@ set_filter (char *const *filters)
> * but do that only after having applied the transformation.
> */
> const int flags = AUG_NO_ERR_CLOSE | AUG_NO_LOAD;
> - aug = aug_init (lvm_system_dir, "/usr/share/guestfs/", flags);
> + aug = aug_init (lvm_system_dir, NULL, flags);
> if (!aug) {
> reply_with_error ("augeas initialization failed");
> return -1;
> @@ -133,7 +133,7 @@ set_filter (char *const *filters)
> return -1;
> }
>
> - r = aug_transform (aug, "guestfs_lvm_conf", "/lvm/lvm.conf",
> + r = aug_transform (aug, "lvm", "/lvm/lvm.conf",
> 0 /* = included */);
> if (r == -1) {
> AUGEAS_ERROR ("aug_transform");
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list