egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[TCL] Scripts write acces?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
AudiAddict
Voice


Joined: 28 Aug 2007
Posts: 11

PostPosted: Sun Oct 28, 2007 6:37 am    Post subject: [TCL] Scripts write acces? Reply with quote

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
View user's profile Send private message
YooHoo
Owner


Joined: 13 Feb 2003
Posts: 939
Location: Redwood Coast

PostPosted: Sun Oct 28, 2007 9:16 am    Post subject: Reply with quote

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.
_________________
Mr. Green
Johoho's TCL for beginners
Mr. Green
Back to top
View user's profile Send private message Send e-mail
AudiAddict
Voice


Joined: 28 Aug 2007
Posts: 11

PostPosted: Sun Oct 28, 2007 9:26 am    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Oct 28, 2007 9:55 am    Post subject: Reply with quote

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
View user's profile Send private message
AudiAddict
Voice


Joined: 28 Aug 2007
Posts: 11

PostPosted: Sun Oct 28, 2007 10:00 am    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Oct 28, 2007 10:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber