| View previous topic :: View next topic |
| Author |
Message |
AudiAddict Voice
Joined: 28 Aug 2007 Posts: 11
|
Posted: Sun Oct 28, 2007 6:37 am Post subject: [TCL] Scripts write acces? |
|
|
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. |
|
| Back to top |
|
 |
YooHoo Owner

Joined: 13 Feb 2003 Posts: 939 Location: Redwood Coast
|
Posted: Sun Oct 28, 2007 9:16 am Post subject: |
|
|
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. _________________
Johoho's TCL for beginners
 |
|
| Back to top |
|
 |
AudiAddict Voice
Joined: 28 Aug 2007 Posts: 11
|
Posted: Sun Oct 28, 2007 9:26 am Post subject: |
|
|
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: |
http://rafb.net/p/5dWlTl96.html
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Oct 28, 2007 9:55 am Post subject: |
|
|
This piece of the code is not properly written:
| Code: | 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: | 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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
AudiAddict Voice
Joined: 28 Aug 2007 Posts: 11
|
Posted: Sun Oct 28, 2007 10:00 am Post subject: |
|
|
| 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.
| Quote: |
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. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Oct 28, 2007 10:08 am Post subject: |
|
|
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: | 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, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|