Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 2, 2025

This PR fixes an issue where azcopy sync would fail when syncing files in nested directory structures when using --local-hash-storage-mode HiddenFiles.

Problem

When syncing files located in nested directories (e.g., lib/MIME/Type.pm where lib contains only the MIME subdirectory), azcopy would fail with:

ERR: DOWNLOADFAILED: failed to create hash meta file: open /path/.azcopy/lib/MIME/.Type.pm.azcopysyncmeta: no such file or directory

This occurred because the getHashPath() method in HiddenFileDataAdapter used os.Mkdir() which only creates a single directory level, not the full path recursively.

Solution

Replace os.Mkdir() with os.MkdirAll() to create the full directory path recursively. This ensures that all necessary parent directories are created before attempting to write the hash metadata file.

Changes

  • Modified common/hash_data_adapter_hidden_files.go: Changed os.Mkdir() to os.MkdirAll() in the getHashPath() method (2 lines changed)
  • Added common/hash_data_adapter_hidden_files_test.go: Comprehensive test cases to validate the fix and prevent regression

Testing

Added test cases that reproduce the exact scenario described in the issue:

  • TestHiddenFileDataAdapter_NestedDirectories: Tests nested directory structure like lib/MIME/Type.pm
  • TestHiddenFileDataAdapter_IssueScenario: Tests the specific directory structure from the GitHub issue

All tests pass and the build remains successful.

Fixes #3017.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] azcopy sync print failure logs for directory that has only subdirectory with files Fix nested directory creation issue in hash metadata storage Jun 2, 2025
@Copilot Copilot AI requested a review from vibhansa-msft June 2, 2025 10:29
Copilot finished work on behalf of vibhansa-msft June 2, 2025 10:29
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.

azcopy sync print failure logs for directory that has only subdirectory with files
2 participants