On Wed, Nov 18, 2009 at 01:17:20PM +0000, Matthew Booth wrote:
On 11/18/2009 10:23 AM, Richard W.M. Jones wrote:
> On Wed, Nov 18, 2009 at 09:44:10AM +0000, Matthew Booth wrote:
>>> +stage Checking file modes of initial content
>>> +[ "$(stat -c %a empty)" = "644" ]
>>> +[ "$(stat -c %a hello.txt)" = "644" ]
>>> +[ "$(stat -c %a world.txt)" = "644" ]
>>
>> You need to explicitly set the umask to 022 at the beginning of the
>> script for this to be reliable.
>
> libguestfs guarantees the initial umask already:
>
>
http://libguestfs.org/guestfs.3.html#guestfs_umask
>
http://git.annexia.org/?p=libguestfs.git;a=blob;f=daemon/guestfsd.c;h=db0...
The relevant umask is surely the umask of the user running the test.
However, given that the tests pass and my umask is 002, I guess it's not
passing this umask through to the daemon. That's a bug.
Note this has nothing to do with FUSE: the files are created in that
script using guestfish.
The daemon is documented to set the umask to 022, which is why the
tests pass. Passing the user's umask to the daemon by default would
break the existing guarantee and be one more thing for every script to
have to think about, but in case you want to pass your local umask you
could do this in shell scripts:
guestfish <<EOF
[...]
umask $(($(umask)))
[...]
EOF
The rather convoluted shell invocation is because of a real bug in
guestfish which is that it doesn't appear to parse octal and
hexadecimal numbers properly.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top