From b064a3d1b9d36ac6fa96d8749a529bcb5e6a3751 Mon Sep 17 00:00:00 2001 From: hellkite500 Date: Wed, 17 Jan 2024 07:03:45 -0700 Subject: [PATCH] fix(ngen): remove custom patches breaking build, all patches have merged upstream --- docker/Dockerfile.ngen | 23 ++-- ...590a415b89026559c1c570d4154e4746161b.patch | 119 ------------------ 2 files changed, 15 insertions(+), 127 deletions(-) delete mode 100644 docker/fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch diff --git a/docker/Dockerfile.ngen b/docker/Dockerfile.ngen index cad3530..1dad658 100644 --- a/docker/Dockerfile.ngen +++ b/docker/Dockerfile.ngen @@ -89,15 +89,22 @@ USER ${USER} #These patches are from ngen commit 7551590a415b89026559c1c570d4154e4746161b #and are needed to fix an I/O bug in the sub modules (and bmi tests) that cause an infinite loop #https://github.com/NOAA-OWP/ngen/pull/515, https://github.com/NOAA-OWP/ngen/pull/518 both merged upstream, patch no longer needed -# All the affected submodules have patched/merged in their respective upstream repos, -# but ngen submodules have not been updated to the current HEAD -# of all the submdoules, and that might prove difficult to do in the near future, but if that does happen, -# then this can be removed at that point. -COPY fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch ${WORKDIR}/ngen/fix_io_sub.patch +# All the affected submodules have been patched and the ngen submodule commits have been updated +# so this patch is no longer needed. I'm leaving these lines commented out in case custom patches +# need to be applied in the future. +# Patches can be generated with +# generate submodule patch: +#git submodule --quiet foreach --recursive 'export NAME="${PWD##*/}"; git --no-pager diff --src-prefix="a/extern/${NAME}/${NAME}/" --dst-prefix="b/extern/${NAME}/${NAME}/"' > fix_io_sub.patch +# generate patch of ngen without submodules +#git --no-pager diff --ignore-submodules > fix_io.patch +#It is then probably a good idea to to add a commit hash to thee patch file name as below +#to indicate from what point the patch was generated. + +#COPY fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch ${WORKDIR}/ngen/fix_io_sub.patch # Apply the IO fix to submodules, once they all get patched/merged, this can be dropped... -RUN cd ${WORKDIR}/ngen && git apply --reject --whitespace=fix \ - #patch the submodules - fix_io_sub.patch +#RUN cd ${WORKDIR}/ngen && git apply --reject --whitespace=fix \ +# #patch the submodules +# fix_io_sub.patch RUN cd ${WORKDIR}/ngen \ && if [ "${NGEN_ACTIVATE_PYTHON}" == "ON" ]; then \ diff --git a/docker/fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch b/docker/fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch deleted file mode 100644 index 87a50cd..0000000 --- a/docker/fix_io_sub_7551590a415b89026559c1c570d4154e4746161b.patch +++ /dev/null @@ -1,119 +0,0 @@ -diff --git a/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_aorc.c b/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_aorc.c -index 059cf87..bd22f1e 100644 ---- a/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_aorc.c -+++ b/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_aorc.c -@@ -480,7 +480,11 @@ int read_file_line_counts_aorc(const char* file_name, int* line_count, int* max_ - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_pet.c b/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_pet.c -index 0b74edf..279f054 100644 ---- a/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_pet.c -+++ b/extern/SoilFreezeThaw/SoilFreezeThaw/forcing_code/src/bmi_pet.c -@@ -497,7 +497,11 @@ int read_file_line_counts_pet(const char* file_name, int* line_count, int* max_l - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/cfe/cfe/forcing_code/src/bmi_aorc.c b/extern/cfe/cfe/forcing_code/src/bmi_aorc.c -index 059cf87..bd22f1e 100644 ---- a/extern/cfe/cfe/forcing_code/src/bmi_aorc.c -+++ b/extern/cfe/cfe/forcing_code/src/bmi_aorc.c -@@ -480,7 +480,11 @@ int read_file_line_counts_aorc(const char* file_name, int* line_count, int* max_ - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/cfe/cfe/forcing_code/src/bmi_pet.c b/extern/cfe/cfe/forcing_code/src/bmi_pet.c -index 9683115..ce2b486 100644 ---- a/extern/cfe/cfe/forcing_code/src/bmi_pet.c -+++ b/extern/cfe/cfe/forcing_code/src/bmi_pet.c -@@ -497,7 +497,11 @@ int read_file_line_counts_pet(const char* file_name, int* line_count, int* max_l - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/cfe/cfe/src/bmi_cfe.c b/extern/cfe/cfe/src/bmi_cfe.c -index b85421e..29e8b7e 100644 ---- a/extern/cfe/cfe/src/bmi_cfe.c -+++ b/extern/cfe/cfe/src/bmi_cfe.c -@@ -2814,7 +2814,11 @@ int read_file_line_counts_cfe(const char* file_name, int* line_count, int* max_l - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/evapotranspiration/evapotranspiration/forcing_code/src/bmi_aorc.c b/extern/evapotranspiration/evapotranspiration/forcing_code/src/bmi_aorc.c -index 8724829..f924c5d 100644 ---- a/extern/evapotranspiration/evapotranspiration/forcing_code/src/bmi_aorc.c -+++ b/extern/evapotranspiration/evapotranspiration/forcing_code/src/bmi_aorc.c -@@ -480,7 +480,11 @@ int read_file_line_counts_aorc(const char* file_name, int* line_count, int* max_ - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n') -diff --git a/extern/evapotranspiration/evapotranspiration/src/bmi_pet.c b/extern/evapotranspiration/evapotranspiration/src/bmi_pet.c -index 9c72840..4d215ed 100644 ---- a/extern/evapotranspiration/evapotranspiration/src/bmi_pet.c -+++ b/extern/evapotranspiration/evapotranspiration/src/bmi_pet.c -@@ -510,7 +510,11 @@ int read_file_line_counts_pet(const char* file_name, int* line_count, int* max_l - return -1; - } - int seen_non_whitespace = 0; -- char c; -+ int c; //EOF is a negative constant...and char may be either signed OR unsigned -+ //depending on the compiler, system, achitectured, ect. So there are cases -+ //where this loop could go infinite comparing EOF to unsigned char -+ //the return of fgetc is int, and should be stored as such! -+ //https://stackoverflow.com/questions/35356322/difference-between-int-and-char-in-getchar-fgetc-and-putchar-fputc - for (c = fgetc(fp); c != EOF; c = fgetc(fp)) { - // keep track if this line has seen any char other than space or tab - if (c != ' ' && c != '\t' && c != '\n')