[Libguestfs] [PATCH] builder, sparsify: use // for file concatenation
Richard W.M. Jones
rjones at redhat.com
Thu Feb 27 10:14:14 UTC 2014
On Wed, Feb 26, 2014 at 12:02:04PM +0100, Pino Toscano wrote:
> Just syntactic sugar, no behaviour changes.
> ---
> builder/builder.ml | 2 +-
> sparsify/sparsify.ml | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builder/builder.ml b/builder/builder.ml
> index 1800f2d..77e37d2 100644
> --- a/builder/builder.ml
> +++ b/builder/builder.ml
> @@ -815,7 +815,7 @@ exec >>%s 2>&1
> msg (f_"Uploading: %s to %s") file dest;
> let dest =
> if g#is_dir ~followsymlinks:true dest then
> - dest ^ "/" ^ Filename.basename file
> + dest // Filename.basename file
> else
> dest in
> (* Do the file upload. *)
> diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
> index 212a23f..a51a200 100644
> --- a/sparsify/sparsify.ml
> +++ b/sparsify/sparsify.ml
> @@ -370,7 +370,7 @@ let () =
> fun vg ->
> if not (List.mem vg ignores) then (
> let lvname = string_random8 () in
> - let lvdev = "/dev/" ^ vg ^ "/" ^ lvname in
> + let lvdev = "/dev/" ^ vg // lvname in
>
> let created =
> try g#lvcreate_free lvname vg 100; true
NACK.
This is wrong because in the libguestfs namespace, path elements are
always separated by '/'.
Using the // operator (ie. Filename.concat) will cause other
separators to be used on other architectures, eg. \ on Windows, which
is wrong since libguestfs on Windows uses a Fedora-based appliance.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
More information about the Libguestfs
mailing list