From dfabb616f2cae7d5e7bef24d72524f33b4221dcd Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 10 Jun 2023 07:24:02 -0700 Subject: [PATCH 1/4] Change INABIAF status in 1992/westley It was an error to fix the segfault without enough args in 1992/westley as it does not in fact affect the usability of the program and that's the only time a segfault should be fixed except by anyone but the author themselves. This commit required also changing the alt code (that I added based on the author's remarks) as well as the README.md, bugs.md and thanks-for-fixes.md. --- 1992/westley/README.md | 6 +++++- 1992/westley/westley.alt.c | 4 ++-- 1992/westley/westley.c | 6 +++--- bugs.md | 6 ++++++ thanks-for-fixes.md | 9 ++++----- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/1992/westley/README.md b/1992/westley/README.md index 8e799d977..7ee7f2543 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -44,7 +44,7 @@ show correctly! ### Alternative code: -The author provided a version for the US. To build: +The author provided a version for the US which we added. To build: ```sh make alt @@ -54,6 +54,10 @@ Use `westley.alt` as you would `whereami` above. NOTE: this alternative version also needs a terminal that wraps at 80 columns. +### INABIAF - it's not a bug it's a feature! :-) + +This program and the alternate version will very likely crash or nuke the world +without enough args. This should not be fixed. ## Judges' remarks: diff --git a/1992/westley/westley.alt.c b/1992/westley/westley.alt.c index dcda66e27..f188c7e1c 100644 --- a/1992/westley/westley.alt.c +++ b/1992/westley/westley.alt.c @@ -1,4 +1,4 @@ -main(l,a,n,d)char**a,**n,**d;{int N=n,D=d;if(l>2){for(D=atoi(a[1])/2*80-atoi(a[2])-2043; +main(l,a,n,d)char**a,**n,**d;{int N=n,D=d;for(D=atoi(a[1])/2*80-atoi(a[2])-2043; N="bnaBCOCXdBBHGYdAP[A M E R I C A].AqandkmavX|ELC}BOCd" -[l++-3];)for(;N-->64;)putchar(!D+++33^l&1);}} +[l++-3];)for(;N-->64;)putchar(!D+++33^l&1);} diff --git a/1992/westley/westley.c b/1992/westley/westley.c index f669a8457..d9a352b4c 100644 --- a/1992/westley/westley.c +++ b/1992/westley/westley.c @@ -1,7 +1,7 @@ main(l - ,a)char**a;{int n;int d; -if (l>2)for(d=atoi(a[1])/10 -*80-atoi(a[2])/5-596;n="@NKA\ + ,a)char**a;{int n;int + d;for(d=atoi(a[1])/10*80- + atoi(a[2])/5-596;n="@NKA\ CLCCGZAAQBEAADAFaISADJABBA^\ SNLGAQABDAXIMBAACTBATAHDBAN\ ZcEMMCCCCAAhEIJFAEAAABAfHJE\ diff --git a/bugs.md b/bugs.md index f1bac75a6..b96056697 100644 --- a/bugs.md +++ b/bugs.md @@ -676,6 +676,12 @@ work but it only works with gcc. Unfortunately due to the way the entry works and the fact that other compilers like clang have different warnings and errors this simply does not work with them. Can you help us? +## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md)) +## STATUS: INABIAF - please **DO NOT** fix + +This entry will very likely crash or nuke the world without enough args. This is +not considered a bug but a feature and should not be fixed in the repo. + # 1993 diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c94d24a3f..665262545 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -452,11 +452,10 @@ clang due to different compiler messages. ## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md])) -Cody fixed this for clang by changing the third and fourth arg of `main()` to be -ints inside `main()`; clang requires args 2 - 4 to be `char **`. He also fixed -it so that the program would not segfault if not enough args were specified. He -did the same for the alternative version (see below) provided by the author (the -original can be seen in the author's remarks below). +Cody fixed this to work for clang by changing the third and fourth arg of +`main()` to be ints inside `main()`; clang requires args 2 - 4 to be `char **`. +He also added the alternate version that the author gave in the remarks that is +specifically for the USA rather than the world. ## [1993/jonth](1993/jonth/jonth.c) ([README.md](1993/jonth/README.md])) From b4b4ff8bc9d8b41ac3d291cfed3a30a5d5e23213 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 10 Jun 2023 10:24:20 -0700 Subject: [PATCH 2/4] Minor adjustment to 1992/westley INABIAF status --- 1992/westley/README.md | 5 +++-- bugs.md | 41 +++++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/1992/westley/README.md b/1992/westley/README.md index 7ee7f2543..18db56abd 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -56,8 +56,9 @@ NOTE: this alternative version also needs a terminal that wraps at 80 columns. ### INABIAF - it's not a bug it's a feature! :-) -This program and the alternate version will very likely crash or nuke the world -without enough args. This should not be fixed. +This program and the alternate version will very likely crash or nuke the entire +world or just the USA, respectively, without enough args. This should not be +fixed. ## Judges' remarks: diff --git a/bugs.md b/bugs.md index b96056697..ab16a6b80 100644 --- a/bugs.md +++ b/bugs.md @@ -679,9 +679,9 @@ this simply does not work with them. Can you help us? ## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md)) ## STATUS: INABIAF - please **DO NOT** fix -This entry will very likely crash or nuke the world without enough args. This is -not considered a bug but a feature and should not be fixed in the repo. - +This program and the alternate version will very likely crash or nuke the entire +world or just the USA, respectively, without enough args. This should not be +fixed. # 1993 @@ -713,9 +713,10 @@ else. This should NOT be fixed. [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to compile with modern systems (see the README.md file for what had to change) but the -entry also used `gets()`. This could overflow long lines. Cody changed it to -`fgets()` but this introduces another problem namely that newlines can be -printed if the line length < 231. +entry also used `gets()` which in some systems would print out a warning along +with the output of the program. Naturally it could also overflow long lines. +Cody changed it to `fgets()` to prevent the display problem but this introduces +another problem namely that newlines can be printed if the line length < 231. This seems like a worthy compromise but it would be ideal for it to never print a newline unless that's the line itself (a blank line). @@ -817,15 +818,27 @@ We would be grateful if you could provide it to us. If you can provide this file you might consider removing this entry from this file as well but if not we'll take care of it. -### Important reminder to fix the `-1` value check for `getc()`: +### Important reminder and a note about the `-1` value check for `getc()`: + +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the code to not +use `-1` for the return value of `getc()`; this is important because `EOF` is +**NOT** guaranteed to be `-1` but rather any negative value. On systems where +`EOF != -1` the program would enter an infinite loop until the program crashed, +by chance reads a `-1` or was killed (it is for this same reason that one should +not use `EOF` for the `getopt()` functions as they return `-1` when all options +are parsed (for details on the definition of `EOF` see `7.21 +Input/output` subsection 1 of the standard)). + + +An interesting problem occurred where changing the `-1` to `EOF` caused both +`warning: illegal character encoding in string literal` and `error: source file +is not valid UTF-8`. But since `EOF` is simply an int < 0 and making the loop +condition check that the return value is >= 0 does not cause a compilation error +and it functions correctly it will address the systems where `EOF != -1` just as +if it checked for `!= EOF`. + +Since it works there is no need to fix this except for a challenge to yourself. -Cody wants to remind you that he fixed the code to not use `-1` for the return -value of `getc()`; this is important because `EOF` is **NOT** guaranteed to be -`-1` but rather any negative value. On systems where `EOF != -1` the program -would enter an infinite loop until the program crashed, by chance reads a `-1` -or was killed. See the README.md for more details. If you don't feel comfortable -changing it to `EOF` Cody will happily do it for you but otherwise go right -ahead. We'll credit you in the [thanks file](thanks-for-fixes.md) regardless. # 1995 From f01e41735c88013eb1eb9fb30631798480d1878b Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 10 Jun 2023 10:32:35 -0700 Subject: [PATCH 3/4] Minor adjustment to b4b4ff8bc9d --- 1992/westley/README.md | 8 +++++--- bugs.md | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/1992/westley/README.md b/1992/westley/README.md index 18db56abd..5941c9e92 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -56,9 +56,11 @@ NOTE: this alternative version also needs a terminal that wraps at 80 columns. ### INABIAF - it's not a bug it's a feature! :-) -This program and the alternate version will very likely crash or nuke the entire -world or just the USA, respectively, without enough args. This should not be -fixed. +This program and the alternate version will very likely crash or +[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire +world](https://en.wikipedia.org/wiki/Earth) or just the +[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough +args. This should not be fixed. ## Judges' remarks: diff --git a/bugs.md b/bugs.md index ab16a6b80..a656b9105 100644 --- a/bugs.md +++ b/bugs.md @@ -679,9 +679,11 @@ this simply does not work with them. Can you help us? ## [1992/westley](1992/westley/westley.c) ([README.md](1992/westley/README.md)) ## STATUS: INABIAF - please **DO NOT** fix -This program and the alternate version will very likely crash or nuke the entire -world or just the USA, respectively, without enough args. This should not be -fixed. +This program and the alternate version will very likely crash or +[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire +world](https://en.wikipedia.org/wiki/Earth) or just the +[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough +args. This should not be fixed. # 1993 From aa1dc7d7bb67d4246d2a6664d8bf55a7e031319f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 10 Jun 2023 10:40:22 -0700 Subject: [PATCH 4/4] Alternative code -> Alternate code in 1992/westley --- 1992/westley/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1992/westley/README.md b/1992/westley/README.md index 5941c9e92..0b54327b0 100644 --- a/1992/westley/README.md +++ b/1992/westley/README.md @@ -42,7 +42,7 @@ show correctly! ``` -### Alternative code: +### Alternate code: The author provided a version for the US which we added. To build: