Bug 1028400

Summary: /etc/cron.daily/prelink : syntax error in PRELINK_NONRPM_CHECK_INTERVAL handling
Product: Red Hat Enterprise Linux 6 Reporter: Karsten Weiss <knweiss>
Component: prelinkAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: qe-baseos-tools-bugs
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.4CC: mfranc, mpolacek
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-11 19:47:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
suggested fix none

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.