Trivial pursuits (was Re: [TriLUG] detecting kernel major/minor versions)
Rick DeNatale
rick.denatale at gmail.com
Fri Jun 30 14:46:10 EDT 2006
On 6/30/06, Aaron S. Joyner <aaron at joyner.ws> wrote:
> Ah, fun with regexs. Can anyone come up with a pattern that looks
> remotely like a version number that the above perl or sed won't match?
Of course that's the rub isn't it? Sometimes coming up with the regex
isn't nearly as hard as figuring out what an underspecified function
like uname -r might through at you:
rick at bill:~$ uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
not much in the way of help here as to "what you will get" as Forrest
Gump might say. Man uname gives basically the same info with more
whitespace.
Oh wait! The man page does say that the complete docs are in a
texinfo document, frabjous day, let's try info uname
Hmm, looks like a single node info doc with exactly the same contents
as man, even the note about the more complete texinfo doc at the
bottom, I guess complete just means a different way of scrolling. <G>
I tried googling around for things like "kernel version format" but
only found discussions of how it varied. My systems are Ubuntu and
seem to conform to standard Debian practice, my googling seemed to
indicate that BSD was similar but I've got no direct experience there.
Andy Tannenbaum's* famous quote "the nice thing about standards is
that you've got so many to choose from." covers one end of the
problem, the fact that many "standards" don't really standardize
little details is another.
I guess that this is just life in the "real world"(tm)
So rather than trying to dream up fanciful version strings to break
Aaron's regex, we might talk about use cases based on different kernel
version strings we've seen, kind of a "The Varieties of uname -r
Experience", with apologies to William James.
In some ways it's pretty much the same thing, but I'm from the "design
iteratively, do the simplest thing which can work, then fix it
incrementally when it doesn't" camp.
* I've always thought that this was a Bill Joy quote, but I'm going to
trust google and wikipedia on this. It's amazing what little side
tid-bits you pick up when you research non-related stuff**.
** Another of these interesting tidbits is that I ran across S13n to
mean standarization, Now I've known about I18n as computer techie
lingo for internationalization, so I'm familiar with the form. It
seems that S13n comes not from CompSci but from medicine though,
begging the questions:
1) What's the name for the form of abbreviation in I18n or S13n?
2) Where did it first crop up?
--
Rick DeNatale
IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/
Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/
More information about the TriLUG
mailing list