New submission from Anthony Sottile <[email protected]>:
Fortunately, this can be reproduced with the testsuite:
```
======================================================================
ERROR: test_copystat_symlinks (__main__.TestShutil)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.6/test/test_shutil.py", line 366, in
test_copystat_symlinks
os.lchmod(src_link, stat.S_IRWXO)
OSError: [Errno 95] Not supported: '/tmp/tmplfli9msi/baz'
```
My simplest reproduction involves docker:
```dockerfile
FROM alpine
RUN apk update && apk add curl python3
RUN mkdir foo && ln -s /dev/null foo/bar
CMD [ \
"python3", "-c", \
"import shutil; shutil.copytree('foo', 'bar', symlinks=True)" \
]
```
```
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/shutil.py", line 359, in copytree
raise Error(errors)
shutil.Error: [('foo/bar', 'bar/bar', "[Errno 95] Not supported: 'bar/bar'")]
```
By looking at pyconfig, I get the following:
```
/ # grep -E '(HAVE_FCHMODAT|HAVE_LCHMOD)' /usr/include/python3.6m/pyconfig.h
#define HAVE_FCHMODAT 1
#define HAVE_LCHMOD 1
```
But it seems lchmod is actually nonfunctional in this case.
I think the fix is to augment `configure` to detect faulty `lchmod` and not set
`HAVE_LCHMOD`? I'm not terribly familiar with the autotools pipeline but
that's where I'm going to take a stab at it!
I'm originally finding this issue via
https://github.com/pre-commit/pre-commit/issues/655
----------
components: Build, Library (Lib), Tests
messages: 305527
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: copystat on symlinks fails for alpine -- faulty lchmod implementation?
versions: Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31940>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com