Package: nfs-user-server
Version: 2.2beta47-20
Severity: important

According to the Single Unix Specification, rename(dir1, dir2) should
atomically replace dir2 with dir1 if dir2 already exists.  With
nfs-kernel-server, this is correctly implemented.  But with
nfs-user-server, the below testcase results in:

 mkdir("tst-renamedir.C5xxQM", 0700)     = 0
 mkdir("tst-renamedir.W6OWYp", 0700)     = 0
 rename("tst-renamedir.C5xxQM", "tst-renamedir.W6OWYp") = -1 EBUSY

The relevant share is exported as:

 /home/foo/example                        (rw,insecure,no_all_squash)

Adding dirsync or async to the options has no effect on the testcase
failure.  Here is the testcase:

--- Begin renamedir.c ---

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <utime.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/vfs.h>

static int do_test()
{
    char dir1[] = "tst-renamedir.XXXXXX";
    char dir2[] = "tst-renamedir.XXXXXX";
    int result = 0;

    if (mkdtemp(dir1) == NULL) {
        printf("mkdtemp call failed: %m\n");
        return 1;
    }

    if (mkdtemp(dir2) == NULL) {
        printf("mkdtemp call failed: %m\n");
        return 1;
    }

    if (rename(dir1, dir2)) {
        printf("rename(%s, %s) failed: %m\n", dir1, dir2);
        return 1;
    }

    /* Print result summary.  */
    if (result) {
        printf("FAIL: %i test failures\n", result);
    } else {
        printf("PASS: %i test failures\n", result);

        if (rmdir(dir2)) {
            printf("unlink call failed: %m\n");
            return 1;
        }
    }

    return result;
}

#define TEST_FUNCTION do_test ()

/* Replace main() with `#include "test-skeleton.c"' to fit in glibc.  */
int main(int argc, char **argv)
{
    int err;

    /* Fire off the test.  */
    err = do_test();

    return err;
}

--- End renamedir.c ---

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-1-386
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages nfs-user-server depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libwrap0                    7.6.dbs-8    Wietse Venema's TCP wrappers libra
ii  portmap                     5-9          The RPC portmapper

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to