From 5f92b3d5adff14ca3c2b965ea8e2d0b8acb3ed17 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 02:19:39 -0700 Subject: [PATCH 1/8] Add FAQ about clang -Weverything being too strict The prototype answer is from discussion on GitHub, suggested by Landon, but I added to it and fixed typos as well. I probably introduced some other problems at this hour and at least one thing comes to mind as perhaps not ideal to have but these things can be worked out now that they're in the file. --- faq.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/faq.md b/faq.md index 3dbe3f3ad..eda2e2dde 100644 --- a/faq.md +++ b/faq.md @@ -800,3 +800,77 @@ exaggeration](https://books.google.com/books?id=ms3tce7BgJsC&lpg=PA134&vq=%22the p.s. Here is an image of F. D. C. Willard: [F D C Willard](png/F.D.C.Willard.png) + +## Q: Why do Makefiles use `-Weverything` with `clang`? Don't you know that its use is not recommended by clang developers? + +The use of `-Weverything` is limited to when one forces `CC=clang`. Users with +clang compilers are not required to set `CC=clang` but when they do, +`-Weverything` is enabled with all of its challenges, pedantic warnings, and +sometimes warnings about things that do not matter, some of which are frankly +frivolous and often downright dubious. + +To enable this feature: + +```sh +make clobber all CC=clang +``` + +or: + +```sh +make clobber all 'CWARN+= -Weverything' +``` + +though it should be noted that if one tries `-Weverything` with compilers that +are not `clang` they might see something like: + +```sh +echo 'int main(void) {}' > foo.c ; cc -Weverything foo.c -o foo +cc: error: unrecognized command-line option '-Weverything' +``` + +which means that it can't even be compiled. Thus the proper way to do it is the +first one. + +IOCCC authors who have access to a `clang` compiler might wish to try they their +hand at compiling with `-Weverything` while using a minimum of `-Wno-foo` +statements. Sometimes there is a technical or pedantic issue that +`-Weverything` warns about that would merit a change to your C code. Of course +if you're running out of bytes due to rule 2[ab] one might not have much choice. +Thus is something that obfuscators simply sometimes have to deal with! + +If you to try to use minimize the number of `-Wno-foo` options needed with +`-Weverything`, please mention this in your remarks about the entry, as the +judges note you attempt to honor it (see also below). In some cases your +obfuscated code will issue warnings with `-Weverything` no matter what: the +`-Wno-poison-system-directories` is a common example of this but there are +others as well. + +If you do try for a warning clean `-Weverything`, keep on mind that while _your_ +compile environment might be warning free, a different clang version or a +different build environment might still have warnings. For instance the warning +set is different in macOS (which by default is `clang` even when run as `gcc`!) +than linux! Given that your entry *MUST* work as documented, you may be safer to +say that your entry keeps the number of warnings and `-Wno-foo` options while +compiling with `clang -Weverything` at a minimum. Because if you claim zero +warnings, and we find a warning situation, this may diminish the value of your +entry as it is not as documented. Thus it might be wise to point this out and +also if you can test it in multiple platforms (or versions of `clang`, see +below note) this would be advisable. + +NOTE: different versions of `clang` have other differences as well. For instance +a defect of `clang` (which was fixed in a lot of entries by [Cody Boone +Ferguson](/winners.html#Cody_Boone_Ferguson) and some were fixed by us, the +[judges](https://www.ioccc.org/judges.html) as well) is that it requires that +`main()`'s arguments to be of a specific type. However some versions of `clang` +are more strict in the number of args allowed. These reasons are part of why +numerous entries had to be modified so that `main()` calls another function +instead of doing it all in `main()`. Another reason was that some entries that +recursively called `main()` caused a crash or otherwise broke the entry in +modern systems. Some entries do not work in `clang` (or at least do not work +completely) due to these defects, for instance +[1989/westley](1989/westley/README.md). + +As you can see, using `clang` has some additional problems to work out but if +you can get your entry to work well in `clang` it might very well be considered +better than other entries. From 2e5cd0f16b335cf6d9853cdbacc6c60ab381f381 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 02:39:21 -0700 Subject: [PATCH 2/8] Force regexp in IOCCC_status_version As it seems like the version should be a specific format both for consistency and to keep track of it I added a regexp check in the ioccc_status.sh script I wrote the other day that does this. The version must follow the regexp that was devised from the current IOCCC_status_version of '0.2 2023-05-22' as: [0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} The usage string has had this added and a new check was added to verify that the '-i version' matches this format. This update also will prevent sed from reporting an error if the separator character (which I originally chose as '/' and then changed it to '|' but which now could be either or ',' or something else) is in the version as the version won't have that character. The format of the version can certainly be changed but this seems like a worthy idea, to check that there is a required format. With this the script should be finished though of course something might be found later on. --- tmp/src/ioccc_status/ioccc_status.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tmp/src/ioccc_status/ioccc_status.sh b/tmp/src/ioccc_status/ioccc_status.sh index 607a7bda8..d22a1c25f 100755 --- a/tmp/src/ioccc_status/ioccc_status.sh +++ b/tmp/src/ioccc_status/ioccc_status.sh @@ -26,7 +26,7 @@ # If the -I status_ver option is used the IOCCC_status_version field will be # updated. # -export IOCCC_STATUS_VERSION="0.0.1-0 2023-10-02" # major.minor.release-patch YYYY-MM-DD +export IOCCC_STATUS_VERSION="0.0.2-0 2023-10-04" # major.minor.release-patch YYYY-MM-DD USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i status_ver] status.json @@ -41,6 +41,8 @@ USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i st -n update latest_news date -i status_ver update IOCCC_status_version + NOTE: version must match the regexp: [0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} + status.json the file to update status version: $IOCCC_STATUS_VERSION" @@ -120,11 +122,20 @@ if [[ ! -r $STATUS_JSON_FILE ]]; then exit 1 fi -# check that if -s used that the status ($STATUS) is either 'open' or 'closed' +# check that if -s ($STATUS_FLAG) used that the status ($STATUS) is either 'open' or 'closed' if [[ -n "$STATUS_FLAG" ]]; then if [[ "$STATUS" != "open" && "$STATUS" != "closed" ]]; then echo "$0: ERROR: status must be 'open' or 'closed'" 1>&2 - exit 1 + exit 3 + fi +fi + +# check format of IOCCC_status_version if set (-i used, $UPDATE_IOCCC_STATUS_VERSION) +if [[ -n "$UPDATE_IOCCC_STATUS_VERSION" ]]; then + echo "$IOCCC_STATUS_VERSION" | grep -qE '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}' + if [[ "${PIPESTATUS[1]}" -ne 0 ]]; then + echo "$0: ERROR: IOCCC_status_version must match the regexp: '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}'" 1>&2 + exit 3 fi fi From f13aea5b74fc3c6d85f5ab084fdd5c9532b31562 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 02:49:55 -0700 Subject: [PATCH 3/8] Important bug fix in ioccc_status.sh script The -i version variable was actually the same name as the script version which means that if one were to use -V to determine the version they would see not the version of the script but an empty string (unless of course they first set the version with -i version). Although this is mostly a cosmetic fix it is still important as the variables served two very different purposes and should not be used for both. Instead the name of the version (variable) of the script was changed to IOCCC_STATUS_SCRIPT_VERSION. This seemed like a better way to go about it as the -i version modifies the variable in the status.json file IOCCC_status_version whereas ioccc_status.sh is the script that does it. Clever I know :-) --- tmp/src/ioccc_status/ioccc_status.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmp/src/ioccc_status/ioccc_status.sh b/tmp/src/ioccc_status/ioccc_status.sh index d22a1c25f..2dfd3ebdd 100755 --- a/tmp/src/ioccc_status/ioccc_status.sh +++ b/tmp/src/ioccc_status/ioccc_status.sh @@ -26,7 +26,7 @@ # If the -I status_ver option is used the IOCCC_status_version field will be # updated. # -export IOCCC_STATUS_VERSION="0.0.2-0 2023-10-04" # major.minor.release-patch YYYY-MM-DD +export IOCCC_STATUS_SCRIPT_VERSION="0.0.2-0 2023-10-04" # major.minor.release-patch YYYY-MM-DD USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i status_ver] status.json @@ -45,7 +45,7 @@ USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i st status.json the file to update -status version: $IOCCC_STATUS_VERSION" +status version: $IOCCC_STATUS_SCRIPT_VERSION" export UPDATE_DATE="" export UPDATE_NEWS="" @@ -63,7 +63,7 @@ while getopts :hVv:s:dni: flag; do h) echo "$USAGE" 1>&2 exit 2 ;; - V) echo "$IOCCC_STATUS_VERSION" 1>&2 + V) echo "$IOCCC_STATUS_SCRIPT_VERSION" 1>&2 exit 2 ;; v) VERBOSITY="$OPTARG"; From 4bd4a86adbc8ec336366a9aedcd1012f83997723 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 03:07:32 -0700 Subject: [PATCH 4/8] Silence compilation of 1985/sicherman A warning that might not have been previously triggered, odd and unlikely as it might seem, was triggered at least in macOS Sonoma and it has now been disabled: -Wno-implicit-int. The entry used to require in modern days -traditional-cpp but like the others I fixed this and that did introduce new warnings as code had to be commented out in some cases like this entry (it did not matter in this entry if it was commented out but it had to be due to compiler errors otherwise). Even so this warning should have been triggered already due to main() and subr() not specifying a return type. --- 1985/sicherman/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1985/sicherman/Makefile b/1985/sicherman/Makefile index fbd287252..a0564f030 100644 --- a/1985/sicherman/Makefile +++ b/1985/sicherman/Makefile @@ -39,7 +39,7 @@ include ../../var.mk # Common C compiler warnings to silence # CSILENCE= -Wno-comment -Wno-deprecated-non-prototype -Wno-main -Wno-pedantic \ - -Wno-return-type -Wno-strict-prototypes -Wno-unused-parameter + -Wno-return-type -Wno-strict-prototypes -Wno-unused-parameter -Wno-implicit-int # Common C compiler warning flags # From 4836ed462265105cf380715f674c122ac9b6d99f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 03:17:00 -0700 Subject: [PATCH 5/8] Greatly improve my 1985/sicherman fix My original fix that made it not require -traditional-cpp translated some macros that rather made the entry not look as good by which I mean it did not look like it used to but now much less is commented out because the macro is left as is (though in use it is commented out .. does that mean it's not used or used? :-) ). But now the main() function type and args looks like it originally did except for one difference. It originally looked like: main(C,V) char **V; /* C program. (If you don't * understand it look it */ up.) (In the C Manual) and it was changed to: main(/*/,('\b'*'\b'>=_|_>'\t'*'\n') char **('\b'*'\b'>=_|_>'\t'*'\n') * C program. (If you don't * understand it look it * up.) (In the /*/ /*C*/ manual) but now it looks like: main(/*C,V) char **V;*/ /* C program. (If you don't * understand it look it * up.) (In the C */manual) which is much better and much more like the original entry. --- 1985/sicherman/sicherman.c | 21 +++++++++++---------- thanks-for-fixes.md | 4 ++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/1985/sicherman/sicherman.c b/1985/sicherman/sicherman.c index d3c01accc..442d97158 100644 --- a/1985/sicherman/sicherman.c +++ b/1985/sicherman/sicherman.c @@ -2,13 +2,13 @@ #define _C_C(_)('\b'b'\b'>=C_C>'\t'b'\n') #define C_C _|_ #define b * -#define C /b/ +#define C /b b/ #define V _C_C( -main(/*/,('\b'*'\b'>=_|_>'\t'*'\n') -char **('\b'*'\b'>=_|_>'\t'*'\n') -* C program. (If you don't -* understand it look it -* up.) (In the /*/ /*C*/ manual) +main(/*C,V) +char **V;*/ +/* C program. (If you don't + * understand it look it + * up.) (In the C */manual) { char _,__; while (read(0,&__,1) & write((_=(_=~' '&__,/*/)), @@ -17,12 +17,13 @@ char **('\b'*'\b'>=_|_>'\t'*'\n') '\b'*'\b'|((_-52)%('\b'*'\b'+~' '&'\t'*'\n')+1),1),&_,1)); } -subr(/*C*/) -/*char *C;*/ -{ + #if 0 +subr(C) +char *C; +{ C="Lint says "argument Manual isn't used." What's that mean?"; while (write((read(C_C('"'-'/*"'/*"*/))?__:__-_+ '\b'b'\b'|((_-52)%('\b'b'\b'+C_C_('\t'b'\n'))+1),1),&_,1)); -#endif } +#endif diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 821319ee3..c4bb9563c 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -133,6 +133,10 @@ like to refer you to the original file in [sicherman.alt.c](1985/sicherman/sicherman.alt.c) and he suggests that you then compare it to [sicherman.c](1985/sicherman/sicherman.c) for some good old C-fashioned fun! +Later on Cody improved the fix so that it looks much more like the original +entry which can be found in +[1985/sicherman/sicherman.orig.c](1985/sicherman/sicherman.orig.c). + ## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md])) From c1c8197c3430cf50991b62538677ce4c9b19399d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 04:09:38 -0700 Subject: [PATCH 6/8] Add alt code to 1986/hague - fgets() The reason it is in alt code is because one of the forms of input (see below) will, although print out correct output, segfault after outputting the text. That is when one does something like: echo foo | ./hague.alt Whether it might be worth making it the entry itself with a note in the Makefile and README.md and bugs.md (because it does print out correct output) can be determined later - or not. This change required several files to be updated besides the new file hague.alt.c. --- 1986/hague/.gitignore | 1 + 1986/hague/Makefile | 4 ++-- 1986/hague/README.md | 30 +++++++++++++++++++++++++++--- 1986/hague/hague.alt.c | 28 ++++++++++++++++++++++++++++ 1986/hague/hague.c | 4 ++-- bugs.md | 22 +++++++++++++++++++--- faq.md | 24 ++++++++++++++++++++++++ thanks-for-fixes.md | 11 +++++++++++ 8 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 1986/hague/hague.alt.c diff --git a/1986/hague/.gitignore b/1986/hague/.gitignore index 3bbef39c6..4f2188ba7 100644 --- a/1986/hague/.gitignore +++ b/1986/hague/.gitignore @@ -1,3 +1,4 @@ hague +hague.alt hague.orig prog.orig diff --git a/1986/hague/Makefile b/1986/hague/Makefile index 810b9c51f..d1a379b02 100644 --- a/1986/hague/Makefile +++ b/1986/hague/Makefile @@ -114,8 +114,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1986/hague/README.md b/1986/hague/README.md index d79cd8cc8..9b01d231f 100644 --- a/1986/hague/README.md +++ b/1986/hague/README.md @@ -9,9 +9,9 @@ UK make all ``` - -NOTE: this entry uses `gets()` so you might get a warning about this when -compiling and running this program with some systems. +There is an alternate version which uses `fgets()`. See the Alternate code +section below as well as the [bugs.md](/bugs.md) file for more details as to why +it is worth having as an alternate version. ## To run: @@ -29,6 +29,30 @@ International Obfuscated C Code Contest Jim Hague ``` +Also try: + +```sh +echo IOCCC | ./hague +``` + +### Alternate code: + +Whereas with some entries the change to `fgets()` (see the [FAQ](/faq.md) for +details on why this has been done) can be done in the original code this entry +is more complicated in that although both forms of input show the correct +output, one form segfaults after the output. + +If you wish to use this alternate code, do: + +```sh +make alt +``` + +Use `hague.alt` as you would `hague` above. As for which form will segfault +after outputting the text it is when text is piped into the program. Again see +the [bugs.md](/bugs.md) file for more details. + + ## Judges' remarks: diff --git a/1986/hague/hague.alt.c b/1986/hague/hague.alt.c new file mode 100644 index 000000000..c5dc9dba3 --- /dev/null +++ b/1986/hague/hague.alt.c @@ -0,0 +1,28 @@ +#define DIT ( +#define DAH ) +#define __DAH ++ +#define DITDAH * +#define DAHDIT for +#define DIT_DAH malloc +#define DAH_DIT fgets +#define _DAHDIT char +_DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:" +;main DIT DAH{_DAHDIT +DITDAH _DIT,DITDAH DAH_,DITDAH DIT_, +DITDAH _DIT_,DITDAH DIT_DAH DIT +DAH,DITDAH DAH_DIT DIT DAH;DAHDIT +DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT +__DAH;_DIT=DAH_DIT DIT _DIT,81,stdin DAH,_DIT[strlen(_DIT)-1]='\0',_DIT!=NULL;__DIT +DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH +DAH_;__DIT DIT DITDAH +_DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT +DIT' 'DAH,DAH_ __DAH DAH DAHDIT DIT +DITDAH DIT_=2,_DIT_=_DAH_; DITDAH _DIT_&&DIT +DITDAH _DIT_!=DIT DITDAH DAH_>='a'? DITDAH +DAH_&223:DITDAH DAH_ DAH DAH; DIT +DITDAH DIT_ DAH __DAH,_DIT_ __DAH DAH +DITDAH DIT_+= DIT DITDAH _DIT_>='a'? DITDAH _DIT_-'a':0 +DAH;}_DAH DIT DIT_ DAH{ __DIT DIT +DIT_>3?_DAH DIT DIT_>>1 DAH:'\0'DAH;return +DIT_&1?'-':'.';}__DIT DIT DIT_ DAH _DAHDIT +DIT_;{DIT void DAH write DIT 1,&DIT_,1 DAH;} diff --git a/1986/hague/hague.c b/1986/hague/hague.c index bf43532b3..c5dc9dba3 100644 --- a/1986/hague/hague.c +++ b/1986/hague/hague.c @@ -4,7 +4,7 @@ #define DITDAH * #define DAHDIT for #define DIT_DAH malloc -#define DAH_DIT gets +#define DAH_DIT fgets #define _DAHDIT char _DAHDIT _DAH_[]="ETIANMSURWDKGOHVFaLaPJBXCYZQb54a3d2f16g7c8a90l?e'b.s;i,d:" ;main DIT DAH{_DAHDIT @@ -12,7 +12,7 @@ DITDAH _DIT,DITDAH DAH_,DITDAH DIT_, DITDAH _DIT_,DITDAH DIT_DAH DIT DAH,DITDAH DAH_DIT DIT DAH;DAHDIT DIT _DIT=DIT_DAH DIT 81 DAH,DIT_=_DIT -__DAH;_DIT==DAH_DIT DIT _DIT DAH;__DIT +__DAH;_DIT=DAH_DIT DIT _DIT,81,stdin DAH,_DIT[strlen(_DIT)-1]='\0',_DIT!=NULL;__DIT DIT'\n'DAH DAH DAHDIT DIT DAH_=_DIT;DITDAH DAH_;__DIT DIT DITDAH _DIT_?_DAH DIT DITDAH DIT_ DAH:'?'DAH,__DIT diff --git a/bugs.md b/bugs.md index 706e02ddc..8d6fa91db 100644 --- a/bugs.md +++ b/bugs.md @@ -469,11 +469,27 @@ the judges and shouldn't be fixed. This entry uses `gets()` which is unsafe. In particular the buffer size is a mere 81 and it does not read a single string at command invocation but instead until the program is terminated. This size can be increased to start out but it -would be better if it used `fgets()`. This will be addressed in time but is -noted here as a reminder. +would be better if it used `fgets()`. The way this entry is formed has made it not as simple as some of the others -that have been addressed. +that have been addressed at least in part. It is easy to get it to use `fgets()` +and this has been done in the [alternate code](1986/hague/hague.alt.c) but it +will segfault after outputting the (correct) text in one of the forms. In +particular whereas this: + +```sh +./hague.alt +foo + +works the following will print out the correct output but then segfault: + +``` +```sh +echo foo | ./hague.alt +``` + +Whether or not it is worth making the entry itself (since the output is correct) +this alt version is to be determined later but it's might very well not be. ## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md)) diff --git a/faq.md b/faq.md index eda2e2dde..901aae497 100644 --- a/faq.md +++ b/faq.md @@ -88,6 +88,30 @@ some entries you should look at the original code as in `winner.orig.c` or `prog.orig.c`. Sometimes the original is in an alt version like `winner.alt.c` or `prog.alt.c`. +## Q: Why have some entries that originally used `gets()` been modified to use `fgets()`? Doesn't this tamper with the entry too much? + +A fine line indeed has to be drawn here but it was decided that it is worth it +because of alarming warnings that can be displayed, in some systems at runtime +interspersed with the output of the program. + +For instance in macOS the entry [1990/tbr](1990/tbr/README.md) would output the +warning in such a way that caused confusing output for the entry. + +In some cases this is not so easy to fix and in one case at least there is an +alternate version that has the fix instead due to a problem it creates (correct +output but segfaults after the output in one of the forms of input). + +In some cases it is not possible to fix or at least highly unlikely and so those +have mainly not been touched except one that has had the buffer size increased +(which could be done for others that are not possible to change to `fgets()` but +this has not been done). + +In the future we, the judges, would prefer that entries use `fgets()` to prevent +these problems. + +NOTE: due to 'compatibility reasons' `fgets()` stores the newline and `gets()` +does not. We're not sure how this is compatibility but either way it can cause a +problem and it is this that has complicated some fixes. ## Q: I cannot get entry XYZZY from year 19xx to compile! diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c4bb9563c..0df4ac00d 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -138,6 +138,17 @@ entry which can be found in [1985/sicherman/sicherman.orig.c](1985/sicherman/sicherman.orig.c). +## [1986/hague](1986/hague/hague.c) ([README.md](1986/hague/README.md])) + +Cody added alt code that uses `fgets()` to avoid alarming and annoying warnings +about `gets()` being unsafe. The reason this is alt code, at least for now, is +that although it will print the results in both forms of invocation, after the +output in one invocation form it will segfault. This might be addressed later on +or it might be decided that it is worth it, with a caveat in the Makefile or at +least the README.md file, since it still prints out the correct output, though +that seems like it might not be so ideal unless it can be fixed (which might be +done). See the [bugs.md](/bugs.md) file for details. + ## [1986/holloway](1986/holloway/holloway.c) ([README.md](1986/holloway/README.md])) Cody fixed this to compile and work with clang (it already worked with gcc). From 08d36340756f4b337981889ad4468f62edf61810 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 05:38:48 -0700 Subject: [PATCH 7/8] Fix regexp in ioccc_status.sh - add boundaries It served no good without the '^' and '$' as that would mean that as long as the format is in the string anything else could be in front or after (or in between if format specified more than once). --- tmp/src/ioccc_status/ioccc_status.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmp/src/ioccc_status/ioccc_status.sh b/tmp/src/ioccc_status/ioccc_status.sh index 2dfd3ebdd..5af8ff9c0 100755 --- a/tmp/src/ioccc_status/ioccc_status.sh +++ b/tmp/src/ioccc_status/ioccc_status.sh @@ -41,7 +41,7 @@ USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i st -n update latest_news date -i status_ver update IOCCC_status_version - NOTE: version must match the regexp: [0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} + NOTE: version must match the regexp: ^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$ status.json the file to update @@ -132,9 +132,9 @@ fi # check format of IOCCC_status_version if set (-i used, $UPDATE_IOCCC_STATUS_VERSION) if [[ -n "$UPDATE_IOCCC_STATUS_VERSION" ]]; then - echo "$IOCCC_STATUS_VERSION" | grep -qE '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}' + echo "$IOCCC_STATUS_VERSION" | grep -qE '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$' if [[ "${PIPESTATUS[1]}" -ne 0 ]]; then - echo "$0: ERROR: IOCCC_status_version must match the regexp: '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}'" 1>&2 + echo "$0: ERROR: IOCCC_status_version must match the regexp: '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$'" 1>&2 exit 3 fi fi From 818f34873a11d33dc547c5428a00868fb5792576 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 07:56:22 -0700 Subject: [PATCH 8/8] Comment fixes in ioccc_status.sh --- tmp/src/ioccc_status/ioccc_status.sh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tmp/src/ioccc_status/ioccc_status.sh b/tmp/src/ioccc_status/ioccc_status.sh index 5af8ff9c0..6bda5f0c6 100755 --- a/tmp/src/ioccc_status/ioccc_status.sh +++ b/tmp/src/ioccc_status/ioccc_status.sh @@ -8,22 +8,13 @@ # https://xexyl.net Cody Boone Ferguson # https://ioccc.xexyl.net # -# The script is at this just point a proof of concept but it does work, allowing -# one to update the date of the latest news, the date of the status, the status -# version and the status of the contest. It's not required to update all or for -# that matter any of them. -# -# If that is not clear: it might or might not be needed or desired and that is -# perfectly okay. If it's used but modified that's also okay. It gave me -# something to do and whether or not it's useful it has served a purpose. -# # If -s option is used, the status field is updated, providing that the status # arg is either "closed" or "open". # # If the -d or -n flags are used then it will update the status_date or # latest_news fields, respectively. # -# If the -I status_ver option is used the IOCCC_status_version field will be +# If the -i status_ver option is used the IOCCC_status_version field will be # updated. # export IOCCC_STATUS_SCRIPT_VERSION="0.0.2-0 2023-10-04" # major.minor.release-patch YYYY-MM-DD