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 - rkdeveloptool: FTBFS in Fedora rawhide/f34
Summary: rkdeveloptool: FTBFS in Fedora rawhide/f34
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rkdeveloptool
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F34FTBFS
TreeView+ depends on / blocked
 
Reported: 2021-02-01 17:00 UTC by Fedora Release Engineering
Modified: 2021-06-27 02:00 UTC (History)
3 users (show)

Fixed In Version: rkdeveloptool-1.32-1.fc34 rkdeveloptool-1.32-1.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-27 01:07:41 UTC
Type: ---


Attachments (Terms of Use)
build.log (18.05 KB, text/plain)
2021-02-01 17:00 UTC, Fedora Release Engineering
no flags Details
root.log (32.00 KB, text/plain)
2021-02-01 17:00 UTC, Fedora Release Engineering
no flags Details
state.log (987 bytes, text/plain)
2021-02-01 17:00 UTC, Fedora Release Engineering
no flags Details

Description Fedora Release Engineering 2021-02-01 17:00:47 UTC
rkdeveloptool failed to build from source in Fedora rawhide/f34

https://koji.fedoraproject.org/koji/taskinfo?taskID=60911163


For details on the mass rebuild see:

https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Please fix rkdeveloptool at your earliest convenience and set the bug's status to
ASSIGNED when you start fixing it. If the bug remains in NEW state for 8 weeks,
rkdeveloptool will be orphaned. Before branching of Fedora 35,
rkdeveloptool will be retired, if it still fails to build.

For more details on the FTBFS policy, please visit:
https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/

Comment 1 Fedora Release Engineering 2021-02-01 17:00:49 UTC
Created attachment 1753498 [details]
build.log

Comment 2 Fedora Release Engineering 2021-02-01 17:00:50 UTC
Created attachment 1753499 [details]
root.log

file root.log too big, will only attach last 32768 bytes

Comment 3 Fedora Release Engineering 2021-02-01 17:00:51 UTC
Created attachment 1753500 [details]
state.log

Comment 4 Martin Sebor 2021-02-09 01:21:15 UTC
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.

Comment 5 Peter Robinson 2021-02-09 10:24:23 UTC
(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?

Comment 6 Ben Cotton 2021-02-09 15:54:23 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 7 Martin Sebor 2021-02-09 16:04:18 UTC
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;
}

Comment 8 Fedora Release Engineering 2021-02-14 04:25:51 UTC
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

Comment 9 Fedora Release Engineering 2021-02-14 04:25:52 UTC
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

Comment 10 Fedora Update System 2021-06-18 17:12:34 UTC
FEDORA-2021-ed5a57076a has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-ed5a57076a

Comment 11 Fedora Update System 2021-06-18 17:12:39 UTC
FEDORA-2021-833437ed4d has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-833437ed4d

Comment 12 Fedora Update System 2021-06-19 01:11:13 UTC
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.

Comment 13 Fedora Update System 2021-06-19 01:54:13 UTC
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.

Comment 14 Fedora Update System 2021-06-27 01:07:41 UTC
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.

Comment 15 Fedora Update System 2021-06-27 02:00:32 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.