Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-19
02:47 • Ticket [218285ffff] Package Require error status still Closed with 3 other c... artifact: fb4841e285 user: dgp
2000-10-26
08:18 • Closed ticket [218285ffff]. artifact: 246836e749 user: welch
00:55 • New ticket [218285ffff]. artifact: 0ed484229c user: nobody

Package Require error

Closed / Fixed218285ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:55:34
OriginalBugID: 3445 Bug
Version: 8.2
SubmitDate: '1999-11-05'
LastModified: '1999-11-10'
Severity: CRIT
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Windows NT
OSVersion: 4.0
FixedDate: '2000-10-25'
ClosedDate: '1999-11-10'


Name:

Charles Adams



ReproducibleScript:

I have 2 applications.  One is a calling application that calls a second

application.  The second or called application has a package require

statement to access a file.  When the second or called application is

executed alone the package require works fine.  However when the primary

application calls the secondary application the package require fails.



The file is definately in the correct location.



Please Advise



Charles Adams

    

    

    ###  Start of the procedure

    

    

    #  We need the TCL-DP package to be able

    #  to send binary data on the UDP socket

    

    package require dp

    

    

    #  Get the passed parameters and set

    #  up the variables used in the message

    #  packet later

    

    upvar $p parms

    

    set tec_addr $parms("tec_addr")

    set tec_port $parms("tec_port")

    

    set class       $parms("class")

    

    set p    $parms("source")

    set source      "source='$p'"

    

    set p     $parms("sub_source")

    set sub_source  "sub_source='$p'"

    

    set p           $parms("severity")

    set severity    "severity=$p"

    

    set p           $parms("message")

    set message     "msg='$p'"

    

    set p           $parms("origin")

    set origin      "origin=$p"

    

    set p           $parms("hostname")

    set hostname    "hostname=$p"

    

    

    #  Set the return code (rc) to 0 (OK)

    #  will reset it to something else if

    #  we get any errors.

    

    set rc 0

    

    #  If the passed parameter "tec_port" is zero,

    #  that means the TEC message port is not known

    #  and must be requested from port 111

    

    if { $tec_port == 0 } {

    

    

    #  Format a 54 byte binary packet with

    #  the portmapper request

    

    set id       12345

    set type     0    ;# type 0 means RPC call

    set rpcvers  2

    set prog     0x0186a0

    set vers     2

    set proc     3

    

    set    rpcmess  [binary format "I" $id]

    append rpcmess  [binary format "I" $type]

    append rpcmess  [binary format "I" $rpcvers]

    append rpcmess  [binary format "I" $prog]

    append rpcmess  [binary format "I" $vers]

    append rpcmess  [binary format "I" $proc]

    

    set zero     0

    

    append rpcmess  [binary format "I" $zero]

    append rpcmess  [binary format "I" $zero]

    append rpcmess  [binary format "I" $zero]

    append rpcmess  [binary format "I" $zero]

    

    set prognum  100033057

    set tec_ver  1

    set proto    6

    

    append rpcmess  [binary format "I" $prognum]

    append rpcmess  [binary format "I" $tec_ver]

    append rpcmess  [binary format "I" $proto]

    

    append rpcmess  [binary format "c" $zero]

    append rpcmess  [binary format "c" $zero]

    

    set port 111

    

    #  Connect to UDP port 111

    

    set catchrc [catch {dp_connect udp -host $tec_addr -port $port} sfd] 

    

    if { $catchrc != 0 } {

    

    set rc 1

    return $rc

    }

    

    

    #  Configure the channel for binary data

    

    fconfigure $sfd -translation binary

    fconfigure $sfd -buffering none

    

    #  And send out the request

    

    puts -nonewline $sfd $rpcmess

    

    #  This loop seemed to be the thing to do

    #  to be sure we got the data back OK

    

    set reply_lth 0

    

    while {$reply_lth == 0} {

    

    set reply [read $sfd 28]

    

    set reply_lth [string length $reply]

    

    }

    

    #  Dig out the TCP port we are to use

    #  for sending the message.  It is the

    #  last 4 bytes of the returned 28 byte

    #  UDP packet from the TEC

    

    set bport [string range $reply 24 27]

    

    set bport_lth [string length $bport]

    

    #  Convert the port number from binary back

    #  to ASCII for TCL to use

    

    binary scan $bport I tec_port

    

    if { $tec_port < 1024 } {

    

    set rc 2

    return $rc

    }

    

    

    #  We now have the TEC message TCP port (in tec_port)

    

    }

    

    #  Set up the TEC Message Header 

    

    set start    "<START>>"                                            

    set zero     0

    set one      1

    

    set    pmess  [binary format "A8" $start]

    append pmess  [binary format "I" $zero]

    append pmess  [binary format "I" $zero]

    append pmess  [binary format "I" $zero]

    append pmess  [binary format "I" $zero]

    append pmess  [binary format "I" $zero]

    

    #--- Set up the message body ---#

    

    #   Put a ;\n on the end of the varibles, the

    #   TEC expects them

    

    append class       ";\n"

    append source      ";\n"

    append sub_source  ";\n"

    append severity    ";\n"

    append message     ";\n"

    append origin      ";\n"

    append hostname    ";\n"

    

    set end       "END\n"

    

    set    mess $class

    append mess $source

    append mess $sub_source

    append mess $severity

    append mess $message

    append mess $origin

    append mess $hostname

    append mess $end

    

    set msg_len [string length $mess]

    incr msg_len

    

    #--- Put the message length into the message header (twice ?)

    

    append pmess [binary format "I" $msg_len]

    append pmess [binary format "I" $msg_len]

    

    incr msg_len -1

    

    #--- Put in the rest of the message, in binary of course

    

    append pmess [binary format "A$msg_len" $mess]

    

    append pmess [binary format "c1" $one]

    

    

    #  Connect to the socket to send the TEC message on

    

    set catchrc [catch {socket $tec_addr $tec_port} sfd]

    

    if { $catchrc != 0 } {

    

    #  Socket connection error, set error code and return

    

    set rc 3

    return $rc

    }

    

    #  Set the socket (channel) for binary

    

    fconfigure $sfd -translation binary

    fconfigure $sfd -buffering none

    

    #  And send the message

    

    puts -nonewline $sfd $pmess

    

    #  We won't wait for a reply, just hope

    #  that it went out OK.  It usually does.

    

    #  And this is the end of the postemsg proc

    #  If we get here everything probably worked.

    

    return $rc

    

    }

    

    

    

    

    Calling Application

    

    

    set parms("class")"db_oracle_file_system"

    set parms("source")"ORACLE"

    set parms("sub_source") "lv21"

    set parms("severity")"CRITICAL"

    set parms("message")"$hn: This is JUST a test."

    set parms("origin")"172.25.4.14"

    set parms("hostname")"HDBRCH3"

    

    set rc [postemsg parms]

    

    if { $rc == 0 } {

    puts "Message sent to TEC OK"

    } else {

    puts "Error in sending TEC message.  rc=$rc"

    }

    

    #####   End of test program   #################################

    ###############################################################



ObservedBehavior:

can't find package tcl-dp

        while executing

    "package require tcl-dp"

        (procedure "postemsg" line 95)

        invoked from within

    "postemsg parms"

        (file "sendmsg.tcl" line 40)

    Exit code: 1, (0x01)



DesiredBehavior:

exit code: 0





I see a 'package require dp', but the error is for 'tcl-dp'.
It is most likely that the path to the tcl-dp package was not
placed in the ::auto_path variable before the package require. 
-- 11/10/1999 hobbs
welch Closed ticket [218285ffff]. [History diff]2000-10-26 08:18:58
dgp Ticket [218285ffff]: 3 changes [History diff]2001-04-19 02:47:26
Log in (anonymous is fine) to add a comment.