Bug 1212679

Summary: Failed to create a augeas handle with flag=8 because of custom lens (guestfs_lvm_conf.aug)
Product: [Fedora] Fedora Reporter: Hu Zhang <huzhan>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: leiwang, mbooth, ptoscano, rjones, virt-maint, xchen
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-30 19:31:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Zhang 2015-04-17 05:06:48 UTC
Description of problem:
Failed to create a augeas handle with flag=8. It works well on RHEL6.7 and RHEL7.1 


Version-Release number of selected component (if applicable):
libguestfs-1.29.33-1.fc22.x86_64
libguestfs-tools-c-1.29.33-1.fc22.x86_64
augeas-libs-1.3.0-1.fc22.x86_64


How reproducible:
100%


Steps to Reproduce:
Run the following commands:
#guestfish -N fs
><fs> trace 1
><fs> mount /dev/sda1 /
libguestfs: trace: mount "/dev/sda1" "/"
libguestfs: trace: mount = 0
><fs> aug-init / 8
libguestfs: trace: aug_init "/" 8
libguestfs: trace: aug_init = -1 (error)
libguestfs: error: aug_init: aug_init: / (flags 8): Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquote
/usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable Quote.do_dquote
/usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Could not load module Rx for Rx.relinteger
/usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Undefined variable Rx.relinteger
/usr/share/guestfs/guestfs_lvm_conf.aug:32.20-.23:Undefined variable int
/usr/share/guestfs/guestfs_lvm_conf.aug:40.17-.29:Undefined variable flat_literal
/usr/share/guestfs/guestfs_lvm_conf.aug:46.11-.23:Undefined variable flat_literal
/usr/share/guestfs/guestfs_lvm_conf.aug:51.4-.14:Could not load module Util for Util.empty
/usr/share/guestfs/guestfs_lvm_conf.aug:51.4-.14:Undefined variable Util.empty
/usr/share/guestfs/guestfs_lvm_conf.aug:59.4-.15:Could not load module Util for Util.indent
/usr/share/guestfs/guestfs_lvm_conf.aug:59.4-.15:Undefined variable Util.indent
/usr/share/guestfs/guestfs_lvm_conf.aug:67.11-.18:Undefined variable nondef
/usr/share/guestfs/guestfs_lvm_conf.aug:72.4-.16:Could not load module Util for Util.stdexcl
/usr/share/guestfs/guestfs_lvm_conf.aug:72.4-.16:Undefined variable Util.stdexcl
/usr/share/guestfs/guestfs_lvm_conf.aug:74.21-.24:Undefined variable lns
/usr/share/guestfs/guestfs_lvm_conf.aug:74.25-.31:Undefined variable filter


Actual results:
As above


Expected results:
Create a augeas handle with flag=8 successfully, i.e. no output after command: 
><fs> aug-init / 8
<no output>

Additional info:

Comment 1 Richard W.M. Jones 2015-04-17 09:13:32 UTC
One line reproducer:

$ guestfish -N fs -x -m /dev/sda1 aug-init / 8
[...]
libguestfs: error: aug_init: aug_init: / (flags 8): Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquote
/usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable Quote.do_dquote
[ etc errors as above ]

Flag 8 is AUG_NO_STDINC.  Could be an Augeas bug.  I would have
expected that AUG_NO_STDINC + AUG_NO_LOAD (8+32 = 40) would work, but:

$ guestfish -N fs -x -m /dev/sda1 aug-init / 40

gives the same errors.

Dominic, any ideas?

Comment 2 Dominic Cleal 2015-04-20 09:16:14 UTC
(In reply to Richard W.M. Jones from comment #1)
> One line reproducer:
> 
> $ guestfish -N fs -x -m /dev/sda1 aug-init / 8
> [...]
> libguestfs: error: aug_init: aug_init: / (flags 8): Syntax error in lens
> definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load
> module Quote for Quote.do_dquote
> /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable
> Quote.do_dquote
> [ etc errors as above ]
> 
> Flag 8 is AUG_NO_STDINC.  Could be an Augeas bug.  I would have
> expected that AUG_NO_STDINC + AUG_NO_LOAD (8+32 = 40) would work [..]

The issue is that libguestfs includes a directory (/usr/share/guestfs/) into Augeas' search path, and the guestfs_lvm_conf module (lens) inside that depends on some of the modules included by default in Augeas.

Since AUG_NO_STDINC removes Augeas' default modules from the search path, these two behaviours are mutually exclusive.

The extra modules in /usr/share/guestfs/ are just to work around old Augeas bugs I believe, so I'd suggest only adding /usr/share/guestfs/ to the search path when not using AUG_NO_STDINC (which is only going to be a user calling aug-init), or only from code paths that need these updated modules (LVM, shadow).

Comment 3 Richard W.M. Jones 2015-04-20 09:43:47 UTC
Yes of course.  All the more reason to get rid of our augeas hacks.

Comment 5 Fedora End Of Life 2016-07-19 13:45:20 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Xianghua Chen 2017-04-19 08:38:53 UTC
I encounter the same issue on Fedora 26 (4.11.0-0.rc5.git0.1.fc26.x86_64) with packages:
libguestfs-1.36.3-2.fc26.x86_64

Steps:
# guestfish -N fs -x -m /dev/sda1 aug-init / 8
libguestfs: trace: set_pgroup true
libguestfs: trace: set_pgroup = 0
libguestfs: trace: add_drive "test1.img" "format:raw"
libguestfs: trace: add_drive = 0
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: get_backend_setting "force_tcg"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_backend_setting "internal_libvirt_label"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_backend_setting "internal_libvirt_imagelabel"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_backend_setting "internal_libvirt_norelabel_disks"
libguestfs: trace: get_backend_setting = NULL (error)
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: disk_create "/tmp/libguestfs0AZEGR/overlay1" "qcow2" -1 "backingfile:/var/tmp/.guestfs-0/appliance.d/root" "backingformat:raw"
libguestfs: trace: disk_create = 0
libguestfs: trace: get_sockdir
libguestfs: trace: get_sockdir = "/tmp"
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: trace: launch = 0
libguestfs: trace: part_disk "/dev/sda" "mbr"
libguestfs: trace: part_disk = 0
libguestfs: trace: mkfs "ext2" "/dev/sda1"
libguestfs: trace: mkfs = 0
libguestfs: trace: mount_options "" "/dev/sda1" "/"
libguestfs: trace: mount_options = 0
libguestfs: trace: aug_init "/" 8
libguestfs: trace: aug_init = -1 (error)
libguestfs: error: aug_init: aug_init: / (flags 8): Syntax error in lens definition: /usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Could not load module Quote for Quote.do_dquote
/usr/share/guestfs/guestfs_lvm_conf.aug:28.25-.40:Undefined variable Quote.do_dquote
/usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Could not load module Rx for Rx.relinteger
/usr/share/guestfs/guestfs_lvm_conf.aug:29.31-.44:Undefined variable Rx.relinteger
/usr/share/guestfs/guestfs_lvm_conf.aug:32.20-.23:Undefined variable int
/usr/share/guestfs/guestfs_lvm_conf.aug:40.17-.29:Undefined variable flat_literal
/usr/share/guestfs/guestfs_lvm_conf.aug:46.11-.23:Undefined variable flat_literal
/usr/share/guestfs/guestfs_lvm_conf.aug:51.4-.14:Could not load module Util for Util.empty
/usr/share/guestfs/guestfs_lvm_conf.aug:51.4-.14:Undefined variable Util.empty
/usr/share/guestfs/guestfs_lvm_conf.aug:59.4-.15:Could not load module Util for Util.indent
/usr/share/guestfs/guestfs_lvm_conf.aug:59.4-.15:Undefined variable Util.indent
/usr/share/guestfs/guestfs_lvm_conf.aug:67.11-.18:Undefined variable nondef
/usr/share/guestfs/guestfs_lvm_conf.aug:72.4-.16:Could not load module Util for Util.stdexcl
/usr/share/guestfs/guestfs_lvm_conf.aug:72.4-.16:Undefined variable Util.stdexcl
/usr/share/guestfs/guestfs_lvm_conf.aug:74.21-.24:Undefined variable lns
/usr/share/guestfs/guestfs_lvm_conf.aug:74.25-.31:Undefined variable filter
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0

Comment 7 Richard W.M. Jones 2017-04-20 07:49:42 UTC
Yes, this still needs to be fixed upstream by removing / upstreaming
our Augeas hacks.

Comment 8 Jan Kurik 2017-08-15 07:03:47 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 9 Ben Cotton 2018-11-27 17:17:18 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Ben Cotton 2018-11-30 19:31:13 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.