utimes affects permissions under emulators/linux_dist-gentoo-state3

Timothy Bourke timbob at bigpond.com
Tue Dec 19 17:21:44 PST 2006


Under FreeBSD 6.1-RELEASE-p11 with linux_dist-gentoo-stage3-2006.0_2, I
find that, on my laptop at least, files installed by portage have
incorrect permissions.

It seems that the problem can be reduced to utimes(). The following
program also unexpectedly changes file permissions but not m/atimes:
    #include <sys/time.h>

    int main(int argc, char** argv)
    {
        struct timeval timep[2];

        timep[0].tv_sec = timep[1].tv_sec = 3600;
        timep[0].tv_usec = timep[1].tv_usec = 0;

        if (argc > 1)
            utimes(argv[1], timep);

        return 0;
    }


e.g.
    # chroot /usr/local/gentoo-stage3 /bin/bash
    # cc -o utimestest utimestest.c
    # touch blah
    # chmod 644; ls -l blah
    -rw-r--r--  1 root root 0 Dec 20 00:55 blah
    # ./utimestest blah; ls -l blah
    -r--rwS---  1 root root 0 Dec 20 00:55 blah

This happens regardless of whether the executable is run inside or
outside a chroot. The executable works as expected if compiled under
FreeBSD.

Before investigating further, possibly trying the utimes linuxulator
patch posted earlier, I wonder whether anybody else has had a similar
problem?

Tim.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20061220/6d5bc938/attachment.pgp


More information about the freebsd-emulation mailing list