-
Notifications
You must be signed in to change notification settings - Fork 77
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
add ide-specific settings to .gitignore and simply implement 7z #393
Conversation
Thanks for your contribution! A review will come once one of us finds the time to take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR, there are some changes needed for it to be merged.
In the title you wrote "simply implement 7z", so maybe your plan was to leave this as it is right now, a simpler implementation, if that's the case, I'll ask you to leave the PR open so that anyone can pick from where you left it and finish it, otherwise, you're more than welcome to finish it yourself.
I've asked for a review from Figsoda because unfortunately I've been busy (and kinda exhausted), but he's also kinda busy so maybe this will have to wait. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at the code and it looks pretty simple and straight forward. If I was the project maintainer I would probably also want to see some lines added in ./tests/integration.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the final change request.
As @Mic92 mentioned, it's necessary to add 7z to the integration tests file.
idk how to implement test, I'll add tests/integration.rs when I implement it or someone implement test and comment it |
Thanks for sticking to this! It's looking great! EDIT: removed reference, it looks misleading. |
added 7z to tests, but I kept running into this error
|
src/archive/sevenz.rs
Outdated
pub fn compress_sevenz(files: Vec<PathBuf>, output_path: &Path) -> crate::Result<bool> { | ||
let mut writer = sevenz_rust::SevenZWriter::create(output_path).map_err(crate::Error::SevenzipError)?; | ||
|
||
for filep in files.iter() { | ||
writer | ||
.push_archive_entry::<std::fs::File>( | ||
sevenz_rust::SevenZWriter::<std::fs::File>::create_archive_entry( | ||
filep, | ||
filep | ||
.strip_prefix(current_dir()?) | ||
.expect("StripPrefix Failed") | ||
.as_os_str() | ||
.to_str() | ||
.unwrap() | ||
.to_string(), | ||
), | ||
None, | ||
) | ||
.map_err(crate::Error::SevenzipError)?; | ||
} | ||
|
||
writer.finish()?; | ||
Ok(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in line 17 of this big oneliner.
i don't know how to fix it and I have a no time for now, anyone can contribute this pull request! |
@MisileLab thanks for your hard-work! I might be able to pick it up soon. |
I saw that Switching to that does solve the panic (I can now manually compress and decompress 7z archives from the cli) however it does not fix all the tests. Using Another thing that was surprising was when decompressing an archive that was compressed by $ cargo r -- d tmp.7z
[INFO] Could not detect the extension of `tmp` This was interesting because it did decompress correctly. The bytes here seem to agree with Wikipedia so not sure why it fails to detect it (but somehow still work?). The following tests are failing:
Edit: On closer inspection, upon decompressing a 7z archive, an empty folder with the same name as the initial archive is created in the same directory Logs:
|
Signed-off-by: MisileLab <[email protected]>
Signed-off-by: MisileLab <[email protected]>
will it work? Whats the block so far? |
I believe it will. The current block is: PR is not ready yet, we're waiting for someone to pick it up and spend more time finishing it (and maybe opening another PR based on this branch, but rebased to solve conflicts). The one who picks it up needs to debug the errors, solve them, and make the tests pass. tip: |
I've started working on this PR hoping to fix the last issues and get it merged, however I seem to be stuck around the same place after re-basing. If we use the original code from this PR, 7zip will fail tests that contain any additional compression on 7z (bz, bz2 gzip, etc) this is the BadSignature error, it has the header bytes of bzip, which suggests it's being passed to the 7z decompression/unpack before it has been fully decompressed from the other algorithms. If we try the temp file creation that rar uses, nothing is written from the reader to the temp file, which is confusing since attaching lldb I see the reader has data, but it isn't copied. |
Does it look like a problem with our code or the |
I may be barking up the wrong tree on that info actually. Doing some more testing and it looks like regular 7z compression fails, due to a symlink I have setup, the file paths passed to archive/compression algorithms are different than the env:current_dir path used in |
Superseded by #555, thanks @MisileLab and others who gave input here. |
fix #164
Description
implement 7z and add .vscode and .idea to .gitignore
todo