[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/2] actions: turn some params into RelativePathnameList (RHBZ#1174551).



Use RelativePathnameList as type for lists of relative paths, as used in
some listing-alike APIs.  This way we can ensure absolute paths in those
lists are rejects outright.

As a consequence, test-big-dirs.pl does not need to prepend the
directory name anymore before calling listing-alike APIs: previously
they didn't fail, but the returned lists contained only invalid
elements (and only their size was checked).
---
 generator/actions.ml           | 14 +++++++-------
 tests/bigdirs/test-big-dirs.pl |  1 -
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/generator/actions.ml b/generator/actions.ml
index 274ef3f..a6de484 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -2655,7 +2655,7 @@ See also C<guestfs_write>." };
 
   { defaults with
     name = "lstatlist"; added = (1, 0, 77);
-    style = RStructList ("statbufs", "stat"), [Pathname "path"; StringList "names"], [];
+    style = RStructList ("statbufs", "stat"), [Pathname "path"; RelativePathnameList "names"], [];
     deprecated_by = Some "lstatnslist";
     shortdesc = "lstat on multiple files";
     longdesc = "\
@@ -2675,7 +2675,7 @@ for getting extended attributes." };
 
   { defaults with
     name = "lstatnslist"; added = (1, 27, 53);
-    style = RStructList ("statbufs", "statns"), [Pathname "path"; StringList "names"], [];
+    style = RStructList ("statbufs", "statns"), [Pathname "path"; RelativePathnameList "names"], [];
     shortdesc = "lstat on multiple files";
     longdesc = "\
 This call allows you to perform the C<guestfs_lstatns> operation
@@ -2694,7 +2694,7 @@ for getting extended attributes." };
 
   { defaults with
     name = "lxattrlist"; added = (1, 0, 77);
-    style = RStructList ("xattrs", "xattr"), [Pathname "path"; StringList "names"], [];
+    style = RStructList ("xattrs", "xattr"), [Pathname "path"; RelativePathnameList "names"], [];
     optional = Some "linuxxattrs";
     shortdesc = "lgetxattr on multiple files";
     longdesc = "\
@@ -2719,7 +2719,7 @@ for getting standard stats." };
 
   { defaults with
     name = "readlinklist"; added = (1, 0, 77);
-    style = RStringList "links", [Pathname "path"; StringList "names"], [];
+    style = RStringList "links", [Pathname "path"; RelativePathnameList "names"], [];
     shortdesc = "readlink on multiple files";
     longdesc = "\
 This call allows you to do a C<readlink> operation
@@ -7703,7 +7703,7 @@ yourself (Augeas support makes this relatively easy)." };
 
   { defaults with
     name = "internal_lxattrlist"; added = (1, 19, 32);
-    style = RStructList ("xattrs", "xattr"), [Pathname "path"; StringList "names"], [];
+    style = RStructList ("xattrs", "xattr"), [Pathname "path"; RelativePathnameList "names"], [];
     proc_nr = Some 205;
     visibility = VInternal;
     optional = Some "linuxxattrs";
@@ -7733,7 +7733,7 @@ into smaller groups of names." };
 
   { defaults with
     name = "internal_readlinklist"; added = (1, 19, 32);
-    style = RStringList "links", [Pathname "path"; StringList "names"], [];
+    style = RStringList "links", [Pathname "path"; RelativePathnameList "names"], [];
     proc_nr = Some 206;
     visibility = VInternal;
     shortdesc = "readlink on multiple files";
@@ -12220,7 +12220,7 @@ This is the same as the L<lstat(2)> system call." };
 
   { defaults with
     name = "internal_lstatnslist"; added = (1, 27, 53);
-    style = RStructList ("statbufs", "statns"), [Pathname "path"; StringList "names"], [];
+    style = RStructList ("statbufs", "statns"), [Pathname "path"; RelativePathnameList "names"], [];
     proc_nr = Some 423;
     visibility = VInternal;
     shortdesc = "lstat on multiple files";
diff --git a/tests/bigdirs/test-big-dirs.pl b/tests/bigdirs/test-big-dirs.pl
index 40038b7..5bcc71c 100755
--- a/tests/bigdirs/test-big-dirs.pl
+++ b/tests/bigdirs/test-big-dirs.pl
@@ -63,7 +63,6 @@ for (my $i = 0; $i < $nr_files; ++$i) {
 # Check that lstatlist, lxattrlist and readlinklist return the
 # expected number of entries.
 my @a;
- filenames = map { "/dir/$_" } @filenames;
 
 @a = $g->lstatlist ("/dir", \ filenames);
 die unless @a == $nr_files;
-- 
2.1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]