llvm-objcopy crashes with unreachable error when (de)compression requested without selected value available
llvm-objcopy crashes due to calling llvm_unreachable when compression::compress or compression::decompress is called without the selected compression type being installed on the machine.
The problem is that the tool doesn't call compression::getReasonIfUnsupported before compression::compress or compression::decompress. The correct thing to do is to call that first, then check the result and either report an Error based on the result or continuing and (de)compress as requested.
Discovered while triaging #197813.
I'll label this with good first issue as it's a trivial fix (but I don't have the personal time to fix it and put a PR up myself). There should be two tests for it. The first test should test that the correct error is emitted for zlib compression and decompression and the second the same for zstd. Each test should only run if zlib/zstd is NOT enabled on the target (i.e. something like UNSUPPORTED: zlib, but check other examples for REQUIRES/UNSUPPORTED tags to see the exact way of writing that).
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally. Be aware that LLVM's AI policy forbids the use of AI tools to fix good first issues since it squanders a learning opportunity. Using LLMs to search and learn is permitted, since the goal is learning.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: James Henderson (jh7370)
The problem is that the tool doesn't call compression::getReasonIfUnsupported before compression::compress or compression::decompress. The correct thing to do is to call that first, then check the result and either report an Error based on the result or continuing and (de)compress as requested.
Discovered while triaging #197813.
I'll label this with good first issue as it's a trivial fix (but I don't have the personal time to fix it and put a PR up myself). There should be two tests for it. The first test should test that the correct error is emitted for zlib compression and decompression and the second the same for zstd. Each test should only run if zlib/zstd is NOT enabled on the target (i.e. something like UNSUPPORTED: zlib, but check other examples for REQUIRES/UNSUPPORTED tags to see the exact way of writing that).
@llvm/issue-subscribers-tools-llvm-objcopy-strip
Author: James Henderson (jh7370)
The problem is that the tool doesn't call compression::getReasonIfUnsupported before compression::compress or compression::decompress. The correct thing to do is to call that first, then check the result and either report an Error based on the result or continuing and (de)compress as requested.
Discovered while triaging #197813.
I'll label this with good first issue as it's a trivial fix (but I don't have the personal time to fix it and put a PR up myself). There should be two tests for it. The first test should test that the correct error is emitted for zlib compression and decompression and the second the same for zstd. Each test should only run if zlib/zstd is NOT enabled on the target (i.e. something like UNSUPPORTED: zlib, but check other examples for REQUIRES/UNSUPPORTED tags to see the exact way of writing that).
Opened #197888.
I'd like to work on this issue. I’ll take a look and submit a PR if I can reproduce and fix it.
I'd like to work on this issue. I’ll take a look and submit a PR if I can reproduce and fix it.
Hi @syhhyl, you're welcome to take a look, but @moaedy has posted a PR already (see their comment immediately above yours). I am waiting for response from them to confirm whether they have complied with the "good first issue" rules, but if they don't respond in the next day or two, then I'd be happy for somebody else to take a look. Please make sure to read the bot-posted instructions above in this issue.
Thanks for the clarification. I’ll wait and see whether the current PR moves forward. In the meantime, I’ll read through the bot instructions and take a closer look at the relevant code/tests so I’m ready in case the issue becomes available again.
@moaedy Hi, are you still working on this?
Thanks for the clarification. I’ll wait and see whether the current PR moves forward. In the meantime, I’ll read through the bot instructions and take a closer look at the relevant code/tests so I’m ready in case the issue becomes available again.
Hi @syhhyl, due to AI policy violations and lack of communication, I've closed @moaedy's PR. Feel free to work on the PR, making sure to adhere to the AI Policy in particular (which prohibits using AI to fix good first issue tickets like this).
@moaedy Hi, are you still working on this?
@jjppp, as noted, @syhhyl has requested to work on this. If they don't respond in the next week to confirm that they are, you are welcome to try to resolve it yourself (again, keeping in mind the AI Policy and other LLVM rules).
Thanks for the clarification. I’ll wait and see whether the current PR moves forward. In the meantime, I’ll read through the bot instructions and take a closer look at the relevant code/tests so I’m ready in case the issue becomes available again.
Hi @syhhyl, due to AI policy violations and lack of communication, I've closed @moaedy's PR. Feel free to work on the PR, making sure to adhere to the AI Policy in particular (which prohibits using AI to fix good first issue tickets like this).
@moaedy Hi, are you still working on this?
@jjppp, as noted, @syhhyl has requested to work on this. If they don't respond in the next week to confirm that they are, you are welcome to try to resolve it yourself (again, keeping in mind the AI Policy and other LLVM rules).
@jh7370 Thanks for assigning this to me. Unfortunately I don't have enough time to work on it properly at the moment, so please feel free to reassign it to someone else.
@jjppp, I've reassigned this to you to work on. Please let me know if you choose not to, so that it can be unassigned and someone else can work on the issue.