Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create dir from full Windows path #369

Closed
tamasszarka opened this issue Mar 7, 2019 · 0 comments
Closed

Cannot create dir from full Windows path #369

tamasszarka opened this issue Mar 7, 2019 · 0 comments
Labels
fixed Issue or bug has been fixed

Comments

@tamasszarka
Copy link
Contributor

This seems to be a bug.
When extracting an archive, directory creation fails when a subdirectory is to be extracted, but its parent directory in the archive has not yet been created. On the below exawmple structue, this issue occurs when trying to extract file_x earlier than file_y.

Example - extracting the below archive into d:\temp:
/dir1/
/subdir1/
/subdir1/file_x
/file_y
/dir2/

What specifically happens is that as the mz_dir_make function in mz_os.c runs to create the directory dir1/subdir1 for file_x on the file system, it goes ahead and breaks down the full Windows path d:\temp\dir1\subdir1 to components to be able to create it level-by-level, and it breaks it up based on path-separators (obviously), attempting to create them in this order:
d:
d:\temp
d:\temp\dir1
d:\temp\dir1\subdir1

That's to logic at least - but the first iteration fails, as CreateDirectoryW in mz_os_win32.c yields ERROR_ACCESS_DENIED for a drive letter, preventing the loop from continuing with the iteration on the target path, and ends up returning MZ_INTERNAL_ERROR from mz_zip_reader_save_all.

This is specific to Windows and to archives where subdirs occur before files on the same level inside a directory.

tamasszarka added a commit to tamasszarka/minizip that referenced this issue Mar 7, 2019
nmoinvaz added a commit that referenced this issue Mar 8, 2019
Allow recursively creating Windows path to fix #369
@nmoinvaz nmoinvaz closed this as completed Mar 8, 2019
@nmoinvaz nmoinvaz added bug fixed Issue or bug has been fixed labels Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed Issue or bug has been fixed
Projects
None yet
Development

No branches or pull requests

2 participants