[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina

2019-11-25 Thread Bo Anderson


Bo Anderson  added the comment:

For what it's worth, this is having an impact on some real code: 
https://github.com/Homebrew/homebrew-core/pull/45110

Perhaps a simpler way to reproduce is:

% cd /tmp
% python3 -c 'import os; open(os.path.relpath("/tmp/test.txt"), "w")'
Traceback (most recent call last):
  File "", line 1, in 
FileNotFoundError: [Errno 2] No such file or directory: '../../tmp/test.txt'

--
nosy: +Bo98

___
Python tracker 
<https://bugs.python.org/issue38295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina

2019-12-17 Thread Bo Anderson


Bo Anderson  added the comment:

Indeed. The issue can be trivially reproduced with:

```
#include 
#include 
#include 
#include 

int main()
{
  char buf[255];
  printf("Current dir: %s\n", getcwd(buf, 255));

  int fd = open("../../tmp/test.txt", O_WRONLY | O_CREAT);
  if (fd < 0)
  {
printf("errno %d\n", errno);
return 1;
  }
  close(fd);
  printf("Success\n");
  return 0;
}
```

and running it in /private/tmp.

I filed FB7467762 at the end of November. Downstream projects meanwhile are 
working around the issue by resolving the file path before passing it into 
`open`.

--

___
Python tracker 
<https://bugs.python.org/issue38295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38295] test_relative_path of test_py_compile fails on macOS 10.15 Catalina

2019-12-17 Thread Bo Anderson


Bo Anderson  added the comment:

> You don't even need a C program to reproduce

Indeed, touch is built upon the POSIX file API (unless Apple modified it). The 
idea for the Apple bug report was to show it happening at a low level and not 
specific to a given tool.

> And the "cd" is optional, I get the same error from my home directory

Yes, /private/tmp is just an example but I'd be cautious saying the same 
happens everywhere. You won't be able to reproduce the issue if your current 
directory is /usr.

/private/tmp, your home directory, etc. are all "firmlinked" to 
/System/Volumes/Data in Catalina. /System/Volumes/Data/private/tmp exists but 
/System/Volumes/Data/tmp doesn't exist. This shouldn't really be an issue as 
the idea of firmlinks is to make the /System/Volumes/Data invisible and thus 
you should be able to relatively go back up to the /System/Volumes/Data and be 
transported back to the root directory, where you can find the /tmp symlink 
(and indeed that works fine with `ls`). Evidently that doesn't seem to work 
properly for file operations.

--

___
Python tracker 
<https://bugs.python.org/issue38295>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com