From owner-freebsd-questions Sat Oct 7 9:59:49 2000 Delivered-To: freebsd-questions@freebsd.org Received: from osiris.ipform.ru (osiris.ipform.ru [212.158.165.98]) by hub.freebsd.org (Postfix) with ESMTP id 92F7D37B66D for ; Sat, 7 Oct 2000 09:59:43 -0700 (PDT) Received: from wp2 (wp2 [192.168.0.12]) by osiris.ipform.ru (8.11.0/8.11.0) with SMTP id e97Gxg849980 for ; Sat, 7 Oct 2000 20:59:42 +0400 (MSD) (envelope-from matrix@ipform.ru) Message-ID: <025f01c0307f$fcb87220$0c00a8c0@ipform.ru> From: "Artem Koutchine" To: Subject: Maybe some perl/SQL developer could help. Date: Sat, 7 Oct 2000 20:59:37 +0400 Organization: IP Form MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-Mimeole: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sorry for the offtopic, but i am really lost. I have a very weird situation. There is a perl script wich gets some data in files and uses LOAD DATA INFILE to get that data into database. It is called import.cgi There is another script wich does EXACTLY the same (they use the same function for importing data), but it does not unpack the incoming zip file, but uses the files wich were unpacked by import.cgi. THIS script is called aimport.cgi Now, when i run import.cgi (which supports file upload, get a zip file, unzips it, for each *.dat file unpacked runs an import function) - it work perfectly. Now, when i run aimport.cgi from the same cgi dir for files created an already imported by import.cgi it fails with: Can't get stat of '/hosts/ubex.ru/admin/curi/rates.dat' (Errorcode: 13) hosts, server, curi - mode 750, owner: ubex, group: ubex rates.dat - 666, owner: ubex, group: ubex apache is run as: root with suEXEC (so, all scripts execute as ubex.ubex) mysql is run as : mysql.mysql database, db user db password are the same for both scripts (read from the same config file) apache: 1.3.9 mysql: 3.23.24 OS: FreeBSD 4.1.1-stable I desided that something is wrong with permissions or user id, so i printed it out (right before executing the query): import.cgi: Real user id: 5012 Real group id: 5012 5012 5012 Eff user id : 5012 Eff group id:5012 5012 5012 /hosts/ubex.ru/admin/curi/rates.dat 134407,1064442,33206,1,5012,5012,0,0,970932306,970932306,970935971,8192,0 amport.cgi Real user id: 5012 Real group id: 5012 5012 5012 Eff user id : 5012 Eff group id:5012 5012 5012 /hosts/ubex.ru/admin/curi/rates.dat 134407,1064442,33206,1,5012,5012,0,0,970935971,970932306,970935971,8192,0 for the file stat($file) array is printed: 33206= mode 100666 5012 - uid of ubex 5012 - gid of ubex The import function is very simple (and the same in both aimport.cgi and import.cgi) # import one table from a file sub import_table { my $myname="import_table"; my $sql; my $sth; my $table=$_[0]; my $a=0; # debug data warn "Real user id: $< Real group id: $(\n"; warn "Eff user id : $> Eff group id:$)\n"; $f=$CONFIG{'CURDIR'}.'/'.$table.'.dat'; @aa=stat($f);$"=',';warn "$f @aa\n"; $sql="LOAD DATA INFILE \'$CONFIG{'CURDIR'}/".$table.".dat\' REPLACE INTO TABLE $table"; unless ($sth=$dbh->prepare($sql)){die "$DBI::errstr,$myname\n";} unless ($a=$sth->execute()){die "$DBI::errstr,$myname\n";} $a=$sth->rows; $sth->finish; if ($a>0){warn " $a record(s) in $table\n";} return $a; } I don't undertsand what going on. It either must not work in import.cgi or also work in aimport.cgi, since the conditions for LOAD DATA INFILE are the same. Am i missing something? Artem To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message