Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 02:35:38PM -0500, Eric Blake wrote: > > > +=head2 Parsing probabilities > > > + > > > +Use the C utility function to parse > > > +probabilities. Common formats understood include: C<"0.1">, C<"10%"> > > > +or C<"1:10">, which all mean a probability of 1 in 10. > > > + > >

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 07:20:16PM +0200, Laszlo Ersek wrote: > > On 5/16/23 14:12, Richard W.M. Jones wrote: > > In nbdkit-error-filter we need to parse parameters as probabilities. > > This is useful enough to add to nbdkit, since we will use it in > > another filter in future. > > --- I'll

Re: [Libguestfs] [PATCH nbdkit 5/5] New filter: evil

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 05:24:58PM +0100, Richard W.M. Jones wrote: > > > + > > > +# If we read subsets they should match the contents of the buffer. > > > +buf1 = h.pread(1000, 1000) > > > +assert(buf1 == buf[1000:2000]) > > > + > > > +buf1 = h.pread(1, 999) > > > +assert(buf1 ==

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:12, Richard W.M. Jones wrote: > In nbdkit-error-filter we need to parse parameters as probabilities. > This is useful enough to add to nbdkit, since we will use it in > another filter in future. > --- > docs/nbdkit-plugin.pod | 19 +++ >

Re: [Libguestfs] [PATCH nbdkit 5/5] New filter: evil

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 10:55:25AM -0500, Eric Blake wrote: > > +static int > > +evil_config (nbdkit_next_config *next, nbdkit_backend *nxdata, > > + const char *key, const char *value) > > +{ > > + if (strcmp (key, "evil") == 0 || strcmp (key, "evil-mode") == 0) { > > +if (strcmp

Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:29, Eric Blake wrote: > > On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: >> >> It takes a 64 bit integer and finds the next power of 2, >> eg. next_power_of_2 (510) => 512 (2^9) >> >> Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ >> with some

Re: [Libguestfs] [libguestfs-common PATCH 2/2] options/keys: introduce unescape_device_mapper_lvm()

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:17, Richard W.M. Jones wrote: > On Mon, May 15, 2023 at 07:49:24PM +0200, Laszlo Ersek wrote: >> Introduce unescape_device_mapper_lvm() for turning >> >> /dev/mapper/VG-LV >> >> key IDs into >> >> /dev/VG/LV >> >> ones, unescaping doubled hyphens to single hyphens in both VG and

Re: [Libguestfs] [PATCH nbdkit 5/5] New filter: evil

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 01:12:19PM +0100, Richard W.M. Jones wrote: > > This filter adds random data corruption when reading from the > underlying plugin. > --- > filters/error/nbdkit-error-filter.pod | 4 + > filters/evil/nbdkit-evil-filter.pod | 159 > configure.ac

Re: [Libguestfs] [libguestfs-common PATCH 1/2] options/keys: key_store_import_key(): un-constify "key" parameter

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:14, Richard W.M. Jones wrote: > On Mon, May 15, 2023 at 07:49:23PM +0200, Laszlo Ersek wrote: >> The key_store_import_key() function is called from both C-language >> utilities -- via key_store_add_from_selector() -- and OCaml-language ones >> -- via

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Richard W.M. Jones
Or maybe we could have tests/Makefile.am remove GLIBC_TUNABLES if we're using valgrind. Something like this perhaps ... check-valgrind: -$(MAKE) VG="@VG@" check +$(MAKE) GLIBC_TUNABLES= VG="@VG@" check Rich. -- Richard Jones, Virtualization Group, Red Hat

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 04:25:04PM +0200, Laszlo Ersek wrote: > Should I submit patches to remove the LD_PRELOAD and GLIBC_TUNABLES > tweaking from all the run scripts? Those do something useful - malloc perturbing occasionally finds bugs. Since you're running RHEL 9, why not install the

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Laszlo Ersek
On 5/16/23 15:26, Richard W.M. Jones wrote: > How many of the tests fail for you? Just a small number or all of > them? Almost all of them fail. I think I've figured out why. First, as I mention up-thread, there's upstream glibc bug ,

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 02:37:00PM +0200, Laszlo Ersek wrote: > Something is not adding up. > > * I've run "ldd" on my locally built virt-v2v binary, to learn what shared > libraries it uses. Then I located all the packages (installed RPMs) providing > those libraries (symlinks in fact), using

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Laszlo Ersek
One mystery resolved: On 5/16/23 14:37, Laszlo Ersek wrote: > I *still* get stack dumps like the following (taken from > "tests/test-v2v-fedora-luks-on-lvm-conversion.sh.log"): > > ==34448== Conditional jump or move depends on uninitialised value(s) > ==34448==at 0x40191DD:

Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 07:29:45AM -0500, Eric Blake wrote: > > On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: > > > > It takes a 64 bit integer and finds the next power of 2, > > eg. next_power_of_2 (510) => 512 (2^9) > > > > Taken from

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:37, Laszlo Ersek wrote: > This whole thing looks completely busted. I'll try to fool around with glibc > tunables. "export GLIBC_TUNABLES=glibc.cpu.hwcap_mask=0" makes no difference for the valgrind results. Laszlo ___ Libguestfs

Re: [Libguestfs] [PATCH nbdkit 4/5] New plugin: ones

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 01:12:18PM +0100, Richard W.M. Jones wrote: > > Returns a fully allocated disk containing all 0xff (all ones), or > another byte of your choice. > --- > +=item BN > + > +Set the repeating byte to C. The default is C<0xff> (all ones). Maybe worth mentioning that the

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-16 Thread Laszlo Ersek
On 5/15/23 19:51, Richard W.M. Jones wrote: > On Mon, May 15, 2023 at 07:22:28PM +0200, Laszlo Ersek wrote: >> Hi Rich, >> >> do we expect "make check-valgrind" to succeed in virt-v2v at the moment >> (at commit e83de8abe6c5)? I see there's a "valgrind-suppressions" file >> in the project root,

Re: [Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 01:12:17PM +0100, Richard W.M. Jones wrote: > > It takes a 64 bit integer and finds the next power of 2, > eg. next_power_of_2 (510) => 512 (2^9) > > Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ > with some fixes. > --- > common/include/ispowerof2.h

Re: [Libguestfs] [v2v PATCH 2/2] LUKS-on-LVM conversion test: test /dev/mapper/VG-LV translation

2023-05-16 Thread Richard W.M. Jones
On Mon, May 15, 2023 at 07:55:29PM +0200, Laszlo Ersek wrote: > In the LUKS-on-LVM conversion test, repeat the null conversion with such > "--key" options that exercise the recent "/dev/mapper/VG-LV" -> > "/dev/VG/LV" translation (unescaping) from libguestfs-common. > > Bugzilla:

Re: [Libguestfs] [v2v PATCH 1/2] LUKS-on-LVM conversion test: rename VGs and LVs

2023-05-16 Thread Richard W.M. Jones
On Mon, May 15, 2023 at 07:55:28PM +0200, Laszlo Ersek wrote: > In preparation for a subsequent patch, rename "VG" to "Volume-Group", and > "LV" to "Logical-Volume-", in the LUKS-on-LVM conversion test. > > Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 > Signed-off-by: Laszlo

Re: [Libguestfs] [libguestfs-common PATCH 2/2] options/keys: introduce unescape_device_mapper_lvm()

2023-05-16 Thread Richard W.M. Jones
On Mon, May 15, 2023 at 07:49:24PM +0200, Laszlo Ersek wrote: > Introduce unescape_device_mapper_lvm() for turning > > /dev/mapper/VG-LV > > key IDs into > > /dev/VG/LV > > ones, unescaping doubled hyphens to single hyphens in both VG and LV in > the process. Libguestfs uses the /dev/VG/LV

Re: [Libguestfs] [libguestfs-common PATCH 1/2] options/keys: key_store_import_key(): un-constify "key" parameter

2023-05-16 Thread Richard W.M. Jones
On Mon, May 15, 2023 at 07:49:23PM +0200, Laszlo Ersek wrote: > The key_store_import_key() function is called from both C-language > utilities -- via key_store_add_from_selector() -- and OCaml-language ones > -- via guestfs_int_mllib_inspect_decrypt(). We currently declare the > function's second

[Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Richard W.M. Jones
In nbdkit-error-filter we need to parse parameters as probabilities. This is useful enough to add to nbdkit, since we will use it in another filter in future. --- docs/nbdkit-plugin.pod | 19 +++ plugins/python/nbdkit-python-plugin.pod | 6 ++ include/nbdkit-common.h

[Libguestfs] [PATCH nbdkit 4/5] New plugin: ones

2023-05-16 Thread Richard W.M. Jones
Returns a fully allocated disk containing all 0xff (all ones), or another byte of your choice. --- plugins/data/nbdkit-data-plugin.pod | 1 + plugins/full/nbdkit-full-plugin.pod | 1 + plugins/null/nbdkit-null-plugin.pod | 1 +

[Libguestfs] [PATCH nbdkit 0/5] New ones plugin and evil filter

2023-05-16 Thread Richard W.M. Jones
This is just a bit of silliness I was thinking about on the plane last week. Yes, I know nbdkit_parse_probability uses scanf and that's bad. I still think we should fix scanf. We might call the new filter "--filter=corruption" instead, but this name stuck. Rich.

[Libguestfs] [PATCH nbdkit 2/5] error: Use new nbdkit_parse_probability

2023-05-16 Thread Richard W.M. Jones
This replaces the existing ad hoc parsing with the new public function. --- filters/error/nbdkit-error-filter.pod | 12 +++- filters/error/error.c | 14 +- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/filters/error/nbdkit-error-filter.pod

[Libguestfs] [PATCH nbdkit 5/5] New filter: evil

2023-05-16 Thread Richard W.M. Jones
This filter adds random data corruption when reading from the underlying plugin. --- filters/error/nbdkit-error-filter.pod | 4 + filters/evil/nbdkit-evil-filter.pod | 159 configure.ac | 2 + filters/evil/Makefile.am | 77 ++

[Libguestfs] [PATCH nbdkit 3/5] common/include: Add next_power_of_2 function

2023-05-16 Thread Richard W.M. Jones
It takes a 64 bit integer and finds the next power of 2, eg. next_power_of_2 (510) => 512 (2^9) Taken from https://jameshfisher.com/2018/03/30/round-up-power-2/ with some fixes. --- common/include/ispowerof2.h | 9 + common/include/test-ispowerof2.c | 14 ++ 2 files