From eb142b7ce79c8040b1c4a58c5279ef703aff014f Mon Sep 17 00:00:00 2001 From: gaohuatao Date: Tue, 14 Jul 2020 10:31:15 +0800 Subject: [PATCH] iSulad: sync openeuler Signed-off-by: gaohuatao --- ...isulad-shim-fix-probabilistic-bad-fd.patch | 10 +- ...ad-resolve-coredump-of-isula-inspect.patch | 8 +- ...-Request-Template-And-Issue-Template.patch | 16 +- ...ing-symlink-for-etc-mtab-when-etc-sy.patch | 8 +- 0005-fix-label-file-reading-bug.patch | 10 +- 0006-CI-add-testcases-use-host-rootfs.patch | 8 +- 0007-add-d-disk-param-for-CI.patch | 50 ++++ ...nts-fix-wrong-format-of-exec-command.patch | 254 ++++++++++++++++++ 0009-fix-create-mtab-bug-to-use-lstat.patch | 70 +++++ 0010-init-struct.patch | 41 +++ ...m-caused-by-websocket-traffic-restri.patch | 102 +++++++ ...out-LTS-tag-for-third-party-software.patch | 127 +++++++++ iSulad.spec | 10 +- 13 files changed, 682 insertions(+), 32 deletions(-) create mode 100644 0007-add-d-disk-param-for-CI.patch create mode 100644 0008-events-fix-wrong-format-of-exec-command.patch create mode 100644 0009-fix-create-mtab-bug-to-use-lstat.patch create mode 100644 0010-init-struct.patch create mode 100644 0011-Fix-stuck-problem-caused-by-websocket-traffic-restri.patch create mode 100644 0012-build-add-checkout-LTS-tag-for-third-party-software.patch diff --git a/0001-isulad-shim-fix-probabilistic-bad-fd.patch b/0001-isulad-shim-fix-probabilistic-bad-fd.patch index 4ffbdd2..caf3d61 100644 --- a/0001-isulad-shim-fix-probabilistic-bad-fd.patch +++ b/0001-isulad-shim-fix-probabilistic-bad-fd.patch @@ -1,7 +1,7 @@ -From 2c990693f8f78a202e2f7cc1115e133ad6950f34 Mon Sep 17 00:00:00 2001 +From 5fc7f3cd19ef0f22f47d31e45bf7d103568d1ae2 Mon Sep 17 00:00:00 2001 From: leizhongkai Date: Thu, 18 Jun 2020 12:06:12 +0800 -Subject: [PATCH 1/6] isulad-shim: fix probabilistic bad fd +Subject: [PATCH 01/12] isulad-shim: fix probabilistic bad fd 1. fix `epoll_ctl()` probabilistic returns bad fd when the epfd not read 2. fix typos @@ -13,7 +13,7 @@ Signed-off-by: leizhongkai 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c -index cf315359..da9bdb64 100644 +index cf31535..da9bdb6 100644 --- a/src/cmd/isulad-shim/process.c +++ b/src/cmd/isulad-shim/process.c @@ -242,7 +242,7 @@ static void* task_io_copy(void *data) @@ -141,7 +141,7 @@ index cf315359..da9bdb64 100644 return status; } diff --git a/src/cmd/isulad-shim/process.h b/src/cmd/isulad-shim/process.h -index 6d0fb195..71bc20cc 100644 +index 6d0fb19..71bc20c 100644 --- a/src/cmd/isulad-shim/process.h +++ b/src/cmd/isulad-shim/process.h @@ -75,6 +75,7 @@ typedef struct process { @@ -153,5 +153,5 @@ index 6d0fb195..71bc20cc 100644 typedef struct { -- -2.25.1 +2.20.1 diff --git a/0002-iSulad-resolve-coredump-of-isula-inspect.patch b/0002-iSulad-resolve-coredump-of-isula-inspect.patch index c88e7c2..e358bf2 100644 --- a/0002-iSulad-resolve-coredump-of-isula-inspect.patch +++ b/0002-iSulad-resolve-coredump-of-isula-inspect.patch @@ -1,7 +1,7 @@ -From 9e2556703a44d96feb66972541ce200cd018801a Mon Sep 17 00:00:00 2001 +From e822b71ddcc50611e0718304ab2f93e41632ca66 Mon Sep 17 00:00:00 2001 From: jikui Date: Tue, 23 Jun 2020 20:59:09 +0800 -Subject: [PATCH 2/6] iSulad: resolve coredump of isula inspect "" +Subject: [PATCH 02/12] iSulad: resolve coredump of isula inspect "" Signed-off-by: jikui --- @@ -9,7 +9,7 @@ Signed-off-by: jikui 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmd/isula/information/inspect.c b/src/cmd/isula/information/inspect.c -index e9b6ff6d..fe011ad9 100644 +index e9b6ff6..fe011ad 100644 --- a/src/cmd/isula/information/inspect.c +++ b/src/cmd/isula/information/inspect.c @@ -199,8 +199,9 @@ static int client_inspect_container(const struct isula_inspect_request *request, @@ -33,5 +33,5 @@ index e9b6ff6d..fe011ad9 100644 } exit(EXIT_SUCCESS); -- -2.25.1 +2.20.1 diff --git a/0003-Add-Pull-Request-Template-And-Issue-Template.patch b/0003-Add-Pull-Request-Template-And-Issue-Template.patch index b36c485..1d02dcc 100644 --- a/0003-Add-Pull-Request-Template-And-Issue-Template.patch +++ b/0003-Add-Pull-Request-Template-And-Issue-Template.patch @@ -1,7 +1,7 @@ -From 74229fbdc66ba00b8bb3febbd4cdfa3358375a9a Mon Sep 17 00:00:00 2001 +From edcab5958f38a7924700fa39b9142ad21062c79b Mon Sep 17 00:00:00 2001 From: wujing Date: Wed, 24 Jun 2020 11:11:45 +0800 -Subject: [PATCH 3/6] Add Pull Request Template And Issue Template +Subject: [PATCH 03/12] Add Pull Request Template And Issue Template Signed-off-by: wujing --- @@ -18,7 +18,7 @@ Signed-off-by: wujing diff --git a/.gitee/ISSUE_TEMPLATE.en.md b/.gitee/ISSUE_TEMPLATE.en.md new file mode 100644 -index 00000000..a00edf17 +index 0000000..a00edf1 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.en.md @@ -0,0 +1,13 @@ @@ -37,7 +37,7 @@ index 00000000..a00edf17 + diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 -index 00000000..aac2216e +index 0000000..aac2216 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,16 @@ @@ -59,7 +59,7 @@ index 00000000..aac2216e + diff --git a/.gitee/PULL_REQUEST_TEMPLATE.en.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md new file mode 100644 -index 00000000..911ad96d +index 0000000..911ad96 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.en.md @@ -0,0 +1,16 @@ @@ -81,7 +81,7 @@ index 00000000..911ad96d +### Validation Report diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 -index 00000000..a842cab7 +index 0000000..a842cab --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,15 @@ @@ -101,7 +101,7 @@ index 00000000..a842cab7 + +### 验证报告 diff --git a/.gitignore b/.gitignore -index 11cbe8e8..7e1bcf63 100644 +index 11cbe8e..7e1bcf6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,10 @@ build @@ -116,5 +116,5 @@ index 11cbe8e8..7e1bcf63 100644 +compile_commands.json +tags -- -2.25.1 +2.20.1 diff --git a/0004-fix-bug-of-creating-symlink-for-etc-mtab-when-etc-sy.patch b/0004-fix-bug-of-creating-symlink-for-etc-mtab-when-etc-sy.patch index 50c24f4..0567454 100644 --- a/0004-fix-bug-of-creating-symlink-for-etc-mtab-when-etc-sy.patch +++ b/0004-fix-bug-of-creating-symlink-for-etc-mtab-when-etc-sy.patch @@ -1,7 +1,7 @@ -From 274e8a2964d5d2ab566f92bd0930c08a346cb158 Mon Sep 17 00:00:00 2001 +From 3907941db7dc79e980a26639c17e05d1d0ab912a Mon Sep 17 00:00:00 2001 From: gaohuatao Date: Tue, 23 Jun 2020 06:40:17 -0400 -Subject: [PATCH 4/6] fix bug of creating symlink for /etc/mtab when /etc +Subject: [PATCH 04/12] fix bug of creating symlink for /etc/mtab when /etc symlink exists Signed-off-by: gaohuatao @@ -10,7 +10,7 @@ Signed-off-by: gaohuatao 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/services/execution/execute/execution.c b/src/services/execution/execute/execution.c -index 19b6a751..4ffcde7a 100644 +index 19b6a75..4ffcde7 100644 --- a/src/services/execution/execute/execution.c +++ b/src/services/execution/execute/execution.c @@ -818,30 +818,27 @@ static int create_mtab_link(const oci_runtime_spec *oci_spec) @@ -55,5 +55,5 @@ index 19b6a751..4ffcde7a 100644 out: free(slink); -- -2.25.1 +2.20.1 diff --git a/0005-fix-label-file-reading-bug.patch b/0005-fix-label-file-reading-bug.patch index 9b71313..1e12621 100644 --- a/0005-fix-label-file-reading-bug.patch +++ b/0005-fix-label-file-reading-bug.patch @@ -1,7 +1,7 @@ -From d5698095b50813afa2a0c0063c8a7c3df142bac9 Mon Sep 17 00:00:00 2001 +From ae7350ce59d092667a7777232b5364cc5c01115f Mon Sep 17 00:00:00 2001 From: wujing Date: Wed, 24 Jun 2020 12:07:39 +0800 -Subject: [PATCH 5/6] fix label-file reading bug +Subject: [PATCH 05/12] fix label-file reading bug Signed-off-by: wujing --- @@ -10,7 +10,7 @@ Signed-off-by: wujing 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/cmd/isula/base/create.c b/src/cmd/isula/base/create.c -index 6fbc294e..148eea16 100644 +index 6fbc294..148eea1 100644 --- a/src/cmd/isula/base/create.c +++ b/src/cmd/isula/base/create.c @@ -26,6 +26,7 @@ @@ -55,7 +55,7 @@ index 6fbc294e..148eea16 100644 out: diff --git a/src/services/execution/spec/selinux_label.c b/src/services/execution/spec/selinux_label.c -index 203ee29c..5732880f 100644 +index 203ee29..5732880 100644 --- a/src/services/execution/spec/selinux_label.c +++ b/src/services/execution/spec/selinux_label.c @@ -125,7 +125,6 @@ static void find_selinux_fs_among_mounts(char **fs) @@ -85,5 +85,5 @@ index 203ee29c..5732880f 100644 } if (verify_selinuxfs_mount(fields[MOUNT_POOINT_FIFTH_FIELD - 1])) { -- -2.25.1 +2.20.1 diff --git a/0006-CI-add-testcases-use-host-rootfs.patch b/0006-CI-add-testcases-use-host-rootfs.patch index 91a444c..32eb313 100644 --- a/0006-CI-add-testcases-use-host-rootfs.patch +++ b/0006-CI-add-testcases-use-host-rootfs.patch @@ -1,7 +1,7 @@ -From bb9fd6c70af00857af1e7cbfa14ccf31e2cbc1e5 Mon Sep 17 00:00:00 2001 +From 2b84ea779f90ded53c7f070feacd8defd0c9e333 Mon Sep 17 00:00:00 2001 From: lifeng68 Date: Wed, 24 Jun 2020 17:25:50 +0800 -Subject: [PATCH 6/6] CI: add testcases use host rootfs / +Subject: [PATCH 06/12] CI: add testcases use host rootfs / Signed-off-by: lifeng68 --- @@ -9,7 +9,7 @@ Signed-off-by: lifeng68 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CI/test_cases/basic_cases/run.bash b/CI/test_cases/basic_cases/run.bash -index 9b57c2e6..8db3f1ee 100755 +index 9b57c2e..8db3f1e 100755 --- a/CI/test_cases/basic_cases/run.bash +++ b/CI/test_cases/basic_cases/run.bash @@ -50,7 +50,7 @@ function do_test_t() @@ -40,5 +40,5 @@ index 9b57c2e6..8db3f1ee 100755 } -- -2.25.1 +2.20.1 diff --git a/0007-add-d-disk-param-for-CI.patch b/0007-add-d-disk-param-for-CI.patch new file mode 100644 index 0000000..79744ee --- /dev/null +++ b/0007-add-d-disk-param-for-CI.patch @@ -0,0 +1,50 @@ +From d796113df9573d123a147709dbdb8df66277c1d2 Mon Sep 17 00:00:00 2001 +From: gaohuatao +Date: Wed, 1 Jul 2020 14:13:03 +0800 +Subject: [PATCH 07/12] add -d/--disk param for CI + +Signed-off-by: gaohuatao +--- + CI/build.sh | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/CI/build.sh b/CI/build.sh +index fddde51..c599991 100755 +--- a/CI/build.sh ++++ b/CI/build.sh +@@ -34,6 +34,7 @@ LXC_LOCK_DIR_HOST="/tmp/lxc_mount_dir" + KEEP_CONTAINERS_ALIVE_DIR="/tmp/containerslock" + TESTCASE_ASSIGN="${CIDIR}/testcase_assign" + BASE_IMAGE="" ++disk=NULL + + rm -rf ${TESTCASE_ASSIGN}_* + +@@ -52,6 +53,7 @@ function usage() { + echo " -n, --container-num Multiple containers execute scripts in parallel" + echo " -g, --enable-gcov Enable gcov for code coverage analysis" + echo " -i, --ignore-ci Not running testcase" ++ echo " -d, --disk Specify the disk to create isulad-thinpool" + echo " --rm Auto remove containers after testcase run success" + echo " -h, --help Script help information" + } +@@ -60,7 +62,7 @@ function err() { + echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: $@" >&2 + } + +-args=`getopt -o m:n:g:i:h --long module:,container-num:,enable-gcov:,ignore-ci:,help -- "$@"` ++args=`getopt -o m:n:g:i:d:h --long module:,container-num:,enable-gcov:,ignore-ci:,disk:,help -- "$@"` + if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + eval set -- "$args" + +@@ -70,6 +72,7 @@ while true; do + -n|--container-num) container_nums=${2} ; shift 2 ;; + -g|--enable-gcov) enable_gcov=${2} ; shift 2 ;; + -i|--ignore-ci) ignore_ci=${2} ; shift 2 ;; ++ -d|--disk) disk=${2} ; shift 2 ;; + -h|--help) usage ; exit 0 ;; + --) shift ; break ;; + *) err "invalid parameter" ; exit -1 ;; +-- +2.20.1 + diff --git a/0008-events-fix-wrong-format-of-exec-command.patch b/0008-events-fix-wrong-format-of-exec-command.patch new file mode 100644 index 0000000..ad3f6f4 --- /dev/null +++ b/0008-events-fix-wrong-format-of-exec-command.patch @@ -0,0 +1,254 @@ +From 031a8aae207e1481c4a9698c8247ea1fe0e6c190 Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Wed, 1 Jul 2020 11:31:14 +0800 +Subject: [PATCH 08/12] events: fix wrong format of exec command + +Signed-off-by: lifeng68 +--- + src/cmd/isula/information/inspect.c | 2 +- + .../execution/execute/execution_stream.c | 77 +++++++------------ + 2 files changed, 30 insertions(+), 49 deletions(-) + +diff --git a/src/cmd/isula/information/inspect.c b/src/cmd/isula/information/inspect.c +index fe011ad..c3b0f19 100644 +--- a/src/cmd/isula/information/inspect.c ++++ b/src/cmd/isula/information/inspect.c +@@ -201,7 +201,7 @@ static int client_inspect_container(const struct isula_inspect_request *request, + if (ret != 0) { + if ((response->errmsg != NULL) && + (strstr(response->errmsg, "Inspect invalid name") != NULL || +- strstr(response->errmsg, "No such image or container or accelerator") != NULL)) { ++ strstr(response->errmsg, "No such image or container or accelerator") != NULL)) { + return CONTAINER_NOT_FOUND; + } + +diff --git a/src/services/execution/execute/execution_stream.c b/src/services/execution/execute/execution_stream.c +index ea57403..4576898 100644 +--- a/src/services/execution/execute/execution_stream.c ++++ b/src/services/execution/execute/execution_stream.c +@@ -58,8 +58,7 @@ static char *create_single_fifo(const char *statepath, const char *subpath, cons + return NULL; + } + +- nret = console_fifo_name(statepath, subpath, stdflag, fifo_name, PATH_MAX, +- fifo_path, sizeof(fifo_path), true); ++ nret = console_fifo_name(statepath, subpath, stdflag, fifo_name, PATH_MAX, fifo_path, sizeof(fifo_path), true); + if (nret != 0) { + ERROR("Failed to get console fifo name."); + free(fifo_name); +@@ -76,8 +75,8 @@ out: + return fifo_name; + } + +-static int do_create_daemon_fifos(const char *statepath, const char *subpath, bool attach_stdin, +- bool attach_stdout, bool attach_stderr, char *fifos[]) ++static int do_create_daemon_fifos(const char *statepath, const char *subpath, bool attach_stdin, bool attach_stdout, ++ bool attach_stderr, char *fifos[]) + { + int ret = -1; + +@@ -144,8 +143,8 @@ int create_daemon_fifos(const char *id, const char *runtime, bool attach_stdin, + goto cleanup; + } + +- nret = snprintf(subpath, PATH_MAX, "%s/%s/%u_%u_%u", id, operation, +- (unsigned int)tid, (unsigned int)now.tv_sec, (unsigned int)(now.tv_nsec)); ++ nret = snprintf(subpath, PATH_MAX, "%s/%s/%u_%u_%u", id, operation, (unsigned int)tid, (unsigned int)now.tv_sec, ++ (unsigned int)(now.tv_nsec)); + if (nret >= PATH_MAX || nret < 0) { + ERROR("Failed to print string"); + goto cleanup; +@@ -497,8 +496,7 @@ err_out: + return NULL; + } + +-static int exec_container(container_t *cont, const char *runtime, char * const console_fifos[], +- defs_process_user *puser, ++static int exec_container(container_t *cont, const char *runtime, char * const console_fifos[], defs_process_user *puser, + const container_exec_request *request, int *exit_code) + { + int ret = 0; +@@ -615,9 +613,8 @@ static int exec_prepare_console(container_t *cont, const container_exec_request + const char *id = cont->common_config->id; + + if (request->attach_stdin || request->attach_stdout || request->attach_stderr) { +- if (create_daemon_fifos(id, cont->runtime, request->attach_stdin, +- request->attach_stdout, request->attach_stderr, +- "exec", fifos, fifopath)) { ++ if (create_daemon_fifos(id, cont->runtime, request->attach_stdin, request->attach_stdout, ++ request->attach_stderr, "exec", fifos, fifopath)) { + ret = -1; + goto out; + } +@@ -628,8 +625,8 @@ static int exec_prepare_console(container_t *cont, const container_exec_request + ret = -1; + goto out; + } +- if (ready_copy_io_data(*sync_fd, false, request->stdin, request->stdout, request->stderr, +- stdinfd, stdout_handler, stderr_handler, (const char **)fifos, thread_id)) { ++ if (ready_copy_io_data(*sync_fd, false, request->stdin, request->stdout, request->stderr, stdinfd, ++ stdout_handler, stderr_handler, (const char **)fifos, thread_id)) { + ret = -1; + goto out; + } +@@ -673,8 +670,8 @@ static int get_exec_user_info(const container_t *cont, const char *username, def + ERROR("Out of memory"); + return -1; + } +- ret = im_get_user_conf(cont->common_config->image_type, cont->common_config->base_fs, +- cont->hostconfig, username, *puser); ++ ret = im_get_user_conf(cont->common_config->image_type, cont->common_config->base_fs, cont->hostconfig, username, ++ *puser); + if (ret != 0) { + ERROR("Get user failed with '%s'", username ? username : ""); + ret = -1; +@@ -683,28 +680,17 @@ static int get_exec_user_info(const container_t *cont, const char *username, def + out: + return ret; + } +-static void get_exec_command(const container_config *conf, const container_exec_request *request, +- char *exec_command, size_t len) ++static void get_exec_command(const container_exec_request *request, char *exec_command, size_t len) + { + size_t i; + bool should_abbreviated = false; + size_t start = 0; + size_t end = 0; + +- for (i = 0; i < conf->entrypoint_len; i++) { +- if (strlen(conf->entrypoint[i]) < len - strlen(exec_command)) { +- (void)strcat(exec_command, conf->entrypoint[i]); +- (void)strcat(exec_command, " "); +- } else { +- should_abbreviated = true; +- goto out; +- } +- } +- + for (i = 0; i < request->argv_len; i++) { + if (strlen(request->argv[i]) < len - strlen(exec_command)) { + (void)strcat(exec_command, request->argv[i]); +- if (i != request->argv_len) { ++ if (i != (request->argv_len - 1)) { + (void)strcat(exec_command, " "); + } + } else { +@@ -729,8 +715,8 @@ out: + } + } + +-static int container_exec_cb(const container_exec_request *request, container_exec_response **response, +- int stdinfd, struct io_write_wrapper *stdout_handler, struct io_write_wrapper *stderr_handler) ++static int container_exec_cb(const container_exec_request *request, container_exec_response **response, int stdinfd, ++ struct io_write_wrapper *stdout_handler, struct io_write_wrapper *stderr_handler) + { + int exit_code = 0; + int sync_fd = -1; +@@ -741,7 +727,7 @@ static int container_exec_cb(const container_exec_request *request, container_ex + pthread_t thread_id = 0; + container_t *cont = NULL; + defs_process_user *puser = NULL; +- char exec_command[ARGS_MAX] = {0x00}; ++ char exec_command[ARGS_MAX] = { 0x00 }; + + DAEMON_CLEAR_ERRMSG(); + if (request == NULL || response == NULL) { +@@ -757,7 +743,7 @@ static int container_exec_cb(const container_exec_request *request, container_ex + isula_libutils_set_log_prefix(id); + EVENT("Event: {Object: %s, Type: execing}", id); + +- get_exec_command(cont->common_config->config, request, exec_command, sizeof(exec_command)); ++ get_exec_command(request, exec_command, sizeof(exec_command)); + (void)isulad_monitor_send_container_event(id, EXEC_CREATE, -1, 0, exec_command, NULL); + + if (gc_is_gc_progress(id)) { +@@ -911,8 +897,8 @@ static int attach_prepare_console(const container_t *cont, const container_attac + goto out; + } + +- if (ready_copy_io_data(-1, true, request->stdin, request->stdout, request->stderr, +- stdinfd, stdout_handler, stderr_handler, (const char **)fifos, tid)) { ++ if (ready_copy_io_data(-1, true, request->stdin, request->stdout, request->stderr, stdinfd, stdout_handler, ++ stderr_handler, (const char **)fifos, tid)) { + ret = -1; + goto out; + } +@@ -1003,8 +989,7 @@ pack_response: + } + + static int copy_from_container_cb_check(const struct isulad_copy_from_container_request *request, +- struct isulad_copy_from_container_response **response, +- container_t **cont) ++ struct isulad_copy_from_container_response **response, container_t **cont) + { + int ret = -1; + char *name = NULL; +@@ -1046,8 +1031,8 @@ out: + } + + static int archive_and_send_copy_data(const stream_func_wrapper *stream, +- struct isulad_copy_from_container_response *response, +- const char *resolvedpath, const char *abspath) ++ struct isulad_copy_from_container_response *response, const char *resolvedpath, ++ const char *abspath) + { + int ret = -1; + int nret; +@@ -1188,8 +1173,7 @@ cleanup: + return stat; + } + +-static int copy_from_container_send_path_stat(const stream_func_wrapper *stream, +- const container_path_stat *stat) ++static int copy_from_container_send_path_stat(const stream_func_wrapper *stream, const container_path_stat *stat) + { + int ret = -1; + char *json = NULL; +@@ -1386,8 +1370,7 @@ pack_response: + return ret; + } + +-static int copy_to_container_cb_check(const container_copy_to_request *request, +- container_t **cont) ++static int copy_to_container_cb_check(const container_copy_to_request *request, container_t **cont) + { + int ret = -1; + char *name = NULL; +@@ -1516,8 +1499,8 @@ cleanup: + return dstdir; + } + +-static int copy_to_container_resolve_path(const container_t *cont, const char *dstdir, +- char **resolvedpath, char **abspath) ++static int copy_to_container_resolve_path(const container_t *cont, const char *dstdir, char **resolvedpath, ++ char **abspath) + { + int ret = -1; + char *joined = NULL; +@@ -1586,8 +1569,7 @@ cleanup: + return ret; + } + +-static int copy_to_container_cb(const container_copy_to_request *request, +- stream_func_wrapper *stream, char **err) ++static int copy_to_container_cb(const container_copy_to_request *request, stream_func_wrapper *stream, char **err) + { + int ret = -1; + int nret; +@@ -2281,7 +2263,7 @@ static int container_logs_cb(const struct isulad_logs_request *request, stream_f + char *id = NULL; + container_t *cont = NULL; + struct container_log_config *log_config = NULL; +- struct last_log_file_position last_pos = {0}; ++ struct last_log_file_position last_pos = { 0 }; + Container_Status status = CONTAINER_STATUS_UNKNOWN; + + *response = (struct isulad_logs_response *)util_common_calloc_s(sizeof(struct isulad_logs_response)); +@@ -2376,4 +2358,3 @@ void container_stream_callback_init(service_container_callback_t *cb) + cb->copy_to_container = copy_to_container_cb; + cb->logs = container_logs_cb; + } +- +-- +2.20.1 + diff --git a/0009-fix-create-mtab-bug-to-use-lstat.patch b/0009-fix-create-mtab-bug-to-use-lstat.patch new file mode 100644 index 0000000..b98c930 --- /dev/null +++ b/0009-fix-create-mtab-bug-to-use-lstat.patch @@ -0,0 +1,70 @@ +From 8e5863fc9dd9795bcfa5a11b3c1d609e4f73465e Mon Sep 17 00:00:00 2001 +From: gaohuatao +Date: Thu, 2 Jul 2020 10:16:19 +0800 +Subject: [PATCH 09/12] fix create mtab bug to use lstat + +Signed-off-by: gaohuatao +--- + src/cutils/utils_file.c | 18 ++++++++++++++++++ + src/cutils/utils_file.h | 2 ++ + src/services/execution/execute/execution.c | 2 +- + 3 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/src/cutils/utils_file.c b/src/cutils/utils_file.c +index f543145..1969d38 100644 +--- a/src/cutils/utils_file.c ++++ b/src/cutils/utils_file.c +@@ -51,6 +51,24 @@ bool util_dir_exists(const char *path) + return S_ISDIR(s.st_mode); + } + ++// This function is identical to "util_file_exists",except that if f is a symbolic file, return true ++bool util_fileself_exists(const char *f) ++{ ++ struct stat buf; ++ int nret; ++ ++ if (f == NULL) { ++ return false; ++ } ++ ++ nret = lstat(f, &buf); ++ if (nret < 0) { ++ return false; ++ } ++ return true; ++} ++ ++// When f is a symbolic file, if the file that it refers to not exits ,return false + bool util_file_exists(const char *f) + { + struct stat buf; +diff --git a/src/cutils/utils_file.h b/src/cutils/utils_file.h +index 11f702f..6944a4a 100644 +--- a/src/cutils/utils_file.h ++++ b/src/cutils/utils_file.h +@@ -27,6 +27,8 @@ extern "C" { + + bool util_dir_exists(const char *path); + ++bool util_fileself_exists(const char *f); ++ + bool util_file_exists(const char *f); + + int util_path_remove(const char *path); +diff --git a/src/services/execution/execute/execution.c b/src/services/execution/execute/execution.c +index 4ffcde7..e6ce152 100644 +--- a/src/services/execution/execute/execution.c ++++ b/src/services/execution/execute/execution.c +@@ -822,7 +822,7 @@ static int create_mtab_link(const oci_runtime_spec *oci_spec) + WARN("Failed to delete \"%s\": %s", dir, strerror(errno)); + } + +- if (util_file_exists(slink)) { ++ if (util_fileself_exists(slink)) { + goto out; + } + +-- +2.20.1 + diff --git a/0010-init-struct.patch b/0010-init-struct.patch new file mode 100644 index 0000000..614170c --- /dev/null +++ b/0010-init-struct.patch @@ -0,0 +1,41 @@ +From 219d340263a0791be24ce7a9a8f300bc9342a4ec Mon Sep 17 00:00:00 2001 +From: haozi007 +Date: Thu, 2 Jul 2020 19:55:18 +0800 +Subject: [PATCH 10/12] init struct + +Signed-off-by: haozi007 +--- + src/services/execution/execute/execution_stream.c | 3 ++- + src/services/execution/manager/container_unix.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/services/execution/execute/execution_stream.c b/src/services/execution/execute/execution_stream.c +index 4576898..5b3ad4e 100644 +--- a/src/services/execution/execute/execution_stream.c ++++ b/src/services/execution/execute/execution_stream.c +@@ -496,7 +496,8 @@ err_out: + return NULL; + } + +-static int exec_container(container_t *cont, const char *runtime, char * const console_fifos[], defs_process_user *puser, ++static int exec_container(container_t *cont, const char *runtime, char * const console_fifos[], ++ defs_process_user *puser, + const container_exec_request *request, int *exit_code) + { + int ret = 0; +diff --git a/src/services/execution/manager/container_unix.c b/src/services/execution/manager/container_unix.c +index f18ed15..a3578e7 100644 +--- a/src/services/execution/manager/container_unix.c ++++ b/src/services/execution/manager/container_unix.c +@@ -591,7 +591,7 @@ static int container_save_config_v2(const container_t *cont) + int ret = 0; + char *json_v2 = NULL; + parser_error err = NULL; +- container_config_v2 config_v2; ++ container_config_v2 config_v2 = {0}; + + if (cont == NULL) { + return -1; +-- +2.20.1 + diff --git a/0011-Fix-stuck-problem-caused-by-websocket-traffic-restri.patch b/0011-Fix-stuck-problem-caused-by-websocket-traffic-restri.patch new file mode 100644 index 0000000..f82f662 --- /dev/null +++ b/0011-Fix-stuck-problem-caused-by-websocket-traffic-restri.patch @@ -0,0 +1,102 @@ +From 47714fbf8944a14c64751af223edcb8a743177cd Mon Sep 17 00:00:00 2001 +From: wujing +Date: Fri, 3 Jul 2020 16:49:06 +0800 +Subject: [PATCH 11/12] Fix stuck problem caused by websocket traffic + restrictions + +Signed-off-by: wujing +--- + src/websocket/service/ws_server.cc | 16 ++-------------- + src/websocket/service/ws_server.h | 16 +++------------- + 2 files changed, 5 insertions(+), 27 deletions(-) + +diff --git a/src/websocket/service/ws_server.cc b/src/websocket/service/ws_server.cc +index 01f1dd3..bd1f39b 100644 +--- a/src/websocket/service/ws_server.cc ++++ b/src/websocket/service/ws_server.cc +@@ -288,18 +288,8 @@ int WebsocketServer::Wswrite(struct lws *wsi, void *in, size_t len) + return 0; + } + +-void WebsocketServer::Receive(struct lws *wsi, void *user, void *in, size_t len) ++void WebsocketServer::Receive(struct lws *wsi, void *in, size_t len) + { +- if (user != nullptr) { +- struct per_session_data__echo *pss = (struct per_session_data__echo *)user; +- pss->final = lws_is_final_fragment(wsi); +- pss->binary = lws_frame_is_binary(wsi); +- +- (void)memcpy(&pss->buf[LWS_PRE], in, len); +- pss->len = (unsigned int)len; +- pss->rx += len; +- lws_rx_flow_control(wsi, 0); +- } + if (m_wsis.find(wsi) == m_wsis.end()) { + ERROR("invailed websocket session!"); + return; +@@ -353,13 +343,11 @@ int WebsocketServer::Callback(struct lws *wsi, enum lws_callback_reasons reason, + return -1; + } + WebsocketServer::GetInstance()->SetLwsSendedFlag(wsi, true); +- lws_rx_flow_control(wsi, 1); + } + break; + case LWS_CALLBACK_RECEIVE: { + std::lock_guard lock(m_mutex); +- WebsocketServer::GetInstance()->Receive(wsi, nullptr, (char *)in, len); +- lws_rx_flow_control(wsi, 0); ++ WebsocketServer::GetInstance()->Receive(wsi, (char *)in, len); + } + break; + case LWS_CALLBACK_CLOSED: { +diff --git a/src/websocket/service/ws_server.h b/src/websocket/service/ws_server.h +index 761d7ab..35f0c5f 100644 +--- a/src/websocket/service/ws_server.h ++++ b/src/websocket/service/ws_server.h +@@ -27,7 +27,7 @@ + #include "url.h" + #include "errors.h" + +-#define MAX_ECHO_PAYLOAD 1024 ++#define MAX_ECHO_PAYLOAD 4096 + #define MAX_ARRAY_LEN 2 + #define MAX_BUF_LEN 256 + #define MAX_PROTOCOL_NUM 2 +@@ -37,16 +37,6 @@ + #define BUF_BASE_SIZE 1024 + #define LWS_TIMEOUT 50 + +-struct per_session_data__echo { +- size_t rx, tx; +- unsigned char buf[LWS_PRE + MAX_ECHO_PAYLOAD + 1]; +- unsigned int len; +- unsigned int index; +- int final; +- int continuation; +- int binary; +-}; +- + enum WebsocketChannel { + STDINCHANNEL = 0, + STDOUTCHANNEL, +@@ -95,7 +85,7 @@ private: + std::vector split(std::string str, char r); + static void EmitLog(int level, const char *line); + int CreateContext(); +- inline void Receive(struct lws *client, void *user, void *in, size_t len); ++ inline void Receive(struct lws *client, void *in, size_t len); + int Wswrite(struct lws *wsi, void *in, size_t len); + inline int DumpHandshakeInfo(struct lws *wsi) noexcept; + static int Callback(struct lws *wsi, enum lws_callback_reasons reason, +@@ -110,7 +100,7 @@ private: + volatile int m_force_exit = 0; + std::thread m_pthread_service; + const struct lws_protocols m_protocols[MAX_PROTOCOL_NUM] = { +- { "channel.k8s.io", Callback, sizeof(struct per_session_data__echo), MAX_ECHO_PAYLOAD, }, ++ { "channel.k8s.io", Callback, 0, MAX_ECHO_PAYLOAD, }, + { NULL, NULL, 0, 0 } + }; + RouteCallbackRegister m_handler; +-- +2.20.1 + diff --git a/0012-build-add-checkout-LTS-tag-for-third-party-software.patch b/0012-build-add-checkout-LTS-tag-for-third-party-software.patch new file mode 100644 index 0000000..0c629e4 --- /dev/null +++ b/0012-build-add-checkout-LTS-tag-for-third-party-software.patch @@ -0,0 +1,127 @@ +From 153a5e686f40870f16924fa643290704994bc95e Mon Sep 17 00:00:00 2001 +From: lifeng68 +Date: Thu, 9 Jul 2020 19:17:05 +0800 +Subject: [PATCH 12/12] build: add checkout LTS tag for third party software + +Signed-off-by: lifeng68 +--- + Dockerfile | 9 ++++++++- + docs/build_guide.md | 5 +++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/Dockerfile b/Dockerfile +index 67c2272..11d31de 100644 +--- a/Dockerfile ++++ b/Dockerfile +@@ -118,7 +118,7 @@ RUN set -x && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/cmake.git && \ + cd cmake && \ +- git checkout origin/openEuler-20.03-LTS && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf cmake-3.12.1.tar.gz && \ + cd cmake-3.12.1 && \ + ./bootstrap && make && make install && \ +@@ -131,6 +131,7 @@ RUN set -x && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/protobuf.git && \ + cd protobuf && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf protobuf-all-3.9.0.tar.gz && \ + cd protobuf-3.9.0 && \ + ./autogen.sh && \ +@@ -145,6 +146,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/c-ares.git && \ + cd c-ares && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf c-ares-1.15.0.tar.gz && \ + cd c-ares-1.15.0 && \ + autoreconf -if && \ +@@ -159,6 +161,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/grpc.git && \ + cd grpc && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf grpc-1.22.0.tar.gz && \ + cd grpc-1.22.0 && \ + make -j $(nproc) && \ +@@ -171,6 +174,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/libevent.git && \ + cd libevent && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf libevent-2.1.11-stable.tar.gz && \ + cd libevent-2.1.11-stable && \ + ./autogen.sh && \ +@@ -185,6 +189,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/libevhtp.git && \ + cd libevhtp && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf libevhtp-1.2.18.tar.gz && \ + cd libevhtp-1.2.18 && \ + patch -p1 -F1 -s < ../0001-decrease-numbers-of-fd-for-shared-pipe-mode.patch && \ +@@ -205,6 +210,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/http-parser.git && \ + cd http-parser && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf http-parser-2.9.2.tar.gz && \ + cd http-parser-2.9.2 && \ + make -j CFLAGS="-Wno-error" && \ +@@ -217,6 +223,7 @@ RUN export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH && \ + cd ~ && \ + git clone https://gitee.com/src-openeuler/libwebsockets.git && \ + cd libwebsockets && \ ++ git checkout openEuler-20.03-LTS-tag && \ + tar -xzvf libwebsockets-2.4.2.tar.gz && \ + cd libwebsockets-2.4.2 && \ + patch -p1 -F1 -s < ../libwebsockets-fix-coredump.patch && \ +diff --git a/docs/build_guide.md b/docs/build_guide.md +index 6d19b87..310071b 100644 +--- a/docs/build_guide.md ++++ b/docs/build_guide.md +@@ -29,6 +29,7 @@ $ sudo -E echo "/usr/local/lib" >> /etc/ld.so.conf + ``` + $ git clone https://gitee.com/src-openeuler/protobuf.git + $ cd protobuf ++$ git checkout openEuler-20.03-LTS-tag + $ tar -xzvf protobuf-all-3.9.0.tar.gz + $ cd protobuf-3.9.0 + $ sudo -E ./autogen.sh +@@ -42,6 +43,7 @@ $ sudo -E ldconfig + ``` + $ git clone https://gitee.com/src-openeuler/c-ares.git + $ cd c-ares ++$ git checkout openEuler-20.03-LTS-tag + $ tar -xzvf c-ares-1.15.0.tar.gz + $ cd c-ares-1.15.0 + $ sudo -E autoreconf -if +@@ -55,6 +57,7 @@ $ sudo -E ldconfig + ``` + $ git clone https://gitee.com/src-openeuler/grpc.git + $ cd grpc ++$ git checkout openEuler-20.03-LTS-tag + $ tar -xzvf grpc-1.22.0.tar.gz + $ cd grpc-1.22.0 + $ sudo -E make -j $(nproc) +@@ -66,6 +69,7 @@ $ sudo -E ldconfig + ``` + $ git clone https://gitee.com/src-openeuler/http-parser.git + $ cd http-parser ++$ git checkout openEuler-20.03-LTS-tag + $ tar -xzvf http-parser-2.9.2.tar.gz + $ cd http-parser-2.9.2 + $ sudo -E make -j CFLAGS="-Wno-error" +@@ -77,6 +81,7 @@ $ sudo -E ldconfig + ``` + $ git clone https://gitee.com/src-openeuler/libwebsockets.git + $ cd libwebsockets ++$ git checkout openEuler-20.03-LTS-tag + $ tar -xzvf libwebsockets-2.4.2.tar.gz + $ cd libwebsockets-2.4.2 + $ patch -p1 -F1 -s < ../libwebsockets-fix-coredump.patch +-- +2.20.1 + diff --git a/iSulad.spec b/iSulad.spec index 40ea721..d46c4ea 100644 --- a/iSulad.spec +++ b/iSulad.spec @@ -1,5 +1,5 @@ %global _version 2.0.3 -%global _release 20200628.170704.git76a33943 +%global _release 20200714.103041.git4c67aa03 %global is_systemd 1 %global debug_package %{nil} @@ -8,7 +8,7 @@ Version: %{_version} Release: %{_release} Summary: Lightweight Container Runtime Daemon License: Mulan PSL v2 -URL: https://gitee.com/openeuler/iSulad +URL: https://gitee.com/openeuler/iSuladd40006-CI-add-testcases-use-host-rootfs.patch Source: iSulad-%{version}.tar.gz BuildRoot: {_tmppath}/iSulad-%{version} ExclusiveArch: x86_64 aarch64 @@ -19,6 +19,12 @@ Patch9002: 0003-Add-Pull-Request-Template-And-Issue-Template.patch Patch9003: 0004-fix-bug-of-creating-symlink-for-etc-mtab-when-etc-sy.patch Patch9004: 0005-fix-label-file-reading-bug.patch Patch9005: 0006-CI-add-testcases-use-host-rootfs.patch +Patch9006: 0007-add-d-disk-param-for-CI.patch +Patch9007: 0008-events-fix-wrong-format-of-exec-command.patch +Patch9008: 0009-fix-create-mtab-bug-to-use-lstat.patch +Patch9009: 0010-init-struct.patch +Patch9010: 0011-Fix-stuck-problem-caused-by-websocket-traffic-restri.patch +Patch9011: 0012-build-add-checkout-LTS-tag-for-third-party-software.patch %ifarch x86_64 aarch64 Provides: libhttpclient.so()(64bit)