Bug 550449 - bashisms in 0yum.cron
Summary: bashisms in 0yum.cron
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: yum-cron
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Habig, Alec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-25 09:08 UTC by Ville Skyttä
Modified: 2010-03-11 07:18 UTC (History)
2 users (show)

Fixed In Version: yum-cron-0.9.2-1.fc12
Clone Of:
Environment:
Last Closed: 2010-03-11 07:18:50 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Ville Skyttä 2009-12-25 09:08:44 UTC
0yum.cron is a /bin/sh script, but contains a few bashisms that will likely break in the unlikely even if someone manages to change /bin/sh to be something other than bash:

$ checkbashisms -f 0yum.cron
possible bashism in 0yum.cron line 15 (should be '.', not 'source'):
  source /etc/sysconfig/yum-cron
possible bashism in 0yum.cron line 23 (${parm/?/pat[/str]}):
if [ "${DAYS_OF_WEEK/$dow/}" == "${DAYS_OF_WEEK}" ]; then
possible bashism in 0yum.cron line 23 (should be 'b = a'):
if [ "${DAYS_OF_WEEK/$dow/}" == "${DAYS_OF_WEEK}" ]; then
possible bashism in 0yum.cron line 29 (should be 'b = a'):
if [ "$DOWNLOAD_ONLY" == "yes" ]; then
possible bashism in 0yum.cron line 61 (should be >word 2>&1):
    if ! kill -0 $OTHERPID &>/dev/null; then
possible bashism in 0yum.cron line 88 (${parm/?/pat[/str]}):
  if [ ! "${CLEANDAY/$dow/}" == "${CLEANDAY}" ]; then
possible bashism in 0yum.cron line 88 (should be 'b = a'):
  if [ ! "${CLEANDAY/$dow/}" == "${CLEANDAY}" ]; then
possible bashism in 0yum.cron line 93 (should be 'b = a'):
  if [ "$CHECK_ONLY" == "yes" ]; then
possible bashism in 0yum.cron line 99 (should be 'b = a'):
           if [ "$DOWNLOAD_ONLY" == "yes" ]; then
possible bashism in 0yum.cron line 107 (should be 'b = a'):
  elif [ "$CHECK_FIRST" == "yes" ]; then

An easy fix would be to just make the shebang point to /bin/bash.

Comment 1 Habig, Alec 2009-12-30 17:24:12 UTC
Good catch, will change the shebang.  Possibly the requires too - is bash part of the default requires set?

Comment 2 Ville Skyttä 2009-12-30 19:06:16 UTC
Yes, it is, and /bin/sh is part of the bash package as well.  The dependency on the shebang interpreter should be automatically added by rpmbuild so there should be no need to do anything about it in the specfile.

Comment 3 Fedora Update System 2010-02-10 21:49:51 UTC
yum-cron-0.9.2-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/yum-cron-0.9.2-1.fc12

Comment 4 Habig, Alec 2010-02-10 21:51:30 UTC
Ville - your simple changes are in the above testing update.  If you're happy with it I'll push it to updates.

Comment 5 Fedora Update System 2010-02-12 04:45:12 UTC
yum-cron-0.9.2-1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update yum-cron'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2010-1794

Comment 6 Fedora Update System 2010-03-11 07:18:39 UTC
yum-cron-0.9.2-1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, 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.