Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1923499
Summary: | rkdeveloptool: FTBFS in Fedora rawhide/f34 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Fedora Release Engineering <releng> | ||||||||
Component: | rkdeveloptool | Assignee: | Peter Robinson <pbrobinson> | ||||||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||||
Severity: | unspecified | Docs Contact: | |||||||||
Priority: | unspecified | ||||||||||
Version: | 34 | CC: | law, msebor, pbrobinson | ||||||||
Target Milestone: | --- | ||||||||||
Target Release: | --- | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Whiteboard: | |||||||||||
Fixed In Version: | rkdeveloptool-1.32-1.fc34 rkdeveloptool-1.32-1.fc33 | Doc Type: | If docs needed, set a value | ||||||||
Doc Text: | Story Points: | --- | |||||||||
Clone Of: | Environment: | ||||||||||
Last Closed: | 2021-06-27 01:07:41 UTC | Type: | --- | ||||||||
Regression: | --- | Mount Type: | --- | ||||||||
Documentation: | --- | CRM: | |||||||||
Verified Versions: | Category: | --- | |||||||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
Cloudforms Team: | --- | Target Upstream Version: | |||||||||
Embargoed: | |||||||||||
Bug Depends On: | |||||||||||
Bug Blocks: | 1868278 | ||||||||||
Attachments: |
|
Description
Fedora Release Engineering
2021-02-01 17:00:47 UTC
Created attachment 1753498 [details]
build.log
Created attachment 1753499 [details]
root.log
file root.log too big, will only attach last 32768 bytes
Created attachment 1753500 [details]
state.log
This is (most likely) a valid warning: main.cpp: In function 'mergeBoot() [clone .part.0]': main.cpp:1542:43: error: '%s' directive output may be truncated writing up to 541 bytes into a region of size 5 [-Werror=format-truncation=] 1542 | snprintf(buffer, sizeof(buffer), "%s", chip); | ^~ ...... 1583 | chipType = convertChipType(chip + 2); static inline uint32_t convertChipType(const char* chip) { char buffer[5]; memset(buffer, 0, sizeof(buffer)); snprintf(buffer, sizeof(buffer), "%s", chip); return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3]; } The size of buffer is 5 but the chip pointer points to gOpts.chip which (I'm guessing based on the warning) is an array with size 542. If something guarantees that gOpts.chip is at most 4 bytes long then asserting that precondition before the snprintf call should avoid the warning. Otherwise, if gOpts.chip can be longer than the call will truncate the output, which is what the warning is pointing out. Truncation is usually not expected/intended and should be handled somehow by testing the return value for it and taking some action. That aside, using snprintf isn't the most efficient way to copy a string. strcpy or strncpy will do the same thing more efficiently. In this case, though, where all the code does is just add up the byte values, copying it is unnecessary entirely. Simply adding up the shifted non-zero leading chip values would be a better way to do it. (In reply to Martin Sebor from comment #4) > This is (most likely) a valid warning: Yes, I had come to the same conclusion. > main.cpp: In function 'mergeBoot() [clone .part.0]': > main.cpp:1542:43: error: '%s' directive output may be truncated writing up > to 541 bytes into a region of size 5 [-Werror=format-truncation=] > 1542 | snprintf(buffer, sizeof(buffer), "%s", chip); > | ^~ > ...... > 1583 | chipType = convertChipType(chip + 2); > > > static inline uint32_t convertChipType(const char* chip) { > char buffer[5]; > memset(buffer, 0, sizeof(buffer)); > snprintf(buffer, sizeof(buffer), "%s", chip); > return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3]; > } > > The size of buffer is 5 but the chip pointer points to gOpts.chip which (I'm > guessing based on the warning) is an array with size 542. If something > guarantees that gOpts.chip is at most 4 bytes long then asserting that > precondition before the snprintf call should avoid the warning. Otherwise, > if gOpts.chip can be longer than the call will truncate the output, which is > what the warning is pointing out. Truncation is usually not > expected/intended and should be handled somehow by testing the return value > for it and taking some action. > > That aside, using snprintf isn't the most efficient way to copy a string. > strcpy or strncpy will do the same thing more efficiently. In this case, > though, where all the code does is just add up the byte values, copying it > is unnecessary entirely. Simply adding up the shifted non-zero leading chip > values would be a better way to do it. Any chance you could put together a patch/PR? This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle. Changing version to 34. Here's what I would consider replacing convertChipType with (untested): static inline uint32_t convertChipType(const char* chip) { const unsigned char *p = (const unsigned char*)chip; uint32_t val = p[0] << 24; if (p[0]) { val |= p[1] << 16; if (p[1]) { val |= p[2] << 8; if (p[2]) val |= p[3]; } } return val; } Dear Maintainer, your package has an open Fails To Build From Source bug for Fedora 34. Action is required from you. If you can fix your package to build, perform a build in koji, and either create an update in bodhi, or close this bug without creating an update, if updating is not appropriate [1]. If you are working on a fix, set the status to ASSIGNED to acknowledge this. If you have already fixed this issue, please close this Bugzilla report. Following the policy for such packages [2], your package will be orphaned if this bug remains in NEW state more than 8 weeks (not sooner than 2021-03-29). A week before the mass branching of Fedora 35 according to the schedule [3], any packages not successfully rebuilt at least on Fedora 33 will be retired regardless of the status of this bug. [1] https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/ [2] https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/ [3] https://fedorapeople.org/groups/schedule/f-35/f-35-key-tasks.html Dear Maintainer, your package has an open Fails To Build From Source bug for Fedora 34. Action is required from you. If you can fix your package to build, perform a build in koji, and either create an update in bodhi, or close this bug without creating an update, if updating is not appropriate [1]. If you are working on a fix, set the status to ASSIGNED to acknowledge this. If you have already fixed this issue, please close this Bugzilla report. Following the policy for such packages [2], your package will be orphaned if this bug remains in NEW state more than 8 weeks (not sooner than 2021-03-29). A week before the mass branching of Fedora 35 according to the schedule [3], any packages not successfully rebuilt at least on Fedora 33 will be retired regardless of the status of this bug. [1] https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/ [2] https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/ [3] https://fedorapeople.org/groups/schedule/f-35/f-35-key-tasks.html FEDORA-2021-ed5a57076a has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-ed5a57076a FEDORA-2021-833437ed4d has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-833437ed4d FEDORA-2021-ed5a57076a has been pushed to the Fedora 34 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-ed5a57076a` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-ed5a57076a See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2021-833437ed4d has been pushed to the Fedora 33 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-833437ed4d` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-833437ed4d See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2021-ed5a57076a has been pushed to the Fedora 34 stable repository. If problem still persists, please make note of it in this bug report. FEDORA-2021-833437ed4d has been pushed to the Fedora 33 stable repository. If problem still persists, please make note of it in this bug report. |