[issue30749] Non-atomic and unusual (wrong) rename behavior under OS X

Alex Groce report at bugs.python.org
Mon Jun 26 03:41:38 EDT 2017


Alex Groce added the comment:

#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>

int main () {
  system("rm -rf testingdir");
  mkdir("testingdir",S_IRWXU);  
  mkdir("testingdir/a",S_IRWXU);
  mkdir("testingdir/a/a",S_IRWXU);
  mkdir("testingdir/a/a/a",S_IRWXU);
  printf("BEFORE:\n");
  system("ls -lR testingdir");
  int res = rename("testingdir","testingdir/a/a/a");
  printf("res = %d, ERRNO = %d\n",res,errno);
  printf("AFTER:\n");
  system("ls -lR testingdir");  
}


shows that it appears to be an OS X rename issue, not a Python problem.

Lowering # directories in the chain by 1 reverts to errno 22 and correct behavior, but it's at the OS level, not Python.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30749>
_______________________________________


More information about the Python-bugs-list mailing list