emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Renaming: permission denied" file-error in Windows


From: LynX
Subject: Re: "Renaming: permission denied" file-error in Windows
Date: Sun, 11 Dec 2011 19:30:11 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2

On 12/11/2011 12:51 PM, Eli Zaretskii wrote:
Ah, I see the problem now: the implementation of `rename' on Windows
does not return errno = EXDEV in that case, so the recursive copying
does not happen.

Oh, yes you are right :). Here is a simple c code which demonstrates this:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>

int main(int argc, char* argv[])
{
    // in Windows path of course was a bit different :)
    int ret = rename("/media/c/toDel/test", "/media/g/Temp");
    perror("error");
    printf("ret %d errno %d\n", ret, errno);
    if (errno == EXDEV) {
        printf("EXDEV\n");
    } else if (errno == EACCES) {
        printf("EACCES\n");
    }
    while(1);
    return 0;
}

In Linux output is:
ret -1 errno 18
EXDEV

In Windows:
error: Permission denied
ret -1 errno 13
EACCES

So for Windows rename returns EACCES instead of EXDEV.

Maybe to fix it in Windows we need to check rename error code not only for EXDEV but for EACCES also.


I encourage the OP to file a bug report (using "M-x report-emacs-bug")
about this.  It should be easy to fix this.



Sorry, what "OP" means? :)

Regards,
LX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]