Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
ca9540d3
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ca9540d3
编写于
8月 01, 2004
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add docs for initdb --auth.
上级
e7029b21
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
201 addition
and
59 deletion
+201
-59
configure
configure
+0
-5
configure.in
configure.in
+1
-6
doc/src/sgml/ref/initdb.sgml
doc/src/sgml/ref/initdb.sgml
+14
-1
src/Makefile.global.in
src/Makefile.global.in
+2
-2
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+2
-9
src/bin/initdb/Makefile
src/bin/initdb/Makefile
+5
-2
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+1
-26
src/include/port.h
src/include/port.h
+3
-1
src/port/dirmod.c
src/port/dirmod.c
+173
-7
未找到文件。
configure
浏览文件 @
ca9540d3
...
...
@@ -12063,11 +12063,6 @@ LIBOBJS="$LIBOBJS open.$ac_objext"
LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
esac
# Win32 can't do rename or unlink on an open file
case $host_os in mingw*|cygwin*)
LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;;
esac
if test "$with_readline" = yes; then
echo "$as_me:$LINENO: checking for rl_completion_append_character" >&5
echo $ECHO_N "checking for rl_completion_append_character... $ECHO_C" >&6
...
...
configure.in
浏览文件 @
ca9540d3
dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.3
69 2004/07/20 20:37:13
momjian Exp $
dnl $PostgreSQL: pgsql/configure.in,v 1.3
70 2004/08/01 06:19:16
momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
...
...
@@ -911,11 +911,6 @@ AC_LIBOBJ(open)
AC_LIBOBJ(rand) ;;
esac
# Win32 can't do rename or unlink on an open file
case $host_os in mingw*|cygwin*)
AC_LIBOBJ(dirmod) ;;
esac
if test "$with_readline" = yes; then
PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
...
...
doc/src/sgml/ref/initdb.sgml
浏览文件 @
ca9540d3
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/initdb.sgml,v 1.3
1 2004/07/14 17:55:09 petere
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/initdb.sgml,v 1.3
2 2004/08/01 06:19:18 momjian
Exp $
PostgreSQL documentation
-->
...
...
@@ -98,6 +98,19 @@ PostgreSQL documentation
<para>
<variablelist>
<varlistentry>
<term><option>-A <replaceable class="parameter">authmethod</replaceable></option></term>
<term><option>--auth=<replaceable class="parameter">authmethod</replaceable></option></term>
<listitem>
<para>
This option specifies the authentication method for local users
used in <filename>pg_hba.conf</>. Do not use <literal>trust</>
unless you trust all local users on your system. <literal>Trust</>
is the default for ease of installation.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-D <replaceable class="parameter">directory</replaceable></option></term>
<term><option>--pgdata=<replaceable class="parameter">directory</replaceable></option></term>
...
...
src/Makefile.global.in
浏览文件 @
ca9540d3
# -*-makefile-*-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.19
0 2004/07/30 12:26:40 petere
Exp $
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.19
1 2004/08/01 06:19:19 momjian
Exp $
#------------------------------------------------------------------------------
# All PostgreSQL makefiles include this file and use the variables it sets,
...
...
@@ -347,7 +347,7 @@ endif
#
# substitute implementations of the C library
LIBOBJS
=
@LIBOBJS@ exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
LIBOBJS
=
@LIBOBJS@
dirmod.o
exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
ifneq
(,$(LIBOBJS))
LIBS
:=
-lpgport
$(LIBS)
...
...
src/backend/commands/dbcommands.c
浏览文件 @
ca9540d3
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.13
7 2004/06/25 21:55:53 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.13
8 2004/08/01 06:19:22 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -915,7 +915,6 @@ remove_dbtablespaces(Oid db_id)
Relation
rel
;
HeapScanDesc
scan
;
HeapTuple
tuple
;
char
buf
[
MAXPGPATH
+
100
];
rel
=
heap_openr
(
TableSpaceRelationName
,
AccessShareLock
);
scan
=
heap_beginscan
(
rel
,
SnapshotNow
,
0
,
NULL
);
...
...
@@ -938,17 +937,11 @@ remove_dbtablespaces(Oid db_id)
continue
;
}
#ifndef WIN32
snprintf
(
buf
,
sizeof
(
buf
),
"rm -rf '%s'"
,
dstpath
);
#else
snprintf
(
buf
,
sizeof
(
buf
),
"rmdir /s /q
\"
%s
\"
"
,
dstpath
);
#endif
if
(
system
(
buf
)
!=
0
)
if
(
!
rmtree
(
dstpath
,
true
))
{
ereport
(
WARNING
,
(
errmsg
(
"could not remove database directory
\"
%s
\"
"
,
dstpath
),
errdetail
(
"Failing system command was: %s"
,
buf
),
errhint
(
"Look in the postmaster's stderr log for more information."
)));
}
...
...
src/bin/initdb/Makefile
浏览文件 @
ca9540d3
...
...
@@ -5,7 +5,7 @@
# Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.4
1 2004/05/24 01:01:37
momjian Exp $
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.4
2 2004/08/01 06:19:23
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -15,13 +15,16 @@ include $(top_builddir)/src/Makefile.global
override CPPFLAGS
:
= -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
OBJS
=
initdb.o exec.o
OBJS
=
initdb.o
dirmod.o
exec.o
all
:
submake-libpq submake-libpgport initdb
initdb
:
$(OBJS) $(libpq_builddir)/libpq.a
$(CC)
$(CFLAGS)
$(OBJS)
$(libpq)
$(LDFLAGS)
$(LIBS)
-o
$@$(X)
dirmod.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
exec.c
:
% : $(top_srcdir)/src/port/%
rm
-f
$@
&&
$(LN_S)
$<
.
...
...
src/bin/initdb/initdb.c
浏览文件 @
ca9540d3
...
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.4
5 2004/08/01 05:59:1
3 momjian Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.4
6 2004/08/01 06:19:2
3 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -146,7 +146,6 @@ char backend_exec[MAXPGPATH];
static
void
*
xmalloc
(
size_t
size
);
static
char
*
xstrdup
(
const
char
*
s
);
static
bool
rmtree
(
char
*
path
,
bool
rmtopdir
);
static
char
**
replace_token
(
char
**
lines
,
char
*
token
,
char
*
replacement
);
static
char
**
readfile
(
char
*
path
);
static
void
writefile
(
char
*
path
,
char
**
lines
);
...
...
@@ -251,30 +250,6 @@ xstrdup(const char *s)
return
result
;
}
/*
* delete a directory tree recursively
* assumes path points to a valid directory
* deletes everything under path
* if rmtopdir is true deletes the directory too
*/
static
bool
rmtree
(
char
*
path
,
bool
rmtopdir
)
{
char
buf
[
MAXPGPATH
+
64
];
#ifndef WIN32
/* doesn't handle .* files, but we don't make any... */
snprintf
(
buf
,
sizeof
(
buf
),
"rm -rf
\"
%s
\"
%s"
,
path
,
rmtopdir
?
""
:
"/*"
);
#else
snprintf
(
buf
,
sizeof
(
buf
),
"%s /s /q
\"
%s
\"
"
,
rmtopdir
?
"rmdir"
:
"del"
,
path
);
#endif
return
!
system
(
buf
);
}
/*
* make a copy of the array of lines, with token replaced by replacement
* the first time it occurs on each line.
...
...
src/include/port.h
浏览文件 @
ca9540d3
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.4
5 2004/07/23 01:58:36
momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.4
6 2004/08/01 06:19:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -148,6 +148,8 @@ extern int pgunlink(const char *path);
#define unlink(path) pgunlink(path)
#endif
extern
bool
rmtree
(
char
*
path
,
bool
rmtopdir
);
#ifdef WIN32
/* open() replacement to allow delete of held files */
...
...
src/port/dirmod.c
浏览文件 @
ca9540d3
...
...
@@ -10,21 +10,28 @@
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.1
2 2004/02/26 02:5
9:26 momjian Exp $
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.1
3 2004/08/01 06:1
9:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef TEST_VERSION
#if defined(WIN32) || defined(__CYGWIN__)
#ifndef FRONTEND
#include "postgres.h"
#else
#include "postgres_fe.h"
#endif
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
#define _(x) gettext((x))
#ifndef TEST_VERSION
#if defined(WIN32) || defined(__CYGWIN__)
#include "miscadmin.h"
#undef rename
...
...
@@ -82,7 +89,7 @@ pgunlink(const char *path)
if
(
errno
!=
EACCES
)
/* set errno? */
return
-
1
;
pg_usleep
(
100000
);
/* us */
pg_usleep
(
100000
);
/* us */
if
(
loops
==
30
)
#ifndef FRONTEND
elog
(
LOG
,
"could not unlink
\"
%s
\"
, continuing to try"
,
...
...
@@ -105,6 +112,165 @@ pgunlink(const char *path)
#endif
#if defined(WIN32) || defined(__CYGWIN__)
#define rmt_unlink(path) pgunlink(path)
#else
#define rmt_unlink(path) unlink(path)
#endif
#ifdef FRONTEND
static
void
*
xmalloc
(
size_t
size
)
{
void
*
result
;
result
=
malloc
(
size
);
if
(
!
result
)
{
fprintf
(
stderr
,
_
(
"out of memory
\n
"
));
exit
(
1
);
}
return
result
;
}
static
char
*
xstrdup
(
const
char
*
s
)
{
char
*
result
;
result
=
strdup
(
s
);
if
(
!
result
)
{
fprintf
(
stderr
,
_
(
"out of memory
\n
"
));
exit
(
1
);
}
return
result
;
}
#define xfree(n) free(n)
#else
/* on the backend, use palloc and friends */
#define xmalloc(n) palloc(n)
#define xstrdup(n) pstrdup(n)
#define xfree(n) pfree(n)
#endif
/*
* deallocate memory used for filenames
*/
static
void
rmt_cleanup
(
char
**
filenames
)
{
char
**
fn
;
for
(
fn
=
filenames
;
*
fn
;
fn
++
)
xfree
(
*
fn
);
xfree
(
filenames
);
}
/*
* delete a directory tree recursively
* assumes path points to a valid directory
* deletes everything under path
* if rmtopdir is true deletes the directory too
*
*/
bool
rmtree
(
char
*
path
,
bool
rmtopdir
)
{
char
filepath
[
MAXPGPATH
];
DIR
*
dir
;
struct
dirent
*
file
;
char
**
filenames
;
char
**
filename
;
int
numnames
=
0
;
struct
stat
statbuf
;
/*
* we copy all the names out of the directory before we start
* modifying it.
*/
dir
=
opendir
(
path
);
if
(
dir
==
NULL
)
return
false
;
while
((
file
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
file
->
d_name
,
"."
)
!=
0
&&
strcmp
(
file
->
d_name
,
".."
)
!=
0
)
numnames
++
;
}
rewinddir
(
dir
);
filenames
=
xmalloc
((
numnames
+
2
)
*
sizeof
(
char
*
));
numnames
=
0
;
while
((
file
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
file
->
d_name
,
"."
)
!=
0
&&
strcmp
(
file
->
d_name
,
".."
)
!=
0
)
filenames
[
numnames
++
]
=
xstrdup
(
file
->
d_name
);
}
filenames
[
numnames
]
=
NULL
;
closedir
(
dir
);
/* now we have the names we can start removing things */
for
(
filename
=
filenames
;
*
filename
;
filename
++
)
{
snprintf
(
filepath
,
MAXPGPATH
,
"%s/%s"
,
path
,
*
filename
);
if
(
stat
(
filepath
,
&
statbuf
)
!=
0
)
{
rmt_cleanup
(
filenames
);
return
false
;
}
if
(
S_ISDIR
(
statbuf
.
st_mode
))
{
/* call ourselves recursively for a directory */
if
(
!
rmtree
(
filepath
,
true
))
{
rmt_cleanup
(
filenames
);
return
false
;
}
}
else
{
if
(
rmt_unlink
(
filepath
)
!=
0
)
{
rmt_cleanup
(
filenames
);
return
false
;
}
}
}
if
(
rmtopdir
)
{
if
(
rmdir
(
path
)
!=
0
)
{
rmt_cleanup
(
filenames
);
return
false
;
}
}
rmt_cleanup
(
filenames
);
return
true
;
}
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录