RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1577161 - dubious shell logic in macros.pesign, kernel rpmbuild fails for non-bash /bin/sh
Summary: dubious shell logic in macros.pesign, kernel rpmbuild fails for non-bash /bin/sh
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pesign
Version: 7.7-Alt
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Jones
QA Contact: Erico Nunes
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-11 11:16 UTC by Petr Benes
Modified: 2021-02-15 07:38 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-15 07:38:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Petr Benes 2018-05-11 11:16:07 UTC
When testing whether kernel could be build from its SRPM if one sets
/bin/sh to ksh I've found that it doesn't work.

The process ends up with:

+ mkdir -p
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/usr/lib/d
ebug/boot
+ mkdir -p
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/usr/lib/d
ebug/boot
+ mkdir -p
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/boot
+ install -m 644 .config
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/boot/conf
ig-4.14.32-1.el7uek.aarch64.debug
+ install -m 644 System.map
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/boot/Syst
em.map-4.14.32-1.el7uek.aarch64.debug
+ touch
/home/builder/rpmbuild/BUILDROOT/kernel-uek-4.14.32-1.el7uek.aarch64/boot/init
ramfs-4.14.32-1.el7uek.aarch64.debug.img
+ [ -f arch/arm64/boot/zImage.stub ]
+ [ -x /usr/bin/pesign ]
+ [ aarch64 '==' x86_64 -o aarch64 '==' aarch64 ]
+ [ 07 -ge 7 -a -f /usr/bin/rpm-sign ]
+ [ -S /var/run/pesign/socket ]
+ /usr/bin/pesign -c 'Oracle Linux Test Certificate' -i arch/arm64/boot/Image
-o arch/arm64/boot/Image.signed -s
+ [ ! -s -o arch/arm64/boot/Image.signed ]
+ [ -e arch/arm64/boot/Image.signed ]
+ rm -f arch/arm64/boot/Image.signed
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.2u96Jp (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.2u96Jp (%build)

Inspecting where the construct [ ! -s -o arch/arm64/boot/Image.signed ] comes
from points to /etc/rpm/macros.pesign and this snippet of the macro's code:

  if [ ! -s %{-o} ]; then \
    if [ -e "%{-o*}" ]; then \
      rm -f %{-o*} \
    fi \
    exit 1 \
  fi ;

Perhaps the author wanted to verify there is a non-zero length output file.
Otherwise remove it if it exists with zero length and fail. Unfortunately
%{-o} expands to the full flag not only the value. That is it produced
[ ! -s -o arch/arm64/boot/Image.signed ] that is wrong and moreover behaves
differently in bash and ksh:

[builder@g0 ~]$ echo "xxxx" > /tmp/a
[builder@g0 ~]$ [ ! -s -o /tmp/a ] ; echo $?
1
[builder@g0 ~]$ ksh
$ [ ! -s -o /tmp/a ] ; echo $?
0

The correction is to use "%{-o*}".

Comment 4 RHEL Program Management 2021-02-15 07:38:50 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


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