Bug 1028400 - /etc/cron.daily/prelink : syntax error in PRELINK_NONRPM_CHECK_INTERVAL handling
/etc/cron.daily/prelink : syntax error in PRELINK_NONRPM_CHECK_INTERVAL handling
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: prelink (Show other bugs)
6.4
x86_64 Linux
unspecified Severity low
: rc
: ---
Assigned To: Jakub Jelinek
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-08 06:13 EST by Karsten Weiss
Modified: 2013-11-11 14:47 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-11 14:47:42 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
suggested fix (528 bytes, patch)
2013-11-08 06:13 EST, Karsten Weiss
no flags Details | Diff

  None (edit)
Description Karsten Weiss 2013-11-08 06:13:25 EST
Created attachment 821523 [details]
suggested fix

Description of problem:

I didn't look too deep into this but doesn't the following "find" line
in /etc/cron.daily/prelink look suspicious? It's seems as a line is missing.

   [ "`find /var/lib/prelink/quick -mtime -${PRELINK_NONRPM_CHECK_INTERVAL:-7} 2>/dev/null`" \
     -a -f /var/lib/rpm/Packages \
     -a /var/lib/rpm/Packages -ot /var/lib/prelink/quick ] && exit 0

The bourne shell static analyzer "shellcheck" also complains:

# shellcheck /etc/cron.daily/prelink

In /etc/cron.daily/prelink line 27:
elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
^-- The mentioned parser error was in this elif clause.


In /etc/cron.daily/prelink line 33:
  [ "`find /var/lib/prelink/quick -mtime -${PRELINK_NONRPM_CHECK_INTERVAL:-7} 2>/dev/null`" \
  ^-- Couldn't parse this test expression.


In /etc/cron.daily/prelink line 34:
    -a -f /var/lib/rpm/Packages \
          ^-- Unexpected "/". Fix any mentioned problems and try again.

Version-Release number of selected component (if applicable):

prelink-0.4.6-3.1.el6_4.x86_64

How reproducible:

Always

Steps to Reproduce:
1. -
2. -
3. -

Actual results:

- 

Expected results:

- 

Additional info:

I've attached a patch suggestion.

(The same issue can be found in RHEL 5.10.)
Comment 2 Karsten Weiss 2013-11-08 06:50:43 EST
Well, adding an explicit "-n" in front of the string makes "shellcheck" happy, too.

  [ -n "`find /var/lib/misc/prelink.quick -mtime -${PRELINK_NONRPM_CHECK_INTERVAL:-7} 2>/dev/null`" \

Sorry, I guess this was a false alarm.
Comment 3 Jakub Jelinek 2013-11-08 07:18:43 EST
Man page for test says:
STRING equivalent to -n STRING
and given that find shouldn't print anything other than
/var/lib/misc/prelink.quick or empty string and thus there are no - or ! characters in there, I think the script is fine.
Comment 4 Karsten Weiss 2013-11-08 08:29:04 EST
Yes, I agree. Sorry!

I'll file a shellcheck bug instead.

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