[PATCH 1/2] tests: Fix test-launch-race.
by Richard W.M. Jones
This test has been broken for a while. It is meant to test that when
the appliance cachedir is empty, two simultaneous runs of libguestfs
(both rebuilding the full appliance) will not cause conflicts, because
(eg) the locking in either supermin or libguestfs is not working.
However the test only set $TMPDIR, but the ./run script sets
$LIBGUESTFS_CACHEDIR which overrides $TMPDIR, so it was simply reusing
the existing appliance, and hence not testing anything.
Fix this by clearing $LIBGUESTFS_CACHEDIR.
Note the test now takes a lot longer to run since it does a full
appliance rebuild.
---
tests/protocol/test-launch-race.pl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
index fadfdbf..6fef1a5 100755
--- a/tests/protocol/test-launch-race.pl
+++ b/tests/protocol/test-launch-race.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# Copyright (C) 2010 Red Hat Inc.
+# Copyright (C) 2010-2015 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -32,6 +32,9 @@ exit 77 if $ENV{SKIP_TEST_LAUNCH_RACE_PL};
my $tmpdir = tempdir (CLEANUP => 1);
$ENV{TMPDIR} = $tmpdir;
+# Unset LIBGUESTFS_CACHEDIR (set by ./run) since that will override TMPDIR.
+delete $ENV{LIBGUESTFS_CACHEDIR};
+
my $pid = fork();
die ("fork failed: $!") if ($pid < 0);
--
2.5.0
9 years, 1 month
[PATCH] builder: Remove duplicate planner transition.
by Richard W.M. Jones
Seems to be a copy and paste bug in
commit 62cc7d3361127b4e007f8e23028213852be09124.
---
builder/builder.ml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index af9c2f5..6850f8f 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -456,10 +456,9 @@ let main () =
* Don't run 'qemu-img resize' on an auto format. This is to
* force an explicit conversion step to a real format.
*)
- else if output_size > old_size && is_not `Template && List.mem_assoc `Format itags then (
+ else if output_size > old_size && is_not `Template
+ && List.mem_assoc `Format itags then
tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
- tr `Disk_resize 60 ((`Size, Int64.to_string output_size) :: itags);
- );
(* qemu-img convert is always possible, and quicker. It doesn't
* resize, but it does change the format.
--
2.5.0
9 years, 1 month
[PATCH 0/3] hivex: misc changes
by Pino Toscano
Hi,
Few changes in hivex, sent as series to be clearly identified as hivex
ones.
After these patches, what about a new release of it? The last one is
basically one year old, and the changes after 1.3.11 make hivex build
and work fine on FreeBSD (and maybe more non-Linux OSes).
Thanks,
Pino Toscano (3):
Fix shebang in perl scripts
Update gnulib to latest.
Update .gitignore with more gnulib files.
.gnulib | 2 +-
extra-tests/fuzz.pl | 3 ++-
extra-tests/insert-keys.pl | 3 ++-
m4/.gitignore | 2 ++
regedit/hivexregedit | 2 +-
5 files changed, 8 insertions(+), 4 deletions(-)
--
2.1.0
9 years, 1 month
[PATCH] Fix shebang in perl scripts
by Pino Toscano
Instead of hardcoding the location of perl (assuming it is installed in
/usr), use /usr/bin/env to run it, and thus picking it from $PATH.
This makes it possible to run these scripts also on installations with
perl in a different prefix than /usr.
Also, given that we want enable warnings on scripts, turn the -w
previously in shebang to explicit "use warnings;" in scripts which
didn't have it before.
---
contrib/windows-icons.pl | 3 ++-
examples/guestfs-performance.pod | 3 ++-
generator/bindtests.ml | 3 ++-
perl/examples/create_disk.pl | 3 ++-
perl/examples/inspect_vm.pl | 3 ++-
pick-guests.pl.in | 3 ++-
podwrapper.pl.in | 2 +-
rescue/test-virt-rescue.pl | 3 ++-
resize/test-virt-resize.pl | 2 +-
tests/bigdirs/test-big-dirs.pl | 2 +-
tests/btrfs/test-btrfs-misc.pl | 2 +-
tests/btrfs/test-btrfs-subvolume-default.pl | 2 +-
tests/daemon/test-btrfs.pl | 2 +-
tests/daemon/test-daemon-start.pl | 2 +-
tests/discard/test-blkdiscard.pl | 2 +-
tests/discard/test-discard.pl | 2 +-
tests/discard/test-fstrim.pl | 2 +-
tests/disk-labels/test-disk-labels.pl | 2 +-
tests/disks/test-max-disks.pl | 2 +-
tests/events/test-console-debug.pl | 2 +-
tests/fuzz/fuzz-inspection.pl | 2 +-
tests/guests/guest-aux/make-fedora-img.pl | 2 +-
tests/guests/guest-aux/make-guests-all-good.pl | 2 +-
tests/hotplug/test-hot-add.pl | 2 +-
tests/hotplug/test-hot-remove.pl | 2 +-
tests/hotplug/test-hotplug-repeated.pl | 2 +-
tests/journal/test-journal.pl | 2 +-
tests/lvm/test-lvm-mapping.pl | 2 +-
tests/nbd/test-nbd.pl | 2 +-
tests/protocol/test-launch-race.pl | 2 +-
tests/regressions/test-noexec-stack.pl | 2 +-
tests/selinux/run-test.pl | 2 +-
tests/syslinux/test-syslinux.pl | 2 +-
tests/tmpdirs/test-tmpdirs.pl | 2 +-
tests/xfs/test-xfs-misc.pl | 2 +-
tests/xml/rhbz701814.pl | 3 ++-
tools/virt-list-filesystems | 2 +-
tools/virt-list-partitions | 2 +-
tools/virt-tar | 2 +-
tools/virt-win-reg | 2 +-
40 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/contrib/windows-icons.pl b/contrib/windows-icons.pl
index cb2de03..fc93af0 100755
--- a/contrib/windows-icons.pl
+++ b/contrib/windows-icons.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2012 Red Hat Inc.
#
@@ -24,6 +24,7 @@
# ./run ./contrib/windows-icons.pl /path/to/windows-disk.img
use strict;
+use warnings;
use Sys::Guestfs;
use File::Temp qw{tempdir};
diff --git a/examples/guestfs-performance.pod b/examples/guestfs-performance.pod
index 7cf10aa..caa7535 100644
--- a/examples/guestfs-performance.pod
+++ b/examples/guestfs-performance.pod
@@ -322,10 +322,11 @@ L<http://rwmj.wordpress.com/2013/02/25/multiple-libguestfs-appliances-in-pa...
L<http://rwmj.wordpress.com/2013/02/25/multiple-libguestfs-appliances-in-pa...>
L<http://rwmj.wordpress.com/2013/02/25/multiple-libguestfs-appliances-in-pa...>
- #!/usr/bin/perl -w
+ #!/usr/bin/env perl
use strict;
use threads;
+ use warnings;
use Sys::Guestfs;
use Time::HiRes qw(time);
diff --git a/generator/bindtests.ml b/generator/bindtests.ml
index 5358ff1..0959704 100644
--- a/generator/bindtests.ml
+++ b/generator/bindtests.ml
@@ -370,11 +370,12 @@ let () =
pr "print_endline \"EOF\"\n"
and generate_perl_bindtests () =
- pr "#!/usr/bin/perl -w\n";
+ pr "#!/usr/bin/env perl\n";
generate_header HashStyle GPLv2plus;
pr "\
use strict;
+use warnings;
use Sys::Guestfs;
diff --git a/perl/examples/create_disk.pl b/perl/examples/create_disk.pl
index 0b9fa8d..3b40683 100755
--- a/perl/examples/create_disk.pl
+++ b/perl/examples/create_disk.pl
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Example showing how to create a disk image.
use strict;
+use warnings;
use Sys::Guestfs;
my $output = "disk.img";
diff --git a/perl/examples/inspect_vm.pl b/perl/examples/inspect_vm.pl
index 6d95b69..04fbae6 100755
--- a/perl/examples/inspect_vm.pl
+++ b/perl/examples/inspect_vm.pl
@@ -1,8 +1,9 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Example showing how to inspect a virtual machine disk.
use strict;
+use warnings;
use Sys::Guestfs;
if (@ARGV < 1) {
diff --git a/pick-guests.pl.in b/pick-guests.pl.in
index bfc97d8..1ccc04b 100755
--- a/pick-guests.pl.in
+++ b/pick-guests.pl.in
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# @configure_input@
# Copyright (C) 2009-2015 Red Hat Inc.
#
@@ -20,6 +20,7 @@
# This is used by 'make check-valgrind-local-guests'.
use strict;
+use warnings;
use Sys::Guestfs;
use Sys::Virt;
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index b354db6..3810f72 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# podwrapper.pl
# Copyright (C) 2010-2015 Red Hat Inc.
# @configure_input@
diff --git a/rescue/test-virt-rescue.pl b/rescue/test-virt-rescue.pl
index 9547fd6..2253882 100755
--- a/rescue/test-virt-rescue.pl
+++ b/rescue/test-virt-rescue.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2012-2015 Red Hat Inc.
#
@@ -17,6 +17,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
+use warnings;
my $progname = $0;
$progname =~ s{.*/}{};
diff --git a/resize/test-virt-resize.pl b/resize/test-virt-resize.pl
index be9c9b4..1923398 100755
--- a/resize/test-virt-resize.pl
+++ b/resize/test-virt-resize.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2010-2015 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/bigdirs/test-big-dirs.pl b/tests/bigdirs/test-big-dirs.pl
index 47f0760..40038b7 100755
--- a/tests/bigdirs/test-big-dirs.pl
+++ b/tests/bigdirs/test-big-dirs.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/btrfs/test-btrfs-misc.pl b/tests/btrfs/test-btrfs-misc.pl
index 0a8e942..cfa9cbb 100755
--- a/tests/btrfs/test-btrfs-misc.pl
+++ b/tests/btrfs/test-btrfs-misc.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
#
diff --git a/tests/btrfs/test-btrfs-subvolume-default.pl b/tests/btrfs/test-btrfs-subvolume-default.pl
index fd20fa2..c3d62d3 100755
--- a/tests/btrfs/test-btrfs-subvolume-default.pl
+++ b/tests/btrfs/test-btrfs-subvolume-default.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2012 Red Hat Inc.
#
diff --git a/tests/daemon/test-btrfs.pl b/tests/daemon/test-btrfs.pl
index 7a0c345..302ecb9 100755
--- a/tests/daemon/test-btrfs.pl
+++ b/tests/daemon/test-btrfs.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2015 Red Hat Inc.
#
diff --git a/tests/daemon/test-daemon-start.pl b/tests/daemon/test-daemon-start.pl
index 91e008a..8cc59d9 100755
--- a/tests/daemon/test-daemon-start.pl
+++ b/tests/daemon/test-daemon-start.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2015 Red Hat Inc.
#
diff --git a/tests/discard/test-blkdiscard.pl b/tests/discard/test-blkdiscard.pl
index e080350..9f136ec 100755
--- a/tests/discard/test-blkdiscard.pl
+++ b/tests/discard/test-blkdiscard.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2014 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/discard/test-discard.pl b/tests/discard/test-discard.pl
index dbcf6a5..0253a9d 100755
--- a/tests/discard/test-discard.pl
+++ b/tests/discard/test-discard.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2014 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/discard/test-fstrim.pl b/tests/discard/test-fstrim.pl
index cbd28bf..88feb06 100755
--- a/tests/discard/test-fstrim.pl
+++ b/tests/discard/test-fstrim.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2014 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/disk-labels/test-disk-labels.pl b/tests/disk-labels/test-disk-labels.pl
index a74e300..17db5e1 100755
--- a/tests/disk-labels/test-disk-labels.pl
+++ b/tests/disk-labels/test-disk-labels.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/disks/test-max-disks.pl b/tests/disks/test-max-disks.pl
index 9561b6b..11d4651 100755
--- a/tests/disks/test-max-disks.pl
+++ b/tests/disks/test-max-disks.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/events/test-console-debug.pl b/tests/events/test-console-debug.pl
index eb6a774..777a059 100755
--- a/tests/events/test-console-debug.pl
+++ b/tests/events/test-console-debug.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2013 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/fuzz/fuzz-inspection.pl b/tests/fuzz/fuzz-inspection.pl
index 9fcd98e..805558d 100755
--- a/tests/fuzz/fuzz-inspection.pl
+++ b/tests/fuzz/fuzz-inspection.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Fuzz-test libguestfs inspection.
# Copyright (C) 2013 Red Hat Inc.
#
diff --git a/tests/guests/guest-aux/make-fedora-img.pl b/tests/guests/guest-aux/make-fedora-img.pl
index eae11d6..bd98605 100755
--- a/tests/guests/guest-aux/make-fedora-img.pl
+++ b/tests/guests/guest-aux/make-fedora-img.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2010-2015 Red Hat Inc.
#
diff --git a/tests/guests/guest-aux/make-guests-all-good.pl b/tests/guests/guest-aux/make-guests-all-good.pl
index aafcc8e..ab6451a 100755
--- a/tests/guests/guest-aux/make-guests-all-good.pl
+++ b/tests/guests/guest-aux/make-guests-all-good.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
#
diff --git a/tests/hotplug/test-hot-add.pl b/tests/hotplug/test-hot-add.pl
index 034cff4..18ff7c4 100755
--- a/tests/hotplug/test-hot-add.pl
+++ b/tests/hotplug/test-hot-add.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/hotplug/test-hot-remove.pl b/tests/hotplug/test-hot-remove.pl
index 087399d..3e7cf72 100755
--- a/tests/hotplug/test-hot-remove.pl
+++ b/tests/hotplug/test-hot-remove.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/hotplug/test-hotplug-repeated.pl b/tests/hotplug/test-hotplug-repeated.pl
index 306bceb..142f445 100755
--- a/tests/hotplug/test-hotplug-repeated.pl
+++ b/tests/hotplug/test-hotplug-repeated.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/journal/test-journal.pl b/tests/journal/test-journal.pl
index 38950f9..6d8675b 100755
--- a/tests/journal/test-journal.pl
+++ b/tests/journal/test-journal.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
#
diff --git a/tests/lvm/test-lvm-mapping.pl b/tests/lvm/test-lvm-mapping.pl
index 8353333..748d0e2 100755
--- a/tests/lvm/test-lvm-mapping.pl
+++ b/tests/lvm/test-lvm-mapping.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2010 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/nbd/test-nbd.pl b/tests/nbd/test-nbd.pl
index 6353b25..0ad299c 100755
--- a/tests/nbd/test-nbd.pl
+++ b/tests/nbd/test-nbd.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2013 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
index f933bfe..fadfdbf 100755
--- a/tests/protocol/test-launch-race.pl
+++ b/tests/protocol/test-launch-race.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2010 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/regressions/test-noexec-stack.pl b/tests/regressions/test-noexec-stack.pl
index 68bbb0b..a2741b9 100755
--- a/tests/regressions/test-noexec-stack.pl
+++ b/tests/regressions/test-noexec-stack.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/selinux/run-test.pl b/tests/selinux/run-test.pl
index 89846ae..f0f241f 100755
--- a/tests/selinux/run-test.pl
+++ b/tests/selinux/run-test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/syslinux/test-syslinux.pl b/tests/syslinux/test-syslinux.pl
index cea0e54..54d23c1 100755
--- a/tests/syslinux/test-syslinux.pl
+++ b/tests/syslinux/test-syslinux.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2013 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/tmpdirs/test-tmpdirs.pl b/tests/tmpdirs/test-tmpdirs.pl
index a9acd8e..90aa31e 100755
--- a/tests/tmpdirs/test-tmpdirs.pl
+++ b/tests/tmpdirs/test-tmpdirs.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
diff --git a/tests/xfs/test-xfs-misc.pl b/tests/xfs/test-xfs-misc.pl
index 1d09474..f60d6f7 100755
--- a/tests/xfs/test-xfs-misc.pl
+++ b/tests/xfs/test-xfs-misc.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# libguestfs
# Copyright (C) 2013 Red Hat Inc.
#
diff --git a/tests/xml/rhbz701814.pl b/tests/xml/rhbz701814.pl
index 01fa128..aad898f 100755
--- a/tests/xml/rhbz701814.pl
+++ b/tests/xml/rhbz701814.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# Copyright (C) 2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
# https://bugzilla.redhat.com/show_bug.cgi?id=701814
use strict;
+use warnings;
use Sys::Guestfs;
diff --git a/tools/virt-list-filesystems b/tools/virt-list-filesystems
index 62e862b..a4d92ff 100755
--- a/tools/virt-list-filesystems
+++ b/tools/virt-list-filesystems
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# virt-list-filesystems
# Copyright (C) 2009-2015 Red Hat Inc.
#
diff --git a/tools/virt-list-partitions b/tools/virt-list-partitions
index 5579840..b9cbfdd 100755
--- a/tools/virt-list-partitions
+++ b/tools/virt-list-partitions
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# virt-list-partitions
# Copyright (C) 2010 Red Hat Inc.
#
diff --git a/tools/virt-tar b/tools/virt-tar
index a4d88a4..7ac9d95 100755
--- a/tools/virt-tar
+++ b/tools/virt-tar
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# virt-tar
# Copyright (C) 2009-2015 Red Hat Inc.
#
diff --git a/tools/virt-win-reg b/tools/virt-win-reg
index f4277e8..57188c8 100755
--- a/tools/virt-win-reg
+++ b/tools/virt-win-reg
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl
# virt-win-reg
# Copyright (C) 2010 Red Hat Inc.
#
--
2.1.0
9 years, 1 month
[PATCH] daemon: use str_udevadm in udev_settle
by Pino Toscano
There is GUESTFSD_EXT_CMD defining a string for udevadm (so it is marked
as "used tool" in the appliance), but it is not actually used when
starting udevadm.
There should be no behaviour change.
---
daemon/guestfsd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index 7b33a3a..4502190 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -1501,7 +1501,8 @@ udev_settle (void)
char cmd[80];
int r;
- snprintf (cmd, sizeof cmd, "udevadm%s settle", verbose ? " --debug" : "");
+ snprintf (cmd, sizeof cmd, "%s%s settle",
+ str_udevadm, verbose ? " --debug" : "");
if (verbose)
printf ("%s\n", cmd);
r = system (cmd);
--
2.1.0
9 years, 1 month
[PATCH] lib: include <sys/socket.h> for accept4
by Pino Toscano
Apparently implicitly pulled by something else on Linux, it is not when
building on e.g. FreeBSD.
This reverts the change to this file of
commit 3b17152ec399acb35b23331d2c3b4f424a68824a.
---
src/conn-socket.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/conn-socket.c b/src/conn-socket.c
index a935cc4..05177ca 100644
--- a/src/conn-socket.c
+++ b/src/conn-socket.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <poll.h>
#include <sys/stat.h>
+#include <sys/socket.h> /* accept4 */
#include <sys/types.h>
#include <assert.h>
#include <libintl.h>
--
2.1.0
9 years, 1 month
[PATCH] p2v: fix mode for gtk_label_set_line_wrap_mode
by Pino Toscano
Accoding to its documentation [1], it takes as second parameter a
PangoWrapMode and not a GtkWrapMode. While the change should reflect
the actual value intended, it should slightly change the label wrap
mode: GTK_WRAP_WORD is 2, which corresponds (as int value) to
PANGO_WRAP_WORD_CHAR.
[1] https://developer.gnome.org/gtk2/stable/GtkLabel.html#gtk-label-set-line-...
---
p2v/gui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/p2v/gui.c b/p2v/gui.c
index fa8a7b0..8c6dc31 100644
--- a/p2v/gui.c
+++ b/p2v/gui.c
@@ -525,7 +525,7 @@ create_conversion_dialog (struct config *config)
target_warning_label = gtk_label_new ("");
gtk_label_set_line_wrap (GTK_LABEL (target_warning_label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL (target_warning_label),
- GTK_WRAP_WORD);
+ PANGO_WRAP_WORD);
gtk_widget_set_size_request (target_warning_label, -1, 7 * 16);
gtk_box_pack_end (GTK_BOX (target_vbox), target_warning_label, TRUE, TRUE, 0);
--
2.1.0
9 years, 1 month
[PATCH] Remove multiple hacks that only apply to RHEL 5.
by Richard W.M. Jones
We don't support RHEL 5 upstream (see the 'oldlinux' branch for a
version that works with RHEL 5). Therefore remove a bunch of hacks
that were only needed on RHEL 5.
---
appliance/packagelist.in | 2 -
common-rules.mk | 8 -
daemon/parted.c | 455 +++++++++++-----------------------------
daemon/swap.c | 18 +-
generator/actions.ml | 4 +-
generator/ruby.ml | 14 --
run.in | 13 +-
src/inspect-apps.c | 13 --
tests/regressions/rhbz975797.sh | 5 +-
tests/xml/fake-libvirt-xml.c | 9 -
10 files changed, 129 insertions(+), 412 deletions(-)
diff --git a/appliance/packagelist.in b/appliance/packagelist.in
index fee6fa0..aa5e07e 100644
--- a/appliance/packagelist.in
+++ b/appliance/packagelist.in
@@ -28,8 +28,6 @@ ifelse(REDHAT,1,
cryptsetup
cryptsetup-luks dnl old name used before Fedora 17
dhclient
- dnl e4fsprogs only exists on RHEL 5, will be ignored everywhere else.
- e4fsprogs
genisoimage
gfs-utils
gfs2-utils
diff --git a/common-rules.mk b/common-rules.mk
index 312107e..e6b40d1 100644
--- a/common-rules.mk
+++ b/common-rules.mk
@@ -19,11 +19,3 @@
# cf. 'subdir-rules.mk'
-include $(top_builddir)/localenv
-
-# Old RHEL 5 autoconf defines these, but RHEL 5 automake doesn't
-# create variables for them. So define them here if they're not
-# defined already.
-builddir ?= @builddir@
-abs_builddir ?= @abs_builddir@
-srcdir ?= @srcdir@
-abs_srcdir ?= @abs_srcdir@
diff --git a/daemon/parted.c b/daemon/parted.c
index fab3423..df6b7e7 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
@@ -33,13 +34,6 @@ GUESTFSD_EXT_CMD(str_parted, parted);
GUESTFSD_EXT_CMD(str_sfdisk, sfdisk);
GUESTFSD_EXT_CMD(str_sgdisk, sgdisk);
-enum parted_has_m_opt {
- PARTED_INVALID = -1,
- /* parted do not support -m option */
- PARTED_OPT_NO_M = 0,
- PARTED_OPT_HAS_M = 1,
-};
-
/* Notes:
*
* Parted 1.9 sends error messages to stdout, hence use of the
@@ -319,43 +313,14 @@ get_table_field (const char *line, int n)
return q;
}
-/* RHEL 5 parted doesn't have the -m (machine readable) option so we
- * must do a lot more work to parse the output in
- * print_partition_table below. Test for this option the first time
- * this function is called.
- */
-static enum parted_has_m_opt
-test_parted_m_opt (void)
-{
- static enum parted_has_m_opt result = PARTED_INVALID;
-
- if (result >= 0)
- return result;
-
- CLEANUP_FREE char *err = NULL;
- int r = commandr (NULL, &err, str_parted, "-s", "-m", "/dev/null", NULL);
- if (r == -1) {
- /* Test failed, eg. missing or completely unusable parted binary. */
- reply_with_error ("could not run 'parted' command");
- return -1;
- }
-
- if (err && strstr (err, "invalid option -- m"))
- result = PARTED_OPT_NO_M;
- else
- result = PARTED_OPT_HAS_M;
- return result;
-}
-
static char *
-print_partition_table (const char *device,
- enum parted_has_m_opt parted_has_m_opt)
+print_partition_table (const char *device, bool add_m_option)
{
char *out;
CLEANUP_FREE char *err = NULL;
int r;
- if (PARTED_OPT_HAS_M == parted_has_m_opt)
+ if (add_m_option)
r = command (&out, &err, str_parted, "-m", "-s", "--", device,
"unit", "b",
"print", NULL);
@@ -364,15 +329,13 @@ print_partition_table (const char *device,
"unit", "b",
"print", NULL);
if (r == -1) {
- /* Hack for parted 1.x which sends errors to stdout. */
- const char *msg = *err ? err : out;
int errcode = 0;
/* Translate "unrecognised disk label" into an errno code. */
- if (msg && strstr (msg, "unrecognised disk label") != NULL)
+ if (err && strstr (err, "unrecognised disk label") != NULL)
errcode = EINVAL;
- reply_with_error_errno (errcode, "parted print: %s: %s", device, msg);
+ reply_with_error_errno (errcode, "parted print: %s: %s", device, err);
free (out);
return NULL;
}
@@ -383,93 +346,46 @@ print_partition_table (const char *device,
char *
do_part_get_parttype (const char *device)
{
- enum parted_has_m_opt parted_has_m_opt = test_parted_m_opt ();
- if (parted_has_m_opt == PARTED_INVALID)
- return NULL;
-
- CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
+ CLEANUP_FREE char *out = print_partition_table (device, true);
if (!out)
return NULL;
- if (PARTED_OPT_HAS_M == parted_has_m_opt) {
- /* New-style parsing using the "machine-readable" format from
- * 'parted -m'.
- */
- CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
-
- if (!lines)
- return NULL;
-
- if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
- reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
- lines[0] ? lines[0] : "(signature was null)");
- return NULL;
- }
-
- if (lines[1] == NULL) {
- reply_with_error ("parted didn't return a line describing the device");
- return NULL;
- }
-
- /* lines[1] is something like:
- * "/dev/sda:1953525168s:scsi:512:512:msdos:ATA Hitachi HDT72101;"
- */
- char *r = get_table_field (lines[1], 5);
- if (r == NULL) {
- return NULL;
- }
-
- /* If "loop" return an error (RHBZ#634246). */
- if (STREQ (r, "loop")) {
- free (r);
- reply_with_error ("not a partitioned device");
- return NULL;
- }
-
- return r;
+ CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
+ if (!lines)
+ return NULL;
+
+ if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
+ reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
+ lines[0] ? lines[0] : "(signature was null)");
+ return NULL;
}
- else {
- /* Old-style. Look for "\nPartition Table: <str>\n". */
- char *p = strstr (out, "\nPartition Table: ");
- if (!p) {
- reply_with_error ("parted didn't return Partition Table line");
- return NULL;
- }
- p += 18;
- char *q = strchr (p, '\n');
- if (!q) {
- reply_with_error ("parted Partition Table has no end of line char");
- return NULL;
- }
-
- *q = '\0';
-
- p = strdup (p);
- if (!p) {
- reply_with_perror ("strdup");
- return NULL;
- }
-
- /* If "loop" return an error (RHBZ#634246). */
- if (STREQ (p, "loop")) {
- free (p);
- reply_with_error ("not a partitioned device");
- return NULL;
- }
+ if (lines[1] == NULL) {
+ reply_with_error ("parted didn't return a line describing the device");
+ return NULL;
+ }
- return p; /* caller frees */
+ /* lines[1] is something like:
+ * "/dev/sda:1953525168s:scsi:512:512:msdos:ATA Hitachi HDT72101;"
+ */
+ char *r = get_table_field (lines[1], 5);
+ if (r == NULL)
+ return NULL;
+
+ /* If "loop" return an error (RHBZ#634246). */
+ if (STREQ (r, "loop")) {
+ free (r);
+ reply_with_error ("not a partitioned device");
+ return NULL;
}
+
+ return r;
}
guestfs_int_partition_list *
do_part_list (const char *device)
{
- enum parted_has_m_opt parted_has_m_opt = test_parted_m_opt ();
- if (parted_has_m_opt == PARTED_INVALID)
- return NULL;
-
- CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
+ CLEANUP_FREE char *out = print_partition_table (device, true);
if (!out)
return NULL;
@@ -480,97 +396,36 @@ do_part_list (const char *device)
guestfs_int_partition_list *r;
- if (PARTED_OPT_HAS_M == parted_has_m_opt) {
- /* New-style parsing using the "machine-readable" format from
- * 'parted -m'.
- *
- * lines[0] is "BYT;", lines[1] is the device line which we ignore,
- * lines[2..] are the partitions themselves. Count how many.
- */
- size_t nr_rows = 0, row;
- for (row = 2; lines[row] != NULL; ++row)
- ++nr_rows;
-
- r = malloc (sizeof *r);
- if (r == NULL) {
- reply_with_perror ("malloc");
- return NULL;
- }
- r->guestfs_int_partition_list_len = nr_rows;
- r->guestfs_int_partition_list_val =
- malloc (nr_rows * sizeof (guestfs_int_partition));
- if (r->guestfs_int_partition_list_val == NULL) {
- reply_with_perror ("malloc");
- goto error2;
- }
-
- /* Now parse the lines. */
- size_t i;
- for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) {
- if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B",
- &r->guestfs_int_partition_list_val[i].part_num,
- &r->guestfs_int_partition_list_val[i].part_start,
- &r->guestfs_int_partition_list_val[i].part_end,
- &r->guestfs_int_partition_list_val[i].part_size) != 4) {
- reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
- goto error3;
- }
- }
+ /* lines[0] is "BYT;", lines[1] is the device line which we ignore,
+ * lines[2..] are the partitions themselves. Count how many.
+ */
+ size_t nr_rows = 0, row;
+ for (row = 2; lines[row] != NULL; ++row)
+ ++nr_rows;
+
+ r = malloc (sizeof *r);
+ if (r == NULL) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+ r->guestfs_int_partition_list_len = nr_rows;
+ r->guestfs_int_partition_list_val =
+ malloc (nr_rows * sizeof (guestfs_int_partition));
+ if (r->guestfs_int_partition_list_val == NULL) {
+ reply_with_perror ("malloc");
+ goto error2;
}
- else {
- /* Old-style. Start at the line following "^Number", up to the
- * next blank line.
- */
- size_t start = 0, end = 0, row;
-
- for (row = 0; lines[row] != NULL; ++row)
- if (STRPREFIX (lines[row], "Number")) {
- start = row+1;
- break;
- }
-
- if (start == 0) {
- reply_with_error ("parted output has no \"Number\" line");
- return NULL;
- }
-
- for (row = start; lines[row] != NULL; ++row)
- if (STREQ (lines[row], "")) {
- end = row;
- break;
- }
-
- if (end == 0) {
- reply_with_error ("parted output has no blank after end of table");
- return NULL;
- }
-
- size_t nr_rows = end - start;
-
- r = malloc (sizeof *r);
- if (r == NULL) {
- reply_with_perror ("malloc");
- return NULL;
- }
- r->guestfs_int_partition_list_len = nr_rows;
- r->guestfs_int_partition_list_val =
- malloc (nr_rows * sizeof (guestfs_int_partition));
- if (r->guestfs_int_partition_list_val == NULL) {
- reply_with_perror ("malloc");
- goto error2;
- }
- /* Now parse the lines. */
- size_t i;
- for (i = 0, row = start; row < end; ++i, ++row) {
- if (sscanf (lines[row], " %d %" SCNi64 "B %" SCNi64 "B %" SCNi64 "B",
- &r->guestfs_int_partition_list_val[i].part_num,
- &r->guestfs_int_partition_list_val[i].part_start,
- &r->guestfs_int_partition_list_val[i].part_end,
- &r->guestfs_int_partition_list_val[i].part_size) != 4) {
- reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
- goto error3;
- }
+ /* Now parse the lines. */
+ size_t i;
+ for (i = 0, row = 2; lines[row] != NULL; ++i, ++row) {
+ if (sscanf (lines[row], "%d:%" SCNi64 "B:%" SCNi64 "B:%" SCNi64 "B",
+ &r->guestfs_int_partition_list_val[i].part_num,
+ &r->guestfs_int_partition_list_val[i].part_start,
+ &r->guestfs_int_partition_list_val[i].part_end,
+ &r->guestfs_int_partition_list_val[i].part_size) != 4) {
+ reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
+ goto error3;
}
}
@@ -591,11 +446,7 @@ do_part_get_bootable (const char *device, int partnum)
return -1;
}
- enum parted_has_m_opt parted_has_m_opt = test_parted_m_opt ();
- if (parted_has_m_opt == PARTED_INVALID)
- return -1;
-
- CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
+ CLEANUP_FREE char *out = print_partition_table (device, true);
if (!out)
return -1;
@@ -604,95 +455,41 @@ do_part_get_bootable (const char *device, int partnum)
if (!lines)
return -1;
- if (PARTED_OPT_HAS_M == parted_has_m_opt) {
- /* New-style parsing using the "machine-readable" format from
- * 'parted -m'.
- *
- * Partitions may not be in any order, so we have to look for
- * the matching partition number (RHBZ#602997).
- */
- if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
- reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
- lines[0] ? lines[0] : "(signature was null)");
- return -1;
- }
-
- if (lines[1] == NULL) {
- reply_with_error ("parted didn't return a line describing the device");
- return -1;
- }
-
- size_t row;
- int pnum;
- for (row = 2; lines[row] != NULL; ++row) {
- if (sscanf (lines[row], "%d:", &pnum) != 1) {
- reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
- return -1;
- }
- if (pnum == partnum)
- break;
- }
-
- if (lines[row] == NULL) {
- reply_with_error ("partition number %d not found", partnum);
- return -1;
- }
-
- CLEANUP_FREE char *boot = get_table_field (lines[row], 6);
- if (boot == NULL)
- return -1;
-
- return strstr (boot, "boot") != NULL;
+ /* Partitions may not be in any order, so we have to look for
+ * the matching partition number (RHBZ#602997).
+ */
+ if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
+ reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
+ lines[0] ? lines[0] : "(signature was null)");
+ return -1;
}
- else {
- /* Old-style: First look for the line matching "^Number". */
- size_t start = 0, header, row;
-
- for (row = 0; lines[row] != NULL; ++row)
- if (STRPREFIX (lines[row], "Number")) {
- start = row+1;
- header = row;
- break;
- }
- if (start == 0) {
- reply_with_error ("parted output has no \"Number\" line");
- return -1;
- }
+ if (lines[1] == NULL) {
+ reply_with_error ("parted didn't return a line describing the device");
+ return -1;
+ }
- /* Now we have to look at the column number of the "Flags" field.
- * This is because parted's output has no way to represent a
- * missing field except as whitespace, so we cannot just count
- * fields from the left. eg. The "File system" field is often
- * missing in the output.
- */
- char *p = strstr (lines[header], "Flags");
- if (!p) {
- reply_with_error ("parted output has no \"Flags\" field");
+ size_t row;
+ int pnum;
+ for (row = 2; lines[row] != NULL; ++row) {
+ if (sscanf (lines[row], "%d:", &pnum) != 1) {
+ reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
return -1;
}
- size_t col = p - lines[header];
+ if (pnum == partnum)
+ break;
+ }
- /* Partitions may not be in any order, so we have to look for
- * the matching partition number (RHBZ#602997).
- */
- int pnum;
- for (row = start; lines[row] != NULL; ++row) {
- if (sscanf (lines[row], " %d", &pnum) != 1) {
- reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
- return -1;
- }
- if (pnum == partnum)
- break;
- }
+ if (lines[row] == NULL) {
+ reply_with_error ("partition number %d not found", partnum);
+ return -1;
+ }
- if (lines[row] == NULL) {
- reply_with_error ("partition number %d not found", partnum);
- return -1;
- }
+ CLEANUP_FREE char *boot = get_table_field (lines[row], 6);
+ if (boot == NULL)
+ return -1;
- return STRPREFIX (&lines[row][col], "boot");
- }
+ return strstr (boot, "boot") != NULL;
}
/* Test if sfdisk is recent enough to have --part-type, to be used instead
@@ -979,63 +776,51 @@ do_part_get_name (const char *device, int partnum)
return NULL;
if (STREQ (parttype, "gpt")) {
- enum parted_has_m_opt parted_has_m_opt = test_parted_m_opt ();
- if (parted_has_m_opt == PARTED_INVALID)
- return NULL;
-
- CLEANUP_FREE char *out = print_partition_table (device, parted_has_m_opt);
+ CLEANUP_FREE char *out = print_partition_table (device, true);
if (!out)
return NULL;
- if (PARTED_OPT_HAS_M == parted_has_m_opt) {
- /* New-style parsing using the "machine-readable" format from
- * 'parted -m'.
- */
- CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
+ CLEANUP_FREE_STRING_LIST char **lines = split_lines (out);
- if (!lines)
- return NULL;
-
- if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
- reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
- lines[0] ? lines[0] : "(signature was null)");
- return NULL;
- }
+ if (!lines)
+ return NULL;
- if (lines[1] == NULL) {
- reply_with_error ("parted didn't return a line describing the device");
- return NULL;
- }
+ if (lines[0] == NULL || STRNEQ (lines[0], "BYT;")) {
+ reply_with_error ("unknown signature, expected \"BYT;\" as first line of the output: %s",
+ lines[0] ? lines[0] : "(signature was null)");
+ return NULL;
+ }
- size_t row;
- int pnum;
- for (row = 2; lines[row] != NULL; ++row) {
- if (sscanf (lines[row], "%d:", &pnum) != 1) {
- reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
- return NULL;
- }
- if (pnum == partnum)
- break;
- }
+ if (lines[1] == NULL) {
+ reply_with_error ("parted didn't return a line describing the device");
+ return NULL;
+ }
- if (lines[row] == NULL) {
- reply_with_error ("partition number %d not found", partnum);
+ size_t row;
+ int pnum;
+ for (row = 2; lines[row] != NULL; ++row) {
+ if (sscanf (lines[row], "%d:", &pnum) != 1) {
+ reply_with_error ("could not parse row from output of parted print command: %s", lines[row]);
return NULL;
}
+ if (pnum == partnum)
+ break;
+ }
- char *name = get_table_field (lines[row], 5);
- if (name == NULL)
- reply_with_error ("cannot get the name field from '%s'", lines[row]);
-
- return name;
+ if (lines[row] == NULL) {
+ reply_with_error ("partition number %d not found", partnum);
+ return NULL;
}
+
+ char *name = get_table_field (lines[row], 5);
+ if (name == NULL)
+ reply_with_error ("cannot get the name field from '%s'", lines[row]);
+
+ return name;
} else {
reply_with_error ("part-get-name can only be used on GUID Partition Tables");
return NULL;
}
-
- reply_with_error ("cannot get the partition name from '%s' layouts", parttype);
- return NULL;
}
char *
@@ -1052,7 +837,7 @@ do_part_get_mbr_part_type (const char *device, int partnum)
* partition type info.
* Use traditional style.
*/
- CLEANUP_FREE char *out = print_partition_table (device, PARTED_OPT_NO_M);
+ CLEANUP_FREE char *out = print_partition_table (device, false);
if (!out)
return NULL;
diff --git a/daemon/swap.c b/daemon/swap.c
index 26fe30d..9d7839e 100644
--- a/daemon/swap.c
+++ b/daemon/swap.c
@@ -38,26 +38,10 @@ GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
/* Confirmed this is true for Linux swap partitions from the Linux sources. */
#define SWAP_LABEL_MAX 16
-/* Convenient place to test for the later version of e2fsprogs
- * and util-linux which supports -U parameters to specify UUIDs.
- * (Not supported in RHEL 5).
- */
int
optgroup_linuxfsuuid_available (void)
{
- CLEANUP_FREE char *err = NULL;
- int av;
-
- /* Upstream util-linux have been gradually changing '--help' to go
- * from stderr to stdout, and changing the return code from 1 to 0.
- * Thus we need to fold stdout and stderr together, and ignore the
- * return code.
- */
- ignore_value (commandf (NULL, &err, COMMAND_FLAG_FOLD_STDOUT_ON_STDERR,
- str_mkswap, "--help", NULL));
-
- av = strstr (err, "-U") != NULL;
- return av;
+ return 1;
}
/* Takes optional arguments, consult optargs_bitmask. */
diff --git a/generator/actions.ml b/generator/actions.ml
index 12d5e5a..2f29f7a 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -6169,11 +6169,11 @@ the command C<mount -o loop file mountpoint>." };
InitEmpty, Always, TestRun (
[["part_disk"; "/dev/sda"; "mbr"];
["mkswap"; "/dev/sda1"; "hello"; "NOARG"]]), [];
- InitEmpty, IfAvailable "linuxfsuuid", TestResultString (
+ InitEmpty, Always, TestResultString (
[["part_disk"; "/dev/sda"; "mbr"];
["mkswap"; "/dev/sda1"; "NOARG"; uuid];
["vfs_uuid"; "/dev/sda1"]], uuid), [];
- InitEmpty, IfAvailable "linuxfsuuid", TestResultString (
+ InitEmpty, Always, TestResultString (
[["part_disk"; "/dev/sda"; "mbr"];
["mkswap"; "/dev/sda1"; "hello"; uuid];
["vfs_label"; "/dev/sda1"]], "hello"), []
diff --git a/generator/ruby.ml b/generator/ruby.ml
index 87bb34a..cb187b0 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -84,20 +84,6 @@ let rec generate_ruby_c () =
#define RSTRING_PTR(r) (RSTRING((r))->ptr)
#endif
-/* For RHEL 5 (Ruby 1.8.5) */
-#ifndef HAVE_RB_HASH_LOOKUP
-VALUE
-rb_hash_lookup (VALUE hash, VALUE key)
-{
- volatile VALUE val;
-
- if (!st_lookup (RHASH(hash)->tbl, key, &val))
- return Qnil;
-
- return val;
-}
-#endif /* !HAVE_RB_HASH_LOOKUP */
-
static VALUE m_guestfs; /* guestfs module */
static VALUE c_guestfs; /* guestfs_h handle */
static VALUE e_Error; /* used for all errors */
diff --git a/run.in b/run.in
index 42f8cc8..46dbaf0 100755
--- a/run.in
+++ b/run.in
@@ -238,14 +238,11 @@ fi
timeout_period=4h
timeout_kill=30s
-# Do we have Padraig's timeout utility (from coreutils)?
-if timeout --help >/dev/null 2>&1; then
- # Must use the --foreground option (RHBZ#1025269).
- if timeout --foreground 2 sleep 0 >/dev/null 2>&1; then
- # Does this version of timeout have the -k option? (Not on RHEL 6)
- if timeout -k 10s 10s true >/dev/null 2>&1; then
- timeout="timeout --foreground -k $timeout_kill $timeout_period"
- fi
+# Must use the --foreground option (RHBZ#1025269).
+if timeout --foreground 2 sleep 0 >/dev/null 2>&1; then
+ # Does this version of timeout have the -k option? (Not on RHEL 6)
+ if timeout -k 10s 10s true >/dev/null 2>&1; then
+ timeout="timeout --foreground -k $timeout_kill $timeout_period"
fi
fi
diff --git a/src/inspect-apps.c b/src/inspect-apps.c
index a7da1dc..b54cf07 100644
--- a/src/inspect-apps.c
+++ b/src/inspect-apps.c
@@ -30,12 +30,6 @@
#include <sys/endian.h>
#endif
-/* be32toh is usually a macro defined in <endian.h>, but it might be
- * a function in some system so check both, and if neither is defined
- * then define be32toh for RHEL 5.
- */
-#if !defined(HAVE_BE32TOH) && !defined(be32toh)
-
#if defined __APPLE__ && defined __MACH__
/* Define/include necessary items on MacOS X */
#include <machine/endian.h>
@@ -46,13 +40,6 @@
#define __bswap_32 OSSwapConstInt32
#endif /* __APPLE__ */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define be32toh(x) __bswap_32 (x)
-#else
-#define be32toh(x) (x)
-#endif
-#endif
-
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
diff --git a/tests/regressions/rhbz975797.sh b/tests/regressions/rhbz975797.sh
index 938c1c5..3c536a9 100755
--- a/tests/regressions/rhbz975797.sh
+++ b/tests/regressions/rhbz975797.sh
@@ -51,10 +51,7 @@ fi
rm -f rhbz975797-*.img
-# The timeout utility was not available in RHEL 5.
-if timeout --help >/dev/null 2>&1; then
- timeout="timeout 600"
-fi
+timeout="timeout 600"
# Use real disk images here since the code for adding /dev/null may
# take shortcuts.
diff --git a/tests/xml/fake-libvirt-xml.c b/tests/xml/fake-libvirt-xml.c
index b7ab7a8..a34b700 100644
--- a/tests/xml/fake-libvirt-xml.c
+++ b/tests/xml/fake-libvirt-xml.c
@@ -25,15 +25,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-/* We're not using gnulib here so that we don't have to link to gnulib
- * rpl_* libraries (not possible since this is an LD_PRELOAD lib).
- * However that does mean we have to define O_CLOEXEC explicitly for
- * RHEL 5.
- */
-#ifndef O_CLOEXEC
-#define O_CLOEXEC 0
-#endif
-
/* Old <libvirt.h> had a slightly different definition of
* virDomainGetXMLDesc (using 'int' for flags instead of 'unsigned
* int'). To avoid an error trying to redefine it with a different
--
2.5.0
9 years, 1 month