Skip to content

Conversation

@yuxiang-zhang
Copy link
Contributor

Issue #, if available:
Fixes #511
Resolves #69

Description of changes:
This restores partially commit 790cde6, which effectively prevents including symlinks to directories as pointed out in #511.

The function is_parent_directory_in_ignore_list was removed because it was doing a very inefficient M*N lookup (M: number of dirs and files, N: number of entries in ignore_list which include all subdirectories and files). This part was not restored.

Manual testing:
Done with Python 3.9.18 and Python 3.12.10
Set up the following local directories

├── dummy.zip
├── file_a
├── folder_a
│   └── folder_b
│       └── file_b
├── ignore
│   ├── dir
│   │   └── ignored_file
│   └── symlink -> /home/yuxiang/tmp/511/folder_a
└── symlink_to_folder_b -> folder_a/folder_b

6 directories, 4 files

Ran the following code to validate the content of the zip:

import sys, os, io, zipfile

sys.path.append(os.path.abspath('/home/yuxiang/workspace/aws-elastic-beanstalk-cli'))

from ebcli.core import fileoperations

ignore_files = fileoperations.get_ebignore_list()
fileoperations.zip_up_project('dummy.zip', ignore_list=ignore_files)

with zipfile.ZipFile('./dummy.zip', 'r') as zip_ref:
    print(zip_ref.namelist())

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This restores partially commit 790cde6.
Copy link
Collaborator

@rahulrajaram rahulrajaram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. LGTM

@rahulrajaram rahulrajaram merged commit bad66a6 into aws:master Apr 22, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eb deploy doesn't zip symlinks-to-directories .ebignore includes symlinked files in ignored directories

2 participants