You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
shutil.make_archive does not follow symlinks for zip archives #81782
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2019-07-16.00:15:38.140>labels= ['type-feature', 'library', '3.9']
title='shutil.make_archive does not follow symlinks for zip archives'updated_at=<Date2019-07-16.10:27:32.414>user='https://bugs.python.org/KevinTeague'
Activity
KevinTeague commentedon Jul 16, 2019
Zip archives created with shutil.make_archive will not follow symlinks.
The shutil._make_zipfile uses os.walk:
os.walk has the followlinks parameter:
Setting followlinks to True will include symlinks in a zip archive.
Could a followlinks parameter be added to shutil.make_archive?
tirkarthi commentedon Jul 16, 2019
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
picnixz commentedon Oct 7, 2025
Since #139679 is a broader issue and request, I'm going to close this one as a duplicate, while forwarding the previous message on consistency.
follow_linksparameter toshutil.make_archive()#139679