Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
b45af7b7
R
runtime
项目概览
dotNET Platform
/
runtime
10 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b45af7b7
编写于
5月 11, 2021
作者:
A
Anipik
浏览文件
操作
浏览文件
下载
差异文件
Merge commit '
478b2f8c
' into merge
上级
49f4fb85
478b2f8c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
56 deletion
+14
-56
src/installer/corehost/cli/bundle/extractor.cpp
src/installer/corehost/cli/bundle/extractor.cpp
+1
-1
src/installer/corehost/cli/hostmisc/pal.h
src/installer/corehost/cli/hostmisc/pal.h
+1
-3
src/installer/corehost/cli/hostmisc/pal.unix.cpp
src/installer/corehost/cli/hostmisc/pal.unix.cpp
+8
-48
src/installer/corehost/cli/hostmisc/pal.windows.cpp
src/installer/corehost/cli/hostmisc/pal.windows.cpp
+4
-4
未找到文件。
src/installer/corehost/cli/bundle/extractor.cpp
浏览文件 @
b45af7b7
...
...
@@ -25,7 +25,7 @@ pal::string_t& extractor_t::extraction_dir()
{
trace
::
error
(
_X
(
"Failure processing application bundle."
));
trace
::
error
(
_X
(
"Failed to determine location for extracting embedded files."
));
trace
::
error
(
_X
(
"DOTNET_BUNDLE_EXTRACT_BASE_DIR is not set, and a read-write
temp-
directory couldn't be created."
));
trace
::
error
(
_X
(
"DOTNET_BUNDLE_EXTRACT_BASE_DIR is not set, and a read-write
cache
directory couldn't be created."
));
throw
StatusCode
::
BundleExtractionFailure
;
}
}
...
...
src/installer/corehost/cli/hostmisc/pal.h
浏览文件 @
b45af7b7
...
...
@@ -298,9 +298,7 @@ namespace pal
bool
get_default_breadcrumb_store
(
string_t
*
recv
);
bool
is_path_rooted
(
const
string_t
&
path
);
bool
get_temp_directory
(
string_t
&
tmp_dir
);
// Returns a platform-specific, user-private directory within get_temp_directory()
// Returns a platform-specific, user-private directory
// that can be used for extracting out components of a single-file app.
bool
get_default_bundle_extraction_base_dir
(
string_t
&
extraction_dir
);
...
...
src/installer/corehost/cli/hostmisc/pal.unix.cpp
浏览文件 @
b45af7b7
...
...
@@ -352,29 +352,12 @@ bool is_read_write_able_directory(pal::string_t& dir)
(
access
(
dir
.
c_str
(),
R_OK
|
W_OK
|
X_OK
)
==
0
);
}
bool
pal
::
get_temp_directory
(
pal
::
string_t
&
tmp_dir
)
bool
get_extraction_base_parent_directory
(
pal
::
string_t
&
directory
)
{
//
First,
check for the POSIX standard environment variable
if
(
getenv
(
_X
(
"TMPDIR"
),
&
tmp_dir
))
// check for the POSIX standard environment variable
if
(
pal
::
getenv
(
_X
(
"HOME"
),
&
directory
))
{
return
is_read_write_able_directory
(
tmp_dir
);
}
// On non-compliant systems (ex: Ubuntu) try /var/tmp or /tmp directories.
// /var/tmp is prefered since its contents are expected to survive across
// machine reboot.
pal
::
string_t
_var_tmp
=
_X
(
"/var/tmp/"
);
if
(
is_read_write_able_directory
(
_var_tmp
))
{
tmp_dir
.
assign
(
_var_tmp
);
return
true
;
}
pal
::
string_t
_tmp
=
_X
(
"/tmp/"
);
if
(
is_read_write_able_directory
(
_tmp
))
{
tmp_dir
.
assign
(
_tmp
);
return
true
;
return
is_read_write_able_directory
(
directory
);
}
return
false
;
...
...
@@ -382,50 +365,27 @@ bool pal::get_temp_directory(pal::string_t& tmp_dir)
bool
pal
::
get_default_bundle_extraction_base_dir
(
pal
::
string_t
&
extraction_dir
)
{
if
(
!
get_
temp
_directory
(
extraction_dir
))
if
(
!
get_
extraction_base_parent
_directory
(
extraction_dir
))
{
return
false
;
}
append_path
(
&
extraction_dir
,
_X
(
".net"
));
pal
::
string_t
dotnetdir
(
extraction_dir
);
// getuid() is the real user ID, and the call has no defined errors.
struct
passwd
*
passwd
=
getpwuid
(
getuid
());
if
(
passwd
==
nullptr
||
passwd
->
pw_name
==
nullptr
)
{
return
false
;
}
append_path
(
&
extraction_dir
,
passwd
->
pw_name
);
if
(
is_read_write_able_directory
(
extraction_dir
))
{
return
true
;
}
// Create $
TMPDIR/.net accessible to everyone
if
(
::
mkdir
(
dotnetdir
.
c_str
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
)
==
0
)
// Create $
HOME/.net with rwx access to the owner
if
(
::
mkdir
(
extraction_dir
.
c_str
(),
S_IRWXU
)
==
0
)
{
// In the above mkdir() system call, some permissions are strangely dropped!
// Linux drops S_IWO and Mac drops S_IWG | S_IWO.
// So these are again explicitly set by calling chmod()
if
(
chmod
(
dotnetdir
.
c_str
(),
S_IRWXU
|
S_IRWXG
|
S_IRWXO
)
!=
0
)
{
return
false
;
}
return
true
;
}
else
if
(
errno
!=
EEXIST
)
{
return
false
;
}
// Create $TMPDIR/.net/username accessible only to the user
if
(
::
mkdir
(
extraction_dir
.
c_str
(),
S_IRWXU
|
S_ISVTX
)
!=
0
&&
errno
!=
EEXIST
)
{
return
false
;
}
return
is_read_write_able_directory
(
extraction_dir
);
}
...
...
src/installer/corehost/cli/hostmisc/pal.windows.cpp
浏览文件 @
b45af7b7
...
...
@@ -567,7 +567,7 @@ bool pal::get_module_path(dll_t mod, string_t* recv)
return
GetModuleFileNameWrapper
(
mod
,
recv
);
}
bool
pal
::
get_temp_directory
(
pal
::
string_t
&
tmp_dir
)
bool
get_extraction_base_parent_directory
(
pal
::
string_t
&
directory
)
{
const
size_t
max_len
=
MAX_PATH
+
1
;
pal
::
char_t
temp_path
[
max_len
];
...
...
@@ -579,14 +579,14 @@ bool pal::get_temp_directory(pal::string_t& tmp_dir)
}
assert
(
len
<
max_len
);
tmp_dir
.
assign
(
temp_path
);
directory
.
assign
(
temp_path
);
return
realpath
(
&
tmp_dir
);
return
pal
::
realpath
(
&
directory
);
}
bool
pal
::
get_default_bundle_extraction_base_dir
(
pal
::
string_t
&
extraction_dir
)
{
if
(
!
get_
temp
_directory
(
extraction_dir
))
if
(
!
get_
extraction_base_parent
_directory
(
extraction_dir
))
{
return
false
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录