[issue37601] shutil.make_archive does not follow symlinks for zip archives

Karthikeyan Singaravelan report at bugs.python.org
Tue Jul 16 06:27:32 EDT 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

This looks like a reasonable addition to me. Other APIs in shutil have follow_symlinks parameter.

➜  /tmp ls -al sym
total 0
drwxr-xr-x   3 karthikeyansingaravelan  staff   102 Jul 16 15:52 .
drwxr-xr-x  58 karthikeyansingaravelan  staff  1972 Jul 16 15:52 ..
-rw-r--r--   1 karthikeyansingaravelan  staff     0 Jul 16 15:05 a

➜  /tmp ls -al foo
total 8
drwxr-xr-x   5 karthikeyansingaravelan  staff   170 Jul 16 15:43 .
drwxr-xr-x  58 karthikeyansingaravelan  staff  1972 Jul 16 15:52 ..
-rw-r--r--   1 karthikeyansingaravelan  staff     0 Jul 16 15:00 a
-rw-r--r--   1 karthikeyansingaravelan  staff     0 Jul 16 15:00 b
lrwxr-xr-x   1 karthikeyansingaravelan  staff     8 Jul 16 15:04 c -> /tmp/sym

# Using zip in Mac and zipfile module

➜  /tmp python3 -m zipfile -c cmd.zip foo/*
➜  /tmp python3 -m zipfile -l cmd.zip
File Name                                             Modified             Size
a                                              2019-07-16 15:00:04            0
b                                              2019-07-16 15:00:10            0
c/                                             2019-07-16 15:52:06            0
c/a                                            2019-07-16 15:05:46            0

# Using make_archive

➜  /tmp python3 -c "import shutil; shutil.make_archive('make_archive', 'zip', 'foo')"
➜  /tmp python3 -m zipfile -l make_archive.zip
File Name                                             Modified             Size
c/                                             2019-07-16 15:52:06            0
a                                              2019-07-16 15:00:04            0
b                                              2019-07-16 15:00:10            0

----------
nosy: +serhiy.storchaka, xtreak

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37601>
_______________________________________


More information about the Python-bugs-list mailing list