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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux