#17 Bug in invalid number format

open
nobody
None
5
2005-07-04
2005-07-04
lnx85
No

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

    Lnx85

Discussion

  • R081N
    R081N
    2005-07-25

    Logged In: YES
    user_id=1268649

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

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

     
  • Razoola
    Razoola
    2005-08-01

    Logged In: YES
    user_id=1181869

    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.

    Raz

     
  • Logged In: NO

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

    Raz

     
  • gulu-gulu
    gulu-gulu
    2005-08-03

    Logged In: YES
    user_id=1106665

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

     
  • 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} {
    unbind..."
    (procedure "::mel::checkstamptimer" line 4)
    invoked from within
    "::mel::checkstamptimer"
    invoked from within
    "if {[::mel::starttests]} {
    putlog $::mel::starterror
    die "Fatal error - Can not continue"
    } else {
    ::mel::arrayinit
    ::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
    user_id=1245390

    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

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

     
  • Logged In: NO

    it works! ;D

     
  • Logged In: NO

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

     
  • Logged In: NO

    i thank you very much lnx85
    your bug fix works proper

    Gomorrha
    -----
    gomorrha@schwarzes-leipzig.com
    www.schwarzes-leipzig.net

     
  • crowman
    crowman
    2006-08-18

    Logged In: YES
    user_id=848992

    the fix by r081n worked for me.
    Thanks

     
  • Logged In: NO

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

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