Richard W.M. Jones | 30 Oct 14:41 2014
Picon

[PATCH 0/2] v2v: Add --password-file parameter (RHBZ#1158526).

These patches add the --password-file parameter, allowing you to pass
a single password via a file.

https://bugzilla.redhat.com/show_bug.cgi?id=1158526

Rich.
Hu Tao | 30 Oct 03:46 2014

[PATCH v5 REBASE 0/4] virt-resize: add support for resizing logical

Hi Rich,

This is rebase of v5 series. Meanwhile, I found a bug when shrinking
partitions, and the fix is incuded in this version (patch 2).

Regards,
Hu

changes to v4:
  1. add support to resize extended partition (--resize or --expand extended partition)
  2. fix the problem of deficit of 512 bytes when expanding a logical partition
     (this problem can be reproduced in v4 by only expanding a logical partition, without resizing any other partitions)
  3. update the test script to support logical partitions and extended partition

changes to v3:
  1. merge patch 1 and patch 3 in v3
  2. let mbr_part_type return 'primary' for GPT partitions
  3. add test for resizing logical partitions
  4. fix extending the extended partition (yet). see patch 7.

changes to v2:
  1. remove p_part_num
  2. remove filter_parts
  3. name the function calculate_target_partitions
  4. remove the code to restart guest introduced in v2

changes to v1:
  1. spit the patches so it's easier to review
  2. fix the parted error caused by unaligned logical partitions
  3. extend the content of logical partitions
(Continue reading)

Mahmoud Al-Qudsi | 29 Oct 16:43 2014
Picon

[libhivex] Undefined behavior when accessing invalid (too small) registry hives

Hello all,

I know that one of the original design goals of libhivex was to be resilient to corrupt, invalid, or malicious registry hives. I've encountered some undefined behavior in libhivex when attempting to open registry files that are too small. I'm not sure if this is a known issue per-se or not, so I figured I'd ask here on the mailing list before I jumped in and started adding out-of-bounds checks everywhere. 

The simplest test case is when attempting to open a zero-byte registry file, handle.c will mmap a zero-byte file and then go out of bounds while comparing against the registry header ("regf"). I imagine even if you pass in a 4-byte file, the header checksum calculation will loop over 0x7F bytes, so you'd probably encounter another error there. I guess I'm just not sure where the ideal location(s) to place range-checking would be; is there anything smarter than plastering checks at every read/write to the registry file?

Or is it expected that certain sanity checks would be performed prior to passing along any files to libhivex? What would those checks be?

Thank you,

Mahmoud Al-Qudsi
NeoSmart Technologies

_______________________________________________
Libguestfs mailing list
Libguestfs <at> redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
Richard W.M. Jones | 28 Oct 16:29 2014
Picon

Re: some compile errors

On Tue, Oct 28, 2014 at 11:22:47PM +0800, Zhi Yong Wu wrote:
> HI, Richard
> 
> Can you know what is missing when the following issue took place?
> 
> #gcc mount-local.c -o mount-local -lguestfs
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libguestfs.so:
> undefined reference to `guestfs__internal_test_rconstoptstring'
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libguestfs.so:
> undefined reference to `guestfs__internal_test_rstringlist'
[... and many more ...]

The command should work.

However what version of libguestfs?  What distro?  Did you compile it
yourself or get it from some package?  GCC 4.1.2 dates from 2007, so
I'm guessing that you are trying this on something very old.

Rich.

--

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
Hu Tao | 28 Oct 08:51 2014

[PATCH] sysprep: remove /var/spool/mail/username

remove /var/spool/mail/username if --enable user-account.

Signed-off-by: Hu Tao <hutao <at> cn.fujitsu.com>
---
 sysprep/sysprep_operation_user_account.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml
index fda5547..bda6331 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
 <at>  <at>  -83,6 +83,7  <at>  <at>  let user_account_perform ~verbose ~quiet g root side_effects =
           g#aug_rm userpath;
           g#aug_rm (sprintf "/files/etc/shadow/%s" username);
           g#aug_rm (sprintf "/files/etc/group/%s" username);
+          g#rm_rf ("/var/spool/mail/" ^ username);
           match home_dir with
           | None -> ()
           | Some dir -> g#rm_rf dir
--

-- 
1.9.3
Richard W.M. Jones | 24 Oct 17:37 2014
Picon

[PATCH v3] daemon: Remove custom Augeas lenses.

v3:

 - Don't remove the LVM transform.
Richard W.M. Jones | 24 Oct 17:32 2014
Picon

[PATCH v2] daemon: Remove custom Augeas lenses.

v2 of previous patch, which fixes some missing bits.

For now I'm going to go with Pino's RHEL 7.1 patch, since it
is at least smaller than this.  So I'm sending this to the list
just to have it archived for later.

Rich.
Richard W.M. Jones | 24 Oct 17:00 2014
Picon

[PATCH] daemon: Remove custom Augeas lenses.

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.

In future, if we need an Augeas lens, it must be added to Augeas,
either upstream or as a downstream patch carried around by distros.
---
 README                         |  2 +-
 appliance/Makefile.am          |  6 +---
 appliance/guestfs_lvm_conf.aug | 74 ------------------------------------------
 appliance/guestfs_shadow.aug   | 72 ----------------------------------------
 appliance/hostfiles.in         |  1 -
 configure.ac                   |  3 ++
 daemon/augeas.c                | 21 +-----------
 daemon/daemon.h                | 11 -------
 daemon/lvm-filter.c            | 14 +-------
 9 files changed, 7 insertions(+), 197 deletions(-)
 delete mode 100644 appliance/guestfs_lvm_conf.aug
 delete mode 100644 appliance/guestfs_shadow.aug

diff --git a/README b/README
index 30e241a..2e7930b 100644
--- a/README
+++ b/README
 <at>  <at>  -104,7 +104,7  <at>  <at>  The full requirements are described below.
 +--------------+-------------+---+-----------------------------------------+
 | libxml2      |             | R | Popular XML library.                    |
 +--------------+-------------+---+-----------------------------------------+
-| augeas       | 1.0.0       | R |                                         |
+| augeas       | 1.2.0       | R |                                         |
 +--------------+-------------+---+-----------------------------------------+
 | xz           |             | R | Used to compress disk images.           |
 |              |             |   | Used by virt-builder for compression.   |
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
index 7b30bbe..ebc526e 100644
--- a/appliance/Makefile.am
+++ b/appliance/Makefile.am
 <at>  <at>  -21,8 +21,6  <at>  <at>  EXTRA_DIST = \
 	99-guestfs-serial.rules \
 	excludefiles.in \
 	guestfsd.suppressions \
-	guestfs_lvm_conf.aug \
-	guestfs_shadow.aug \
 	hostfiles.in \
 	init \
 	libguestfs-make-fixed-appliance.in \
 <at>  <at>  -76,14 +74,12  <at>  <at>  packagelist: packagelist.in Makefile
 	cmp -s $ <at>  $ <at> -t || mv $ <at> -t $ <at> 
 	rm -f $ <at> -t

-supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions guestfs_lvm_conf.aug guestfs_shadow.aug
+supermin.d/daemon.tar.gz: ../daemon/guestfsd guestfsd.suppressions
 	rm -f $ <at>  $ <at> -t
 	rm -rf tmp-d
 	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 - * ) > $ <at> -t
 	rm -r tmp-d
 	mv $ <at> -t $ <at> 
diff --git a/appliance/guestfs_lvm_conf.aug b/appliance/guestfs_lvm_conf.aug
deleted file mode 100644
index ffa5b01..0000000
--- a/appliance/guestfs_lvm_conf.aug
+++ /dev/null
 <at>  <at>  -1,74 +0,0  <at>  <at> 
-(*
-Module: LVM
-  Parses LVM metadata.
-
-Author: Gabriel de Perthuis	      <g2p.code+augeas <at> gmail.com>
-
-About: License
-  This file is licensed under the LGPL v2+.
-
-About: Configuration files
-  This lens applies to files in /etc/lvm/backup and /etc/lvm/archive.
-
-About: Examples
-  The <Test_LVM> file contains various examples and tests.
-*)
-
-module Guestfs_LVM_conf =
-	autoload xfm
-
-	(* See lvm2/libdm/libdm-config.c for tokenisation;
-	 * libdm uses a blacklist but I prefer the safer whitelist approach. *)
-	(* View: identifier
-	 * The left hand side of a definition *)
-	let identifier = /[a-zA-Z0-9_-]+/
-
-	(* strings can contain backslash-escaped dquotes, but I don't know
-	 * how to get the message across to augeas *)
-	let str = [label "str". Quote.do_dquote (store /([^\"]|\\\\.)*/)]
-	let int = [label "int". store Rx.relinteger]
-	(* View: flat_literal
-	 * A literal without structure *)
-	let flat_literal = int|str
-
-	(* allow multiline and mixed int/str, used for raids and stripes *)
-	(* View: list
-	 * A list containing flat literals *)
-	let list = [
-		  label "list" . counter "list"
-		. del /\[[ \t\n]*/ "["
-		.([seq "list". flat_literal . del /,[ \t\n]*/ ", "]*
-				. [seq "list". flat_literal . del /[ \t\n]*/ ""])?
-		. Util.del_str "]"]
-
-	(* View: val
-	 * Any value that appears on the right hand side of an assignment *)
-	let val = flat_literal | list
-
-	(* View: nondef
-	 * A line that doesn't contain a statement *)
-	let nondef =
-		  Util.empty
-		| Util.comment
-
-	(* Build.block couldn't be reused, because of recursion and
-	 * a different philosophy of whitespace handling. *)
-	(* View: def
-	 * An assignment, or a block containing definitions *)
-	let rec def = [
-		  Util.indent . key identifier . (
-			   del /[ \t]*\{\n/ " {\n"
-			  .[label "dict".(nondef | def)*]
-			  . Util.indent . Util.del_str "}\n"
-			  |Sep.space_equal . val . Util.comment_or_eol)]
-
-	(* View: lns
-	 * The main lens *)
-	let lns = (nondef | def)*
-
-	let filter =
-		  incl "/etc/lvm/archive/*.vg"
-		. incl "/etc/lvm/backup/*"
-		. Util.stdexcl
-
-	let xfm = transform lns filter
diff --git a/appliance/guestfs_shadow.aug b/appliance/guestfs_shadow.aug
deleted file mode 100644
index 2fbf455..0000000
--- a/appliance/guestfs_shadow.aug
+++ /dev/null
 <at>  <at>  -1,72 +0,0  <at>  <at> 
-(*
- Module: Shadow
- Parses /etc/shadow
-
- Author: Lorenzo M. Catucci <catucci <at> ccd.uniroma2.it>
-
- Original Author: Free Ekanayaka <free <at> 64studio.com>
-
- About: Reference
-
-   - man 5 shadow
-   - man 3 getspnam
-
- About: License
-   This file is licensed under the LGPL v2+, like the rest of Augeas.
-
- About:
-
- Each line in the shadow files represents the additional shadow-defined attributes
- for the corresponding user, as defined in the passwd file.
-
-*)
-
-module Guestfs_Shadow =
-
-   autoload xfm
-
-(************************************************************************
- *                           USEFUL PRIMITIVES
- *************************************************************************)
-
-let eol        = Util.eol
-let comment    = Util.comment
-let empty      = Util.empty
-let dels       = Util.del_str
-
-let colon      = Sep.colon
-
-let word       = Rx.word
-let integer    = Rx.integer
-
-let sto_to_col = Passwd.sto_to_col
-let sto_to_eol = Passwd.sto_to_eol
-
-(************************************************************************
- * Group:                        ENTRIES
- *************************************************************************)
-
-(* View: entry *)
-let entry   = [ key word
-                . colon
-                . [ label "password"          . sto_to_col?    . colon ]
-                . [ label "lastchange_date"   . store integer? . colon ]
-                . [ label "minage_days"       . store integer? . colon ]
-                . [ label "maxage_days"       . store integer? . colon ]
-                . [ label "warn_days"         . store integer? . colon ]
-                . [ label "inactive_days"     . store integer? . colon ]
-                . [ label "expire_date"       . store integer? . colon ]
-                . [ label "flag"              . store integer? ]
-                . eol ]
-
-(************************************************************************
- *                                LENS
- *************************************************************************)
-
-let lns        = (comment|empty|entry) *
-
-let filter
-               = incl "/shadow"
-               . Util.stdexcl
-
-let xfm        = transform lns filter
diff --git a/appliance/hostfiles.in b/appliance/hostfiles.in
index 8ff53b5..01a52ae 100644
--- a/appliance/hostfiles.in
+++ b/appliance/hostfiles.in
 <at>  <at>  -14,4 +14,3  <at>  <at>  dnl   FRUGALWARE=1 For Frugalware.
 dnl   MAGEIA=1     For Mageia.

 /lib/lsb/*
-/usr/share/augeas/lenses/*.aug
diff --git a/configure.ac b/configure.ac
index e2ee946..2682358 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -899,6 +899,9  <at>  <at>  dnl Check for PCRE (required)
 PKG_CHECK_MODULES([PCRE], [libpcre])

 dnl Check for Augeas >= 1.0.0 (required).
+dnl In reality, various things will fail unless you have Augeas 1.2.0
+dnl some upstream but not released patches.  However don't fail to
+dnl compile just because this is not satisfied.
 PKG_CHECK_MODULES([AUGEAS],[augeas >= 1.0.0])

 dnl libmagic (highly recommended)
diff --git a/daemon/augeas.c b/daemon/augeas.c
index ce49726..9c8bbcc 100644
--- a/daemon/augeas.c
+++ b/daemon/augeas.c
 <at>  <at>  -134,7 +134,7  <at>  <at>  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");
 <at>  <at>  -148,25 +148,6  <at>  <at>  do_aug_init (const char *root, int flags)
     return -1;
   }

-  if (!augeas_is_version (1, 2, 1)) {
-    int r = aug_transform (aug, "guestfs_shadow", "/etc/shadow",
-                           0 /* = included */);
-    if (r == -1) {
-      AUGEAS_ERROR ("aug_transform");
-      aug_close (aug);
-      aug = NULL;
-      return -1;
-    }
-
-    /* If aug_load was implicitly called, reload the handle. */
-    if ((flags & AUG_NO_LOAD) == 0) {
-      if (aug_load (aug) == -1) {
-        AUGEAS_ERROR ("aug_load");
-        return -1;
-      }
-    }
-  }
-
   return 0;
 }

diff --git a/daemon/daemon.h b/daemon/daemon.h
index 0ccbc9e..95227d6 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
 <at>  <at>  -232,17 +232,6  <at>  <at>  extern void wipe_device_before_mkfs (const char *device);
 extern void aug_read_version (void);
 extern void aug_finalize (void);

-/* The version of augeas, saved as:
- * (MAJOR << 16) | (MINOR << 8) | PATCH
- */
-extern int augeas_version;
-static inline int
-augeas_is_version (int major, int minor, int patch)
-{
-  aug_read_version (); /* Lazy version reading. */
-  return augeas_version >= ((major << 16) | (minor << 8) | patch);
-}
-
 /*-- hivex.c, journal.c --*/
 extern void hivex_finalize (void);
 extern void journal_finalize (void);
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
 <at>  <at>  -122,7 +122,7  <at>  <at>  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;
 <at>  <at>  -133,18 +133,6  <at>  <at>  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) {
--

-- 
2.0.4
Richard W.M. Jones | 24 Oct 15:28 2014
Picon

[PATCH v7 00/10] tests: Introduce test harness for running tests.

v7:

The only changes since v6 are those suggested by Pino in the review
of v5.
Picon

Convert Xen PV to KVM

Hello!
Is it possible to convert a live centos xen pv vps to kvm?

Marian Titieni
Edelweiss srl
Tel: +4 0746.149496

---------------------------------------------------------------------------------------------------------------
This message and any attachment are confidential and may be privileged or otherwise protected from disclosure. 
If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system.  
If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person.
Please consider the environmental impact before printing this document and its attachment(s). Print black and white and double-sided where possible.
------------------------------------------------------------------------------

_______________________________________________
Libguestfs mailing list
Libguestfs <at> redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
Richard W.M. Jones | 24 Oct 11:01 2014
Picon

[PATCH] inspector: Document that -a option can take a URI for remote storage (RHBZ#1156301).

---
 inspector/virt-inspector.pod | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
index f8744b1..1282608 100644
--- a/inspector/virt-inspector.pod
+++ b/inspector/virt-inspector.pod
 <at>  <at>  -68,6 +68,12  <at>  <at>  them with separate I<-a> options.
 The format of the disk image is auto-detected.  To override this and
 force a particular format use the I<--format=..> option.

+=item B<-a> URI
+
+=item B<--add> URI
+
+Add a remote disk.  See L<guestfish(1)/ADDING REMOTE STORAGE>.
+
 =item B<-c URI>

 =item B<--connect URI>
--

-- 
2.0.4

Gmane