Bug in /etc/cron.d/mlocate.cron or am I crazy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I can't believe this is a real bug. I'm submit it to bugzilla. It's in F10, 11
and 12. I'd be curious to know just how old this bug is.

Contents of mlocate.cron is:

#!/bin/sh
nodevs=$(< /proc/filesystems awk '$1 == "nodev" { print $2 }')
renice +19 -p $$ >/dev/null 2>&1
ionice -c2 -n7 -p $$ >/dev/null 2>&1
/usr/bin/updatedb -f "$nodevs"

Unless I'm going cuckoo, I'm guessing that the intent was for line two to be:

nodevs=$(< /proc/filesystems | awk '$1 == "nodev" { print $2 }')

and if we're going to go that route, why not go the full banana

nodevs=$(awk '$1 == "nodev" { print $2 }' < /proc/filesystems)

In fact, this is still sort of screwed up. How about:

#!/bin/bash
get_nodevs()
{
    local line
    # Return ret as a global
    while read line     # Read each line from /proc/filesystems
    do
    if [[ "$line" =~ $'^nodev\t(.*)$' ]]        # Do a real regex
    then
        (( ${#BASH_REMATCH[@]} == 2 )) && ret="$ret ${BASH_REMATCH[1]}"
    fi
    done < /proc/filesystems
    ret=${ret:1} # Lop off the leading space.
}
ret=''
get_nodevs
nodevs="$ret"
{
renice +19 -p $$
ionice -c2 -n7 -p $$
} > /dev/null 2>&1
/usr/bin/updatedb -f "$nodevs"

Note that as it was written, it did not properly take into account the empty
first token.

If I'm right that this is a bug, then I don't expect the Nobel Prize, but
surely, a T-shirt should accompany a discovery of a bug of this magnitude. How
long has this bug been in existence?

Also, I don't know about the rest of you guys, but this script used to hang on
me on a regular basis. I'll look and see awk just hung. This bypasses awk or
any pipe at all and will never hang.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux