From da1bf03705d2ab874b1e4ae524dceaa10ef28b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Tue, 6 Jun 2023 13:37:42 +0200 Subject: [PATCH 01/13] fix module name handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 2628940c2..45e4734fb 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,16 +1985,15 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char *nameToLoad = (char*)moduleName; + char *nameToLoad = malloc(modNameLen + 4); // in case .js is not included if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ /* printf("module filename already has extension '%s'\n",nativeName); */ + memcpy(nameToLoad, moduleName, modNameLen); } else { - char asciiExtendedName[modNameLen+3+1]; - memcpy(asciiExtendedName,moduleName,modNameLen); - memcpy(asciiExtendedName+modNameLen,asciiDotJS,4); - nameToLoad = asciiExtendedName; + memcpy(nameToLoad, moduleName, modNameLen); + memcpy(nameToLoad + modNameLen, asciiDotJS, 4); } buf = js_load_file(ctx, &buf_len, nameToLoad); if (!buf){ From 16a658d24f60bcb46b11fa3c37ff868c15319797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Tue, 6 Jun 2023 14:21:22 +0200 Subject: [PATCH 02/13] fix log message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 45e4734fb..8de7e06f1 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -2030,8 +2030,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, } #endif - JS_ThrowReferenceError(ctx, "could not load module filename '%s'", - nameToLoad); + JS_ThrowReferenceError(ctx, "could not load module filename '%s'", nativeName); return NULL; } else { convertFromNative((char*)buf, (int)buf_len); From e50436795a4691cf4510c591f147a08ac08f93d5 Mon Sep 17 00:00:00 2001 From: struga0258 Date: Tue, 6 Jun 2023 17:06:25 +0000 Subject: [PATCH 03/13] v2.9.1 Signed-off-by: struga0258 --- build/configmgr.proj.env | 2 +- manifest.template.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/configmgr.proj.env b/build/configmgr.proj.env index 8c9d29e9a..048968067 100644 --- a/build/configmgr.proj.env +++ b/build/configmgr.proj.env @@ -1,5 +1,5 @@ PROJECT="configmgr" -VERSION=2.9.0 +VERSION=2.9.1 DEPS="QUICKJS LIBYAML" QUICKJS="quickjs" diff --git a/manifest.template.yaml b/manifest.template.yaml index 1e8b38f8d..879fa7177 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -1,7 +1,7 @@ --- name: zowe-common-c -version: 2.9.0 +version: 2.9.1 homepage: https://zowe.org keywords: From bed40bd776389ef0f5faa728fcb59f841792904c Mon Sep 17 00:00:00 2001 From: James Struga Date: Tue, 6 Jun 2023 13:13:24 -0400 Subject: [PATCH 04/13] set default bump version to minor Signed-off-by: James Struga --- .github/workflows/build-configmgr.yml | 2 +- build/configmgr.proj.env | 2 +- manifest.template.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-configmgr.yml b/.github/workflows/build-configmgr.yml index 15f34aae1..350a4bd6b 100644 --- a/.github/workflows/build-configmgr.yml +++ b/.github/workflows/build-configmgr.yml @@ -91,6 +91,6 @@ jobs: if: ${{ github.event.inputs.PERFORM_RELEASE == 'true' }} uses: zowe-actions/zlux-builds/bump-zis-version@v2.x/main with: - version: 'PATCH' + version: 'MINOR' env: GITHUB_TOKEN: ${{ secrets.ZOWE_ROBOT_TOKEN }} diff --git a/build/configmgr.proj.env b/build/configmgr.proj.env index 048968067..93945819e 100644 --- a/build/configmgr.proj.env +++ b/build/configmgr.proj.env @@ -1,5 +1,5 @@ PROJECT="configmgr" -VERSION=2.9.1 +VERSION=2.10.0 DEPS="QUICKJS LIBYAML" QUICKJS="quickjs" diff --git a/manifest.template.yaml b/manifest.template.yaml index 879fa7177..0131e2e36 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -1,7 +1,7 @@ --- name: zowe-common-c -version: 2.9.1 +version: 2.10.0 homepage: https://zowe.org keywords: From d6fba1855111c80363c7e3ecebb3bfb8d0162743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Tue, 6 Jun 2023 20:30:08 +0200 Subject: [PATCH 05/13] review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 8de7e06f1..81535d07d 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,7 +1985,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char *nameToLoad = malloc(modNameLen + 4); // in case .js is not included + char *nameToLoad = safeMalloc(modNameLen + 4, "UTF-8 module path"); // in case .js is not included if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ @@ -1996,6 +1996,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, memcpy(nameToLoad + modNameLen, asciiDotJS, 4); } buf = js_load_file(ctx, &buf_len, nameToLoad); + free(nameToLoad); if (!buf){ fprintf(stderr,"js_load_file failure. A file requested module '%s' but it could not be loaded.\n",nativeName); fflush(stderr); From 3e6cdf6af0235c901f7f0ef6450a48cc77ed0a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Tue, 6 Jun 2023 21:53:15 +0200 Subject: [PATCH 06/13] safeFree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 81535d07d..a517ce3fd 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1996,7 +1996,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, memcpy(nameToLoad + modNameLen, asciiDotJS, 4); } buf = js_load_file(ctx, &buf_len, nameToLoad); - free(nameToLoad); + safeFree(nameToLoad, modNameLen + 4); if (!buf){ fprintf(stderr,"js_load_file failure. A file requested module '%s' but it could not be loaded.\n",nativeName); fflush(stderr); From af64cb8575f9665c32d53a45d6fbf30917240c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Wed, 7 Jun 2023 14:46:15 +0200 Subject: [PATCH 07/13] array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index a517ce3fd..6f0b5d49a 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,7 +1985,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char *nameToLoad = safeMalloc(modNameLen + 4, "UTF-8 module path"); // in case .js is not included + char *nameToLoad = char asciiExtendedName[modNameLen + 3 + 1]; if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ @@ -1996,7 +1996,6 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, memcpy(nameToLoad + modNameLen, asciiDotJS, 4); } buf = js_load_file(ctx, &buf_len, nameToLoad); - safeFree(nameToLoad, modNameLen + 4); if (!buf){ fprintf(stderr,"js_load_file failure. A file requested module '%s' but it could not be loaded.\n",nativeName); fflush(stderr); From c11f1d88af8d7cac259332dce37e3771ae57e4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Wed, 7 Jun 2023 14:53:06 +0200 Subject: [PATCH 08/13] fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 6f0b5d49a..661eb16e5 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,7 +1985,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char *nameToLoad = char asciiExtendedName[modNameLen + 3 + 1]; + char nameToLoad[modNameLen + 3 + 1]; if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ From 1c97e883dfff4b43e314b6c6fae8774f6735ffb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Wed, 7 Jun 2023 17:43:56 +0200 Subject: [PATCH 09/13] replace hardcoded numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 661eb16e5..2fe39d901 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,7 +1985,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char nameToLoad[modNameLen + 3 + 1]; + char nameToLoad[modNameLen + sizeof(asciiDotJS) + 1] = {0}; if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ @@ -1993,7 +1993,7 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, memcpy(nameToLoad, moduleName, modNameLen); } else { memcpy(nameToLoad, moduleName, modNameLen); - memcpy(nameToLoad + modNameLen, asciiDotJS, 4); + memcpy(nameToLoad + modNameLen, asciiDotJS, sizeof(asciiDotJS)); } buf = js_load_file(ctx, &buf_len, nameToLoad); if (!buf){ From d03405fee15776dd7b91521af3f65b714c5ddbac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Hern=C3=A1n=20Carle?= Date: Wed, 7 Jun 2023 18:35:35 +0200 Subject: [PATCH 10/13] fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pablo Hernán Carle --- c/embeddedjs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/c/embeddedjs.c b/c/embeddedjs.c index 2fe39d901..21a66dfdd 100644 --- a/c/embeddedjs.c +++ b/c/embeddedjs.c @@ -1985,7 +1985,9 @@ JSModuleDef *ejsModuleLoader(JSContext *ctx, size_t buf_len; uint8_t *buf; JSValue func_val; - char nameToLoad[modNameLen + sizeof(asciiDotJS) + 1] = {0}; + const size_t len = modNameLen + sizeof(asciiDotJS) + 1; + char nameToLoad[len]; + memset(nameToLoad, 0, len); if (endsWith(nativeName,".js") || endsWith(nativeName,".mjs")){ From 6c18514fb480b991b523662417ed54ec273c2932 Mon Sep 17 00:00:00 2001 From: Martin Zeithaml Date: Thu, 29 Jun 2023 16:10:46 +0200 Subject: [PATCH 11/13] Process long strings (length>256) correctly Signed-off-by: Martin Zeithaml --- c/yaml2json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/yaml2json.c b/c/yaml2json.c index fa234d3ad..dc343bff7 100644 --- a/c/yaml2json.c +++ b/c/yaml2json.c @@ -925,7 +925,7 @@ static int emitScalar(yaml_emitter_t *emitter, char *scalar, char *tag, int styl static int writeJsonAsYaml1(yaml_emitter_t *emitter, Json *json){ yaml_event_t event; - char scalarBuffer[256]; + char scalarBuffer[MAX_ACCESS_PATH]; if (jsonIsArray(json)){ JsonArray *array = jsonAsArray(json); int elementCount = jsonArrayGetCount(array); From 264312fb9a88e225067c428b823d9712131a94c2 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Thu, 29 Jun 2023 10:35:56 -0400 Subject: [PATCH 12/13] Update CHANGELOG.md Updated changelog to explain bugfix. Signed-off-by: 1000TurquoisePogs --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c00b744c..794bc0914 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Zowe Common C Changelog +## `2.10.0` + +- Bugfix: configmgr parsing of yaml to json was limited to 256 characters for strings. This has been updated to 1024 to allow for up to max unix path strings. (#383) + ## `2.9.0` - Feature: configmgr's zos module now has a "resolveSymbol" function which takes a string starting with & which can be used to resolve static and dynamic zos symbols From 677fbad519be2feb330856fba7654ac4963d2f81 Mon Sep 17 00:00:00 2001 From: JoeNemo Date: Thu, 6 Jul 2023 16:13:15 -0400 Subject: [PATCH 13/13] Adding embed ZOS feature to changelog Signed-off-by: JoeNemo --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c00b744c..9c1128ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Zowe Common C Changelog +## `2.10.0` + +- Feature: The configmgr can now use the zos module in embedded code inside yaml files. The configmgr runs scripts with ES6 style modules, but has a more limited environment (currently) in embedded JS. The modules made visible are done so explicitly in embeddedjs.c, but this eventually could be made configurable more softly. The ZOS module is only added when run on ZOS and includes things like looking up dataset info, manipulating file tags, and using the 'extattr' function to change non-POSIX file attributes. + ## `2.9.0` - Feature: configmgr's zos module now has a "resolveSymbol" function which takes a string starting with & which can be used to resolve static and dynamic zos symbols