| Hi,
| 
| In message "[ruby-talk:01936] BUG???"
|     on 00/03/16, "David Douthitt" <DDouthitt / cuna.com> writes:
| 
| |# ./others.rb sys1 sys2 sys3 sys4 sys5 sys6 | less
| |./others.rb:29: [BUG] obj_free() called for broken object
| |    Mar 12 17:19:36 172.16.17.31  printer: offline or intervention needed
| |    Mar 12 17:19:36 172.16.17.31  printer: paper out
| |    Mar 12 17:20:10 172.16.17.31  printer: error cleared
| |    Mar 12 18:31:10 172.16.17.31  printer: toner/ink low
| |Abort
| |#
| 
| Sorry, I can't reproduce your problem.
| Could you show me your `ruby -v'?

I'll do better than that :-)

(But "ruby -v" is in the middle...)

[...cut here...]

# ./others.rb sys1 sys2 sys3 sys4
    Mar 12 04:03:1  sys5 Mar 12 03:56:30
    Mar 12 04:33:0  sys5 Mar 12 04:26:27
    Mar 12 05:03:1  sys5 Mar 12 04:56:32
    Mar 12 05:33:0  sys5 Mar 12 05:26:29
    Mar 12 06:03:1  sys5 Mar 12 05:56:34
    Mar 12 06:33:0  sys5 Mar 12 06:26:29
    Mar 12 07:03:1  sys5 Mar 12 06:56:34
    Mar 12 07:33:1  sys5 Mar 12 07:26:31
    Mar 12 08:03:1  sys5 Mar 12 07:56:36
    Mar 12 08:33:1  sys5 Mar 12 08:26:31
    Mar 12 09:03:1  sys5 Mar 12 08:56:37
    Mar 12 09:33:1  sys5 Mar 12 09:26:33
    Mar 12 10:03:1  sys5 Mar 12 09:56:38
    Mar 12 10:33:1  sys5 Mar 12 10:26:35
    Mar 12 11:03:2  sys5 Mar 12 10:56:40
    Mar 12 11:33:1  sys5 Mar 12 11:26:35
    Mar 12 12:03:2  sys5 Mar 12 11:56:40
    Mar 12 12:33:1  sys5 Mar 12 12:26:37
    Mar 12 13:03:2  sys5 Mar 12 12:56:42
/others.rb:20:in `systemName': Interrupt
        from ./others.rb:27
        from ./others.rb:24:in `each'
        from ./others.rb:24
# ./others.rb sys1 sys2 sys3 sys4 sys5 sys6
    Mar 12 17:19:36 172.16.17.31  printer: offline or intervention needed
    Mar 12 17:19:36 172.16.17.31  printer: paper out
    Mar 12 17:20:10 172.16.17.31  printer: error cleared
    Mar 12 18:31:10 172.16.17.31  printer: toner/ink low
./others.rb:29: [BUG] obj_free() called for broken object
Abort
# uname -a
Linux sysadm.cuna.com 2.2.9-27mdk #1 Mon Jun 14 16:44:05 CEST 1999 i586 unknown
# rpm -qi ruby
Name        : ruby                         Relocations: /usr
Version     : 1.4.3                             Vendor: MandrakeSoft
Release     : 3mdk                          Build Date: Tue Feb 15 19:47:28 2000
Install date: Thu Mar  2 17:00:27 2000      Build Host: kenobi.mandrakesoft.com
Group       : Development/Languages         Source RPM: ruby-1.4.3-3mdk.src.rpm
Size        : 2313282                          License: GPL
Packager    : Atsushi Yamagata <yamagata / plathome.co.jp>
URL         : http://www.netlab.co.jp/ruby/jp/
Summary     : Object Oriented Script Language
Description :
Ruby is the interpreted scripting language for quick and
easy object-oriented programming.  It has many features to
process text files and to do system management tasks (as in
Perl).  It is simple, straight-forward, and extensible.
# ruby -v
ruby 1.4.3 (1999-12-08) [i586-linux-gnu]
# cat others.rb
#!/usr/bin/ruby

# Interesting problem reached here...
#
# ARGV is [ "arg1", "arg2", "arg3" ]
# results from a scan are [ [ "str1" ] ]
#
# Thus, ARGV.each is "arg1" ... "arg2" ... "arg3" ...
# scanXX.each is [ "str1" ] ... [ "str2 ] ...
#
# Thus ARGV[0] is "arg1" ; scanXX[0] is [ "str1" ] ;
# and scanXX[0][0] is "str1"
#
# This explains a lot.

systems = Array.new

class String
   def systemName
      self.scan("^... .. ..:..:.. ([^ ]*)")
   end
end

File.open("/var/log/messages").each { |line|
   line.chomp!
#  sys = line.scan("^... .. ..:..:.. ([^ ]*)")
   sys = line.systemName

   systems = systems | sys

   if not ARGV.include?(sys[0][0])
      print("    ", line, "\n")
   end
   }

# (systems.sort!).each { |sys|
#    print("   ", sys, "\n")
#    }

#

[...snip...]

I thought that first bit was interesting - a run that was interrupted
with control-C (SIGINT) had no such "Abort" or "[BUG]" message.

I might note that I am also working in ruby under HP-UX ... so don't
always assume I'm using Linux :-)

Is ruby available for Unixware as a Unixware package?  I found
an RPM for Linux (obviously) and a Software Depot for HP-UX.
Is there a package for FreeBSD? (just curious)