Maros Zatko
2015-Mar-25 17:07 UTC
[Libguestfs] [PACTH v2] customize: fix --upload to FAT partition
FAT doesn't support file ownership, so show warning instead of error. Fixes RHBZ#1196101 Maros Zatko (1): customize: fix --upload to FAT partition (RHBZ#1196101) customize/customize_run.ml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 1.9.3
Maros Zatko
2015-Mar-25 17:07 UTC
[Libguestfs] [PACTH v2] customize: fix --upload to FAT partition (RHBZ#1196101)
FAT doesn't support file ownership, so show info instead
of error.
---
customize/customize_run.ml | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index dbb77df..40d19ac 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -289,8 +289,20 @@ exec >>%s 2>&1
let statbuf = stat path in
let perms = statbuf.st_perm land 0o7777 (* sticky & set*id *) in
g#chmod perms dest;
- let uid, gid = statbuf.st_uid, statbuf.st_gid in
- g#chown uid gid dest
+
+ (* Check if target resides on FAT filesystem and then don't change
+ * ownership
+ *)
+ let mps = List.map (fun (dev, mp) -> mp, g#vfs_type dev)
(g#mountpoints ()) in
+ let is_vfat = List.exists (fun (mp, fs) ->
+ mp = (String.sub dest 0
+ (min (String.length mp) (String.length dest))) && fs =
"vfat") mps in
+
+ if not is_vfat then
+ let uid, gid = statbuf.st_uid, statbuf.st_gid in
+ g#chown uid gid dest
+ else
+ info (f_"Uploading to vfat, skipping chown")
| `Write (path, content) ->
msg (f_"Writing: %s") path;
--
1.9.3
Richard W.M. Jones
2015-Mar-26 09:12 UTC
Re: [Libguestfs] [PACTH v2] customize: fix --upload to FAT partition (RHBZ#1196101)
What was wrong with detecting ENOTSUP and turning it into a warning then? For reference see: https://github.com/libguestfs/libguestfs/blob/master/sparsify/in_place.ml#L38-L46 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Seemingly Similar Threads
- [PACTH v2] customize: fix --upload to FAT partition
- [PATCH v3] customize: fix --upload to FAT partition (RHBZ#1196101)
- [PATCH] customize: fix --upload to FAT partition (RHBZ#1196101)
- [PATCH v3] customize: fix --upload to FAT partition (RHBZ#1196101)
- [PATCH] customize: fix --upload to FAT partition