[packages/vzctl] Up to 4.11.1

arekm arekm at pld-linux.org
Sat Aug 23 15:36:52 CEST 2025


commit 37abd8d6ff3619b4877f42b46819ce75a4233d7d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Aug 23 15:36:44 2025 +0200

    Up to 4.11.1

 AM_PATH_XML2.m4 | 188 ++++++++++++++++++++++++++++++++++++++++++++++
 build.patch     | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 vzctl.spec      |  18 +++--
 3 files changed, 428 insertions(+), 5 deletions(-)
---
diff --git a/vzctl.spec b/vzctl.spec
index b77aab2..9bc4a81 100644
--- a/vzctl.spec
+++ b/vzctl.spec
@@ -5,19 +5,21 @@
 Summary:	OpenVZ containers control utility
 Summary(pl.UTF-8):	Narzędzie do zarządzania środowiskiem wirtualnym OpenVZ
 Name:		vzctl
-Version:	4.8
-Release:	3
+Version:	4.11.1
+Release:	1
 License:	GPL v2+
 Group:		Applications/System
 Source0:	http://download.openvz.org/utils/vzctl/%{version}/src/%{name}-%{version}.tar.bz2
-# Source0-md5:	ad3e9f06ddd553885517952e820325bc
+# Source0-md5:	a2ae627596137eb705366d65e031c44b
 Source1:	pld.conf
 Source2:	pld-add_ip.sh
 Source3:	pld-del_ip.sh
 Source4:	pld-set_hostname.sh
 Source5:	vz-pld.in
 Source6:	vzeventd-pld.in
+Source7:	AM_PATH_XML2.m4
 Patch0:		%{name}-pld.patch
+Patch1:		build.patch
 URL:		http://openvz.org/
 BuildRequires:	autoconf >= 2.59
 BuildRequires:	automake >= 1:1.9
@@ -86,13 +88,17 @@ Pakiet ten dostarcza bashowe uzupełnianie linii poleceń dla vzctl.
 %prep
 %setup -q
 %patch -P0 -p1
+%patch -P1 -p1
+
 cp -p %{SOURCE1} etc/dists
 install -p %{SOURCE2} %{SOURCE3} %{SOURCE4} etc/dists/scripts
 install -p %{SOURCE5} %{SOURCE6} etc/init.d
+install -d m4
+install -p %{SOURCE7} m4
 
 %build
 %{__libtoolize}
-%{__aclocal}
+%{__aclocal} -I m4
 %{__autoconf}
 %{__automake}
 %configure \
@@ -174,6 +180,9 @@ fi
 %attr(755,root,root) %{_sbindir}/arpsend
 %attr(755,root,root) %{_sbindir}/ndsend
 %attr(755,root,root) %{_sbindir}/vz*
+%dir %{_prefix}/libexec/vzctl
+%dir %{_prefix}/libexec/vzctl/scripts
+%attr(755,root,root) %{_prefix}/libexec/vzctl/scripts/*
 %dir /vz
 /vz/dump
 /vz/lock
@@ -191,7 +200,6 @@ fi
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/libvzchown-*.so
 %attr(755,root,root) %{_libdir}/libvzctl-*.so
-%attr(755,root,root) %{_libdir}/vzctl
 
 %files -n bash-completion-%{name}
 %defattr(644,root,root,755)
diff --git a/AM_PATH_XML2.m4 b/AM_PATH_XML2.m4
new file mode 100644
index 0000000..4465b55
--- /dev/null
+++ b/AM_PATH_XML2.m4
@@ -0,0 +1,188 @@
+# Adapted from:
+# Configure paths for LIBXML2
+# Toshio Kuratomi 2001-04-21
+# Adapted from:
+# Configure paths for GLIB
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for XML, and define XML_CFLAGS and XML_LIBS
+dnl
+AC_DEFUN([AM_PATH_XML2],[
+AC_ARG_WITH(xml-prefix,
+            [  --with-xml-prefix=PREFIX   Prefix where libxml is installed (optional)],
+            xml_config_prefix="$withval", )
+AC_ARG_WITH(xml-exec-prefix,
+            [  --with-xml-exec-prefix=PREFIX Exec prefix where libxml is installed (optional)],
+            xml_config_exec_prefix="$withval", )
+AC_ARG_ENABLE(xmltest,
+              [  --disable-xmltest       Do not try to compile and run a test LIBXML program],,
+              enable_xmltest=yes)
+
+  if test x$xml_config_exec_prefix != x ; then
+     xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix"
+     if test x${XML2_CONFIG+set} != xset ; then
+        XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
+     fi
+  fi
+  if test x$xml_config_prefix != x ; then
+     xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
+     if test x${XML2_CONFIG+set} != xset ; then
+        XML2_CONFIG=$xml_config_prefix/bin/xml2-config
+     fi
+  fi
+
+  AC_PATH_TOOL(XML2_CONFIG, xml2-config, no)
+  min_xml_version=ifelse([$1], ,2.0.0,[$1])
+  AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
+  no_xml=""
+  if test "$XML2_CONFIG" = "no" ; then
+    no_xml=yes
+  else
+    XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
+    XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
+    xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_xmltest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $XML_CFLAGS"
+      LIBS="$XML_LIBS $LIBS"
+dnl
+dnl Now check if the installed libxml is sufficiently new.
+dnl (Also sanity checks the results of xml2-config to some extent)
+dnl
+      rm -f conf.xmltest
+      AC_TRY_RUN([
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <libxml/xmlversion.h>
+
+int 
+main()
+{
+  int xml_major_version, xml_minor_version, xml_micro_version;
+  int major, minor, micro;
+  char *tmp_version;
+
+  system("touch conf.xmltest");
+
+  /* Capture xml2-config output via autoconf/configure variables */
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = (char *)strdup("$min_xml_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string from xml2-config\n", "$min_xml_version");
+     exit(1);
+   }
+   free(tmp_version);
+
+   /* Capture the version information from the header files */
+   tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
+   if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
+     printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
+     exit(1);
+   }
+   free(tmp_version);
+
+ /* Compare xml2-config output to the libxml headers */
+  if ((xml_major_version != $xml_config_major_version) ||
+      (xml_minor_version != $xml_config_minor_version) ||
+      (xml_micro_version != $xml_config_micro_version))
+    {
+      printf("*** libxml header files (version %d.%d.%d) do not match\n",
+         xml_major_version, xml_minor_version, xml_micro_version);
+      printf("*** xml2-config (version %d.%d.%d)\n",
+         $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
+      return 1;
+    } 
+/* Compare the headers to the library to make sure we match */
+  /* Less than ideal -- doesn't provide us with return value feedback, 
+   * only exits if there's a serious mismatch between header and library.
+   */
+    LIBXML_TEST_VERSION;
+
+    /* Test that the library is greater than our minimum version */
+    if ((xml_major_version > major) ||
+        ((xml_major_version == major) && (xml_minor_version > minor)) ||
+        ((xml_major_version == major) && (xml_minor_version == minor) &&
+        (xml_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
+               xml_major_version, xml_minor_version, xml_micro_version);
+        printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
+           major, minor, micro);
+        printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
+        printf("*** correct copy of xml2-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+    }
+  return 1;
+}
+],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+
+  if test "x$no_xml" = x ; then
+     AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$XML2_CONFIG" = "no" ; then
+       echo "*** The xml2-config script installed by LIBXML could not be found"
+       echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the XML2_CONFIG environment variable to the"
+       echo "*** full path to xml2-config."
+     else
+       if test -f conf.xmltest ; then
+        :
+       else
+          echo "*** Could not run libxml test program, checking why..."
+          CFLAGS="$CFLAGS $XML_CFLAGS"
+          LIBS="$LIBS $XML_LIBS"
+          AC_TRY_LINK([
+#include <libxml/xmlversion.h>
+#include <stdio.h>
+],      [ LIBXML_TEST_VERSION; return 0;],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
+          echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+          echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means LIBXML was incorrectly installed"
+          echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
+          echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+
+     XML_CFLAGS=""
+     XML_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(XML_CFLAGS)
+  AC_SUBST(XML_LIBS)
+  rm -f conf.xmltest
+])
+
diff --git a/build.patch b/build.patch
new file mode 100644
index 0000000..1e57815
--- /dev/null
+++ b/build.patch
@@ -0,0 +1,227 @@
+--- vzctl-4.8/src/lib/config.c~	2014-10-06 18:02:14.000000000 +0200
++++ vzctl-4.8/src/lib/config.c	2025-08-23 14:45:30.638052839 +0200
+@@ -26,6 +26,7 @@
+ #include <getopt.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <linux/vzcalluser.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+--- vzctl-4.8/src/lib/dev.c~	2014-10-06 18:02:14.000000000 +0200
++++ vzctl-4.8/src/lib/dev.c	2025-08-23 14:47:05.081941611 +0200
+@@ -20,6 +20,7 @@
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/ioctl.h>
+--- vzctl-4.8/include/fs.h~	2014-10-06 18:02:23.000000000 +0200
++++ vzctl-4.8/include/fs.h	2025-08-23 14:48:25.399080634 +0200
+@@ -66,7 +66,7 @@ int vps_is_mounted(const char *root, con
+  * @param fsck		fsck parameter for ploop mount
+  * @return		0 on success.
+  */
+-int fsmount(envid_t veid, fs_param *fs, dq_param *dq, int fsck);
++int vzfsmount(envid_t veid, fs_param *fs, dq_param *dq, int fsck);
+ 
+ /** Mount CT and run mount action script if exists.
+  *
+--- vzctl-4.8/src/lib/create.c~	2014-10-06 18:02:14.000000000 +0200
++++ vzctl-4.8/src/lib/create.c	2025-08-23 14:48:45.389198200 +0200
+@@ -537,7 +537,7 @@ static int vps_postcreate(envid_t veid,
+ 		ret = 0;
+ 		goto err;
+ 	}
+-	ret = fsmount(veid, &res->fs, &res->dq, 0);
++	ret = vzfsmount(veid, &res->fs, &res->dq, 0);
+ 	if (ret)
+ 		goto err;
+ 	arg[0] = actions.post_create;
+--- vzctl-4.11.1/src/lib/exec.c~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/lib/exec.c	2025-08-23 14:57:28.948943949 +0200
+@@ -453,7 +453,7 @@ int vps_run_script(vps_handler *h, envid
+ 			return ret;
+ 		is_mounted = vps_is_mounted(&vps_p->res.fs);
+ 		if (is_mounted == 0) {
+-			if ((ret = fsmount(veid, &vps_p->res.fs,
++			if ((ret = vzfsmount(veid, &vps_p->res.fs,
+ 				&vps_p->res.dq, 0)))
+ 			{
+ 				return ret;
+--- vzctl-4.8/src/lib/fs.c~	2014-10-06 18:02:14.000000000 +0200
++++ vzctl-4.8/src/lib/fs.c	2025-08-23 14:49:15.999378222 +0200
+@@ -35,7 +35,7 @@
+ 
+ int vps_is_run(vps_handler *h, envid_t veid);
+ 
+-int fsmount(envid_t veid, fs_param *fs, dq_param *dq, int fsck)
++int vzfsmount(envid_t veid, fs_param *fs, dq_param *dq, int fsck)
+ {
+ 	int ret;
+ 
+@@ -180,7 +180,7 @@ int vps_mount(vps_handler *h, envid_t ve
+ 		return VZ_FS_NOPRVT;
+ 	}
+ 
+-	if ((ret = fsmount(veid, fs, dq, fsck)))
++	if ((ret = vzfsmount(veid, fs, dq, fsck)))
+ 		return ret;
+ 	/* Execute per-CT & global mount scripts */
+ 	if (!(skip & SKIP_ACTION_SCRIPT)) {
+--- vzctl-4.11.1/include/image.h~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/include/image.h	2025-08-23 15:30:08.897134498 +0200
+@@ -22,6 +22,8 @@
+ #ifdef HAVE_PLOOP
+ #include <ploop/libploop.h>
+ #include <ploop/dynload.h>
++#define read_disk_descr(_di_pp, _fname)  read_dd(*(_di_pp))
++
+ #endif
+ 
+ #include "types.h"
+--- vzctl-4.11.1/src/lib/image.c.org	2025-08-23 15:16:25.482293597 +0200
++++ vzctl-4.11.1/src/lib/image.c	2025-08-23 15:17:03.012514239 +0200
+@@ -225,7 +229,6 @@ int is_image_mounted(const char *ve_priv
+ 		return -1;
+ 	}
+ 	ret = ploop.get_dev(di, dev, sizeof(dev));
+-	ploop.free_diskdescriptor(di);
+ 
+ 	return (ret == 0);
+ }
+@@ -259,7 +262,6 @@ int vzctl_mount_image(const char *ve_pri
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_MOUNT_IMAGE;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 	return ret;
+ }
+ 
+@@ -285,7 +287,6 @@ int vzctl_umount_image(const char *ve_pr
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_UMOUNT_IMAGE;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 	return ret;
+ }
+ 
+@@ -381,7 +382,6 @@ int vzctl_convert_image(const char *ve_p
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_CONVERT_IMAGE;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 	return ret;
+ }
+ 
+@@ -416,7 +416,6 @@ int vzctl_resize_image(const char *ve_pr
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_RESIZE_IMAGE;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 	return ret;
+ }
+ 
+@@ -456,7 +455,6 @@ int vzctl_create_snapshot(const char *ve
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_CREATE_SNAPSHOT;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 
+ 	return ret;
+ }
+@@ -489,7 +487,6 @@ int vzctl_delete_snapshot(const char *ve
+ 				ploop.get_last_error(), ret);
+ 		ret = VZCTL_E_DELETE_SNAPSHOT;
+ 	}
+-	ploop.free_diskdescriptor(di);
+ 
+ 	return ret;
+ }
+@@ -524,7 +521,6 @@ int vzctl_merge_snapshot(const char *ve_
+ 		ret = VZCTL_E_MERGE_SNAPSHOT;
+ 	}
+ 
+-	ploop.free_diskdescriptor(di);
+ 
+ 	return ret;
+ }
+@@ -582,7 +578,6 @@ int vzctl_mount_snapshot(unsigned envid,
+ 	strncpy(param->device, mount_param.device, sizeof(param->device)-1);
+ 
+ err:
+-	ploop.free_diskdescriptor(di);
+ 
+ 	return ret;
+ }
+@@ -607,7 +602,6 @@ int vzctl_umount_snapshot(unsigned envid
+ 				fname, sizeof(fname)));
+ 
+ 	PLOOP_CLEANUP(ret = ploop.umount_image(di));
+-	ploop.free_diskdescriptor(di);
+ 	if (ret)
+ 		return vzctl_err(VZCTL_E_UMOUNT_SNAPSHOT, 0,
+ 				"Failed to umount snapshot %s: %s [%d]",
+--- vzctl-4.11.1/src/lib/vps_configure.c~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/lib/vps_configure.c	2025-08-23 15:21:41.454151212 +0200
+@@ -22,6 +22,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/stat.h>
++#include <sys/sysmacros.h>
+ #include <netinet/in.h>
+ #include <linux/vzcalluser.h>
+ 
+--- vzctl-4.11.1/src/lib/Makefile.am~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/lib/Makefile.am	2025-08-23 15:24:06.501670621 +0200
+@@ -26,7 +26,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
+               -DVEPIDDIR=\"$(vepiddir)\" \
+               $(XML_CPPFLAGS)
+ 
+-AM_CFLAGS = $(CGROUP_CFLAGS)
++AM_CFLAGS = $(CGROUP_CFLAGS) $(XML_CFLAGS)
+ 
+ LIB_VER = $(VERSION)
+ 
+--- vzctl-4.11.1/src/lib/hooks_ct.c~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/lib/hooks_ct.c	2025-08-23 15:25:27.232145240 +0200
+@@ -7,6 +7,7 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <sys/mount.h>
++#include <sys/sysmacros.h>
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <dirent.h>
+--- vzctl-4.11.1/src/snapshot.c~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/snapshot.c	2025-08-23 15:28:21.819838318 +0200
+@@ -171,8 +173,6 @@ err:
+ 	logger(-1, 0, "Failed to create snapshot");
+ 
+ out:
+-	if (di != NULL)
+-		ploop.free_diskdescriptor(di);
+ 	if (tree != NULL)
+ 		vzctl_free_snapshot_tree(tree);
+ 
+@@ -373,8 +373,6 @@ err:
+ out:
+ 	if (tree != NULL)
+ 		vzctl_free_snapshot_tree(tree);
+-	if (di != NULL)
+-		ploop.free_diskdescriptor(di);
+ 
+ 	return ret;
+ }
+--- vzctl-4.11.1/src/snapshot-list.c~	2018-05-15 13:53:26.000000000 +0200
++++ vzctl-4.11.1/src/snapshot-list.c	2025-08-23 15:31:27.317594927 +0200
+@@ -362,7 +362,6 @@ int vzctl_env_snapshot_list(int argc, ch
+ 		}
+ 	}
+ 
+-	ploop.free_diskdescriptor(g_di);
+ free_tree:
+ 	vzctl_free_snapshot_tree(tree);
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vzctl.git/commitdiff/37abd8d6ff3619b4877f42b46819ce75a4233d7d



More information about the pld-cvs-commit mailing list