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

Fix tar2vhd on specific unordered tars #1012

Merged
merged 1 commit into from
Apr 27, 2021

Conversation

estebanreyl
Copy link
Contributor

This addresses nil dereference bug we encountered when doing tar2vhd conversion and extends on the previous fix to address when parent directories don't exist.

In this case the issue arises if the root directory has not yet been initialized by the time a file not in the root directory is processed. For the bug to happen the tar has to be built in such a way that the first file processed:

  1. Does not have a whiteout prefix (.wh)
  2. Is not a Hard link
  3. Does not have root as its parent folder (my guess is in most orderings this starts with root which is why we hadn't encountered this before).

In the particular case of the image for which we found the issue the first file seen looked something like: /folder1/folder2/somefile which meets all the conditions above causing the failure. As a note I swapped the order in the test at tar2ext4_test.go to show how to replicate and to include the scenario of this fix there.

As a fix I am calling finishInode at the start of CreateWithParents following the convention of Create and the other methods which rely on its init check and state cleanup

root folder file.

Signed-off-by: Esteban Rey <esrey@microsoft.com>
@estebanreyl estebanreyl requested a review from a team as a code owner April 27, 2021 17:58
@estebanreyl estebanreyl changed the title Added fix for unordered tars not starting with a Fix tar2vhd on specific unordered tars Apr 27, 2021
@ambarve
Copy link
Contributor

ambarve commented Apr 27, 2021

LGTM.

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.

3 participants