Re: Use of 'cp -r' in CREATE DATABASE
От | Andrew Dunstan |
---|---|
Тема | Re: Use of 'cp -r' in CREATE DATABASE |
Дата | |
Msg-id | 2804.24.211.141.25.1071194934.squirrel@www.dunslane.net обсуждение исходный текст |
Ответ на | Re: Use of 'cp -r' in CREATE DATABASE ("Nigel J. Andrews" <nandrews@investsystems.co.uk>) |
Ответы |
Re: Use of 'cp -r' in CREATE DATABASE
|
Список | pgsql-hackers |
Nigel J. Andrews said: > On Thu, 11 Dec 2003, Alvaro Herrera wrote: > >> On Thu, Dec 11, 2003 at 06:36:05PM -0500, Bruce Momjian wrote: >> > Our dbcommands.c has for create database: >> > >> > snprintf(buf, sizeof(buf), "cp -r '%s' '%s'", src_loc, >> > target_dir); >> > >> [...] >> > >> > I think we should switch to -R in our code. >> >> But you will have to write special code for Win32, won't you? >> Maybe it would be better to avoid using system commands >> altogether and copy the whole thing using syscalls ... > > That was my immediate thought. Unfortunately that means reinventing the > wheel; or grabbing it from BSD or somewhere and distributing it with > postgresql. > We need a consistent policy about it, I think. I grabbed some code for a recursive mkdir from NetBSD, and it is in initdb.c. But I also wrote a recursive rm, and Bruce replaced it with calls to the native utilities using system(), for understandable reasons. Maybe we need a small, portable, utility library. Or maybe just relying on system utilities is acceptable. cheers andrew
В списке pgsql-hackers по дате отправления: