Bug 1028400 - /etc/cron.daily/prelink : syntax error in PRELINK_NONRPM_CHECK_INTERVAL handling
Summary: /etc/cron.daily/prelink : syntax error in PRELINK_NONRPM_CHECK_INTERVAL handling
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: prelink
Version: 6.4
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-08 11:13 UTC by Karsten Weiss
Modified: 2013-11-11 19:47 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-11 19:47:42 UTC
Target Upstream Version:


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

Description Karsten Weiss 2013-11-08 11:13:25 UTC
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 11:50:43 UTC
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 12:18:43 UTC
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 13:29:04 UTC
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.