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

Problem: there is no error raised when extract_file() fails to extract a file #221

Open
jhsimpson opened this issue Aug 3, 2017 · 0 comments

Comments

@jhsimpson
Copy link
Member

jhsimpson commented Aug 3, 2017

Scenario: Trying to get a single file from a 7zipped AIP.

When package.extract_file is called, with a relative_path argument (i.e., extract only one file), and the package was compressed with 7zip, then 7z is used to extract the a file from within the package.

If the file doesn't exist (there is no file inside the package at 'relative_path') then 7z exits, with a message that says:

No files to process

Files: 0
Size:       0

but it returns exit code 0.

The problem appears to be here:
https://github.com/artefactual/archivematica-storage-service/blob/stable/0.10.x/storage_service/locations/models/package.py#L538-L541

This code assumes exit code 0 means the file was extracted.

This was uncovered when trying to extract a manifest-sha512.txt file from an AIP that did not have that file, it has a manifest-sha256.txt.

qubot pushed a commit that referenced this issue Aug 4, 2017
fixes #221

This commit adds 4 tests and fixes to make the tests pass.

There are 2 specific bugs that this commit fixes:

1) when calling extract_file with a relative_path (i.e request
to extract a single file, not an aip)  on an
uncompressed aip, a single file is now returned.  Previously the
entire aip was returned

2) when calling extract_file with a relative_path and the requested
file does not exist, an error is raised.
qubot pushed a commit that referenced this issue Aug 4, 2017
fixes #221

This commit adds 4 tests and fixes to make the tests pass.

There are 2 specific bugs that this commit fixes:

1) when calling extract_file with a relative_path (i.e request
to extract a single file, not an aip)  on an
uncompressed aip, a single file is now returned.  Previously the
entire aip was returned

2) when calling extract_file with a relative_path and the requested
file does not exist, an error is raised.
qubot pushed a commit that referenced this issue Aug 4, 2017
fixes #221

This commit adds 4 tests and fixes to make the tests pass.

There are 2 specific bugs that this commit fixes:

1) when calling extract_file with a relative_path (i.e request
to extract a single file, not an aip)  on an
uncompressed aip, a single file is now returned.  Previously the
entire aip was returned

2) when calling extract_file with a relative_path and the requested
file does not exist, an error is raised.
qubot pushed a commit that referenced this issue Aug 9, 2017
fixes #221

This commit adds 4 tests and fixes to make the tests pass.

There are 2 specific bugs that this commit fixes:

1) when calling extract_file with a relative_path (i.e request
to extract a single file, not an aip)  on an
uncompressed aip, a single file is now returned.  Previously the
entire aip was returned

2) when calling extract_file with a relative_path and the requested
file does not exist, an error is raised.
qubot pushed a commit that referenced this issue Sep 5, 2017
fixes #221

This commit adds 4 tests and fixes to make the tests pass.

There are 2 specific bugs that this commit fixes:

1) when calling extract_file with a relative_path (i.e request
to extract a single file, not an aip)  on an
uncompressed aip, a single file is now returned.  Previously the
entire aip was returned

2) when calling extract_file with a relative_path and the requested
file does not exist, an error is raised.
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

No branches or pull requests

1 participant