Re: INTO OUTFILE "filename" creates world writeable files

Re: INTO OUTFILE "filename" creates world writeable files

am 10.07.2003 19:06:04 von Neil Walker

Hi Sergei

nice of you to join in - my ignorance is easily exposed on C issues,
being a DBA ...

You wrote:

------------- Begin Included Message -------------

socket permissions has nothing to do with it.
'man 2 read' reveals:

ERRORS
....
EAGAIN Non-blocking I/O has been selected using O_NONBLOCK
and no data was immediately available for reading.

it's not "permission denied" - it's simply client trying to read
server's reply before it was actually sent.

MySQL will retry with timeout then. (my_real_read())

------------- End Included Message -------------

I'm sorry, I truncated the truss. It ends (very rapidly) as below -
which I take it mean that the read error was fatal?

------------- Begin Included Message -------------

28076: read(3, 0x0003A260, 1047551) Err#11 EAGAIN
28076: fstat64(3, 0xFFBEE738) = 0
28076: getsockopt(3, 65535, 8192, 0xFFBEE838, 0xFFBEE834, 0) = 0
28076: setsockopt(3, 65535, 8192, 0xFFBEE838, 4, 0) = 0
28076: fcntl(3, F_SETFL, 0x00000002) = 0
28076: write(3, " >\0\0\003 S E L E C T ".., 66) = 66
28076: read(3, " H\0\001", 4) = 4
28076: read(3, "FF01\0 C a n ' t c r e".., 72) = 72
mysqldump28076: write(2, " m y s q l d u m p", 9) = 9
: 28076: write(2, " : ", 2) = 2
Got error: 1: Can't create/write to file '/home/neil/tmp/build.txt' (Errcode:
13) when executing 'SELECT INTO OUTFILE'28076: write(2, " G o t e r r o
r : 1".., 120) = 120

28076: write(2, "\n", 1) = 1
28076: fstat64(3, 0xFFBEE7B0) = 0
28076: getsockopt(3, 65535, 8192, 0xFFBEE8B0, 0xFFBEE8AC, 3) = 0
28076: setsockopt(3, 65535, 8192, 0xFFBEE8B0, 4, 3) = 0
28076: fcntl(3, F_SETFL, 0x00000082) = 0
28076: read(3, 0x0003A260, 1047551) Err#11 EAGAIN
28076: fstat64(3, 0xFFBEE7B0) = 0
28076: getsockopt(3, 65535, 8192, 0xFFBEE8B0, 0xFFBEE8AC, 0) = 0
28076: setsockopt(3, 65535, 8192, 0xFFBEE8B0, 4, 0) = 0
28076: fcntl(3, F_SETFL, 0x00000002) = 0
28076: write(3, "01\0\0\001", 5) = 5
28076: shutdown(3, 2, 1) = 0
28076: close(3) = 0
28076: llseek(0, 0, SEEK_CUR) = 25851
28076: _exit(2)

------------- End Included Message -------------

Yours
Neil Walker



--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

Re: INTO OUTFILE "filename" creates world writeable files

am 11.07.2003 09:17:30 von Sergei Golubchik

Hi!

On Jul 10, Neil Walker wrote:
>
> I'm sorry, I truncated the truss. It ends (very rapidly) as below -
> which I take it mean that the read error was fatal?
>
> ------------- Begin Included Message -------------
>
> 28076: read(3, 0x0003A260, 1047551) Err#11 EAGAIN

mysqldump tries to read - receives an error "no data, try again"

> 28076: fstat64(3, 0xFFBEE738) = 0
> 28076: getsockopt(3, 65535, 8192, 0xFFBEE838, 0xFFBEE834, 0) = 0
> 28076: setsockopt(3, 65535, 8192, 0xFFBEE838, 4, 0) = 0
> 28076: fcntl(3, F_SETFL, 0x00000002) = 0
> 28076: write(3, " >\0\0\003 S E L E C T ".., 66) = 66

it sends query to the server "SELECT ..." - obviously your
"select into outfile..."

> 28076: read(3, " H\0\001", 4) = 4
> 28076: read(3, "FF01\0 C a n ' t c r e".., 72) = 72

It reads an error message from the server "Can't create..."

> 28076: write(2, " m y s q l d u m p", 9) = 9
> 28076: write(2, " : ", 2) = 2
> 8076: write(2, " G o t e r r o r : 1".., 120) = 120

And writes an error message to you (stdout) "mysqldump: Got error: ..."

> 28076: write(2, "\n", 1) = 1
> 28076: fstat64(3, 0xFFBEE7B0) = 0
> 28076: getsockopt(3, 65535, 8192, 0xFFBEE8B0, 0xFFBEE8AC, 3) = 0
> 28076: setsockopt(3, 65535, 8192, 0xFFBEE8B0, 4, 3) = 0
> 28076: fcntl(3, F_SETFL, 0x00000082) = 0
> 28076: read(3, 0x0003A260, 1047551) Err#11 EAGAIN
> 28076: fstat64(3, 0xFFBEE7B0) = 0
> 28076: getsockopt(3, 65535, 8192, 0xFFBEE8B0, 0xFFBEE8AC, 0) = 0
> 28076: setsockopt(3, 65535, 8192, 0xFFBEE8B0, 4, 0) = 0
> 28076: fcntl(3, F_SETFL, 0x00000002) = 0
> 28076: write(3, "01\0\0\001", 5) = 5
> 28076: shutdown(3, 2, 1) = 0
> 28076: close(3) = 0
> 28076: llseek(0, 0, SEEK_CUR) = 25851
> 28076: _exit(2)

Then exits.

It's all absolutely ok - an error (permission problem) takes place on
server, not client. Client acts 100% correctly.

The problem is that mysqld cannot create a file for table dump.

Regards,
Sergei

--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Senior Software Developer
/_/ /_/\_, /___/\___\_\___/ Osnabrueck, Germany
<___/ www.mysql.com

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org