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

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

 



On Fri, Nov 27, 2009 at 10:55:17PM -0500, Steven W. Orr wrote:
> 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 }')
[...]
> 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 }')

Have you tried it? The code in the file isn't an error; it's just very
obscure bash syntax. That is, $(< /some/file ) is obscure, and $(<
/some/file filter-command ) is *really* obscure. Doesn't seem to be
documented in the bash manual -- but it works. And putting a | in the middle
there doesn't.

For clarity alone, though, I'd argue that it should be changed to:

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

but I don't see what your longer function really buys, and ${#BASH_REMATCH}
doesn't exactly win in readability.

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

Well, in the unlikely event that someone names a filesystem "nodev", maybe
that's worthwhile. :) But I think 

 nodevs=$(awk '/^nodev\t/ { print $2 }' </proc/filesystems)

Would do just as well, yeah?

> 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.

I've never seen that, but if you are, I expect you're just as likely to get
hangs with the "done < /proc/filesystem".


-- 
Matthew Miller <mattdm@xxxxxxxxxx>
Senior Systems Architect 
Cyberinfrastructure Labs / Instructional & Research Computing
Computing & Information Technology 
Harvard School of Engineering & Applied Sciences

-- 
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