This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

[TCL] Scripts write acces?

General support and discussion of Eggdrop bots.
Post Reply
A
AudiAddict
Voice
Posts: 11
Joined: Tue Aug 28, 2007 8:55 am

[TCL] Scripts write acces?

Post by AudiAddict »

As stated in another topic of mine :

http://forum.egghelp.org/viewtopic.php?p=77183#77183

I am having trouble getting scripts to work which can write data to database files.

One example was the Learn scripts (with !learn add etc) from the stated topic above.

Personaly I'm starting to think it's a general config problem and not a problem with the scripts.

So in short, for some reason the eggdrop bot is unable to write data to files.

The strang thing is that allot of the scripts seem to be able to :

- Create folder and file
- Eggdrop is logging data fine (channels)
- No error messages can be found anywhere, even with Set errorInfo.

So it seems it's able to create files.

I've even tried to set a chmod of 777 on the complete eggdrop dir + files and subdirs.

Also tried chowning all the files and subdirs as the current runnning eggdrop user.

Anybody have a clue what's going on here? It's really frustating since I've been trying this for days and I've tried almost all the Learn scripts for example.

Most of them work, as in, they respond to lookups like : No word can be found. They just don't respond to !learn add commands. Not even a error message or a reply from the bot.

I obviously have checked teh config file many times and have tried creating the db files myself. Anybody have a clue??

Could it be something to do with the fact that I'm not using my eggdrop for operator commands yet? like setting modes etc.

I have tried giving my eggdrop bot the +o status, didn't make any difference.
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

this is posted in the wrong forum. i doubt that there is any error in the eggdrop at all, but rather the error lies in your configuration of the script itself. copy the entire script here, using the appropriate code tags.
A
AudiAddict
Voice
Posts: 11
Joined: Tue Aug 28, 2007 8:55 am

Post by AudiAddict »

I'm posting it here, since I've tried about 10 different scripts and they all have the same problem.

So i'm beginning to think it's an issue with eggdrop or my linux machine.

I doubt it's the code, since other users are able to use it and it's a out of the box soluiton

As explain in the other thread

- Bot responds to lookup commands + word ---> no defenition found
- Bot does not respond to !learn add word defenition (nothing happends)
- Tried manualy creating the learn.dat file and it's folder
- Tried letting eggdrop make the folder/file --> no go, error --> learn.dat cannot be found
- Checked security, chmod etc.

Code: Select all

 
 
http://rafb.net/p/5dWlTl96.html

n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

This piece of the code is not properly written:

Code: Select all

proc learn_addEntry { nick word defenition } {
 global learn_db;set word [string tolower $word]
 if {![file exists $learn_db]} {file mkdir [lindex [split $learn_db /] 0];set fp [open $learn_db w+]
  puts $fp "Hal9000 + Just do a \002+ \037word\037\002 or \002+ \037word\037 > \037nick\037\002"
  puts $fp "Hal9000 !learn hal-learn script | mantained by the #Eggdrop team at irc.PTnet.org"
 } else {set fp [open $learn_db a]};puts $fp "$nick $word [join $defenition]";close $fp
}
It assumes that learn_db contains a relative path with one directory. IE: "dir/file.dat"
Anything else, and this code may not work as intended, should the corresponding file do not exist.

Proper code should look something like this:

Code: Select all

proc learn_addEntry { nick word defenition } {
 global learn_db
 set word [string tolower $word]
 if {![file exists $learn_db]} {
  file mkdir [file dirname $learn_db]
  set fp [open $learn_db w+]
  puts $fp "Hal9000 + Just do a \002+ \037word\037\002 or \002+ \037word\037 > \037nick\037\002"
  puts $fp "Hal9000 !learn hal-learn script | mantained by the #Eggdrop team at irc.PTnet.org"
 } else {
  set fp [open $learn_db a]
 }
 puts $fp "$nick $word [join $defenition]"
 close $fp
}

Seems you are running a .deb-packaged eggdrop? As which user does it run? Who owns the directories where it tries to store data? Where do you start your eggdrop from, etc?
NML_375
A
AudiAddict
Voice
Posts: 11
Joined: Tue Aug 28, 2007 8:55 am

Post by AudiAddict »

nml375 wrote:This piece of the code is not properly written
Maybe that's the case, but I do know that many users are using it and it works fine. Also, I've tried other scripts (learn scripts) and they have the same problem.

Seems you are running a .deb-packaged eggdrop? As which user does it run? Who owns the directories where it tries to store data? Where do you start your eggdrop from, etc?
Yes, I believe it was a package, to be sure I would have to check.

I start my eggdrop with user : ircserver, ps aux gives me --> user : 1000

The folder, subdir and it's files are all set to that user aswel. I've even tried a set errorInfo and a -n eggdrop run. All no go.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Do you think you could try and run this?
Should try to create a file wherever your eggdrop was started, and dups any error messages to logs. It will also test wether the file is created afterwards.

Code: Select all

if {[catch {set fid [open "./temp.blah" "WRONLY CREAT TRUNC"]} status]} {
 putlog "Error opening ./temp.blah: $status"
 putlog "Extended info: $::errorCode - $::errorInfo"
} {
 puts $fid "Line of text"
 close $fid
 putlog "Created ./temp.blah"
}
if {![file exists "./temp.blah"]} {
 putlog "Odd condition; ./temp.blah does not exist!"
}
Edit:
Minor typo (TRUNK)
NML_375
Post Reply