[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
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
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#L3... 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
On Thu, Mar 26, 2015 at 09:12:03AM +0000, Richard W.M. Jones wrote:
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#L3...
Or EPERM. I've added G.Errno.errno_EPERM to the list of errnos accessible from OCaml: https://github.com/libguestfs/libguestfs/commit/6297534091666ccb7a5192763b53... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com 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/
participants (2)
-
Maros Zatko -
Richard W.M. Jones