#17 Bug in invalid number format


There is a bug in the mel2.tcl. It crashes when it try
to execute a [ expr ... ] with an improper value. When
an argument passed is, for example, 08 instead of 8, it
is interpreted as an improper octal value and the tcl
shows an error.

A possible solution is to apply the following function
to the arguments passed to each [ expr ... ]

proc strip:zero { num } {
if { [ regexp -- {^0*([1-9]*[0-9]*)$} ${num} all num
] } {
return ${num}
} else {
return 0

There are 39 [ lindex $t 3 ] that must be replaced with
[ strip:zero [ lindex $t 3 ] ]

Sorry for my bad school english :D



Bugs: #18


  • R081N

    R081N - 2005-07-25

    Logged In: YES

    The same thing happened to me. I'm not sure why because
    the script worked fine at first. If someone finds out why this
    started happening all of a sudden could you please let me

    My fix was very similar to lnx85's fix. I replaced every
    instance of:
    expr [lindex $t 3] -1
    expr [string trimleft [lindex $t 3] "0"] -1

  • Razoola

    Razoola - 2005-08-01

    Logged In: YES

    I have the same problem and tried the fix as you mention
    above but it diddent work, I get a 'invalid command
    name "strip:zero08" while executing'....

    The script is no longer working until this bug mentioned
    above is fixed for me.


  • Nobody/Anonymous

    Logged In: NO

    Just an update to say I tried the fix r081n mentions in this
    thread also and that one worked for me.


  • gulu-gulu

    gulu-gulu - 2005-08-03

    Logged In: YES

    just a crappy workaround:
    you can start the script after removing the "settings.mel"-file ..
    but then you have to login to your bot and set all the settings
    again. they all work fine till you set ".mel rotation ". after that a
    ".rehash" is impossible, but script still works..

  • Nobody/Anonymous

    Logged In: NO

    Thank you for your note. When I insert the strip-zero
    procedure and replace the [ lindex $t 3 ] code with the new
    one I get following error:

    [13:45] unable to convert date-time string "2005808T000000"
    while executing
    "clock scan "[lindex $t 4][ strip:zero [ lindex $t 3 ]
    ][lindex $t 2]T000000""
    ("1" arm line 3)
    invoked from within
    "switch -- $stamplogs {
    0 {
    foreach search [binds time] {
    if {[string compare
    [lindex $search 4] "::mel::stamptimer"] == 0} {
    (procedure "::mel::checkstamptimer" line 4)
    invoked from within
    invoked from within
    "if {[::mel::starttests]} {
    putlog $::mel::starterror
    die "Fatal error - Can not continue"
    } else {
    ::mel::logfile datestamp all
    (file "scripts/mel2.tcl" line 1114)
    invoked from within
    "source scripts/mel2.tcl"
    (file "eggdrop.conf" line 1070)

  • lnx85

    lnx85 - 2005-08-13

    Logged In: YES

    I've made an error when posting the bug-fig, sorry :P

    In the TCL you must replace all the [expr [lindex $t 3] with
    [expr [strip:zero [lindex $t 3]] because only the [lindex $t
    3] passed to each expr function is affected by the bug and
    not all [lindex $t 3]..

    Sorry for my mistake and for my bad school english :P

  • Nobody/Anonymous

    Logged In: NO

    It stopped working for me too! I have no ideia why! It was
    sudden...The scritp worked fine for months, but suddendly
    gave this error.
    It needs urgent fix...
    I'll try this Lnx85 fix now... hope it works!

  • Nobody/Anonymous

    Logged In: NO

    it works! ;D

  • Nobody/Anonymous

    Logged In: NO

    thx lnx85 after I was able to understand your school english
    your bugfix worked for me :)

  • Nobody/Anonymous

    Logged In: NO

    i thank you very much lnx85
    your bug fix works proper


  • crowman

    crowman - 2006-08-18

    Logged In: YES

    the fix by r081n worked for me.

  • Nobody/Anonymous

    Logged In: NO

    I don't know much programming. Could you provide a new mel.tcl with this patch included?

  • Nobody/Anonymous

    Coud somebody attach a file with the mel2.tcl code corrected?

  • Zangune

    Zangune - 2015-08-20

    I replaced

    expr [lindex $t 3] -1


    expr [string trimleft [lindex $t 3] "0"] -1

    and I will attach the modified file.


Log in to post a comment.