diff --git a/1992/gson/README.md b/1992/gson/README.md index 1627e0177..168ee920b 100644 --- a/1992/gson/README.md +++ b/1992/gson/README.md @@ -14,6 +14,7 @@ The current status of this entry is: ``` STATUS: uses gets() - change to fgets() if possible + STATUS: INABIAF - please DO NOT fix ``` For more detailed information see [1992/gson in bugs.html](../../bugs.html#1992_gson). @@ -22,7 +23,7 @@ For more detailed information see [1992/gson in bugs.html](../../bugs.html#1992_ ## To use: ``` - ./ag word word2 word3 < /path/to/dictionary + ./ag word word2 word3 < dictionary ``` @@ -36,30 +37,25 @@ This script will determine (or try and determine) where your system dictionary is located and assuming that it can find one it'll use that. It checks the following locations though the last one is more ironic: -``` - /usr/share/dict/words - /usr/share/lib/spell/words - /usr/ucblib/dict/words - /dev/null # <-- for machines with nothing to say -``` +* `/usr/share/dict/words` +* `/usr/share/lib/spell/words` +* `/usr/ucblib/dict/words` +* `/dev/null` # <-- for machines with nothing to say -Then using the proper dictionary file it does: +Then it runs the program with the following strings, using the proper dictionary +file: -``` - ./ag free software foundation < /usr/share/dict/words - ./ag obfuscated c contest < /usr/share/dict/words - ./ag unix international < /usr/share/dict/words - ./ag george bush < /usr/share/dict/words - ./ag bill clinton < /usr/share/dict/words - ./ag ross perot < /usr/share/dict/words - ./ag paul e tsongas < /usr/share/dict/words -``` - -where `/usr/share/dict/words` is the dictionary file. +* `free software foundation` +* `obfuscated c contest` +* `unix international` +* `george bush` +* `bill clinton` +* `ross perot` +* `paul e tsongas` Then it uses the [mkdict.sh](%%REPO_URL%%/1992/gson/mkdict.sh) script to create a dictionary file out -of the files [index.html](index.html), [try.sh](%%REPO_URL%%/1992/gson/try.sh) (itself) and -[Makefile](%%REPO_URL%%/1992/gson/Makefile) and it repeats the same commands as above. In the case no +of the files [README.md](README.md), [try.sh](%%REPO_URL%%/1992/gson/try.sh) (itself) and +[Makefile](%%REPO_URL%%/1992/gson/Makefile) and it repeats the same process as above. In the case no dictionary file can be found in the first step it only runs the commands once with the created dictionary file. @@ -84,20 +80,20 @@ Then try using the program as shown above with the file `words`. The name of the game: -AG is short for either Anagram Generator or simply AnaGram. It might also be -construed to mean Alphabet Game, and by pure coincidence it happens to be the +`AG` is short for either `Anagram Generator` or simply `AnaGram`. It might also be +construed to mean `Alphabet Game`, and by pure coincidence it happens to be the author's initials. ### What it does -AG takes one or more words as arguments, and tries to find anagrams of those +`AG` takes one or more words as arguments, and tries to find anagrams of those words, i.e. words or sentences containing exactly the same letters. ### How to use it -To run AG, you need a dictionary file consisting of distinct words in the +To run `AG`, you need a dictionary file consisting of distinct words in the natural language of your choice, one word on each line. If your machine doesn't have one already, you can make your own dictionary by concatenating a few hundred of your favourite Usenet articles and piping them through the following @@ -108,10 +104,10 @@ obfuscated shell script: z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u ``` -Using articles from alt.folklore.computers is likely to make -a more professional-looking dictionary than rec.arts.erotica. +Using articles from `alt.folklore.computers` is likely to make +a more professional-looking dictionary than `rec.arts.erotica`. -AG must be run with the dictionary file as standard input. +`AG` must be run with the dictionary file as standard input. Because anagrams consisting of just a few words are generally more meaningful than those consisting of dozens of very short words, the @@ -122,30 +118,17 @@ limit can be changed using a numeric command line option, as in ### Bugs and limitations - There is no error checking. -- Standard input must be seekable, so you can't pipe the dictionary into AG. +- Standard input must be seekable, so you can't pipe the dictionary into `AG`. - The input sentence and each line in the dictionary may contain at most 32 distinct letters, and each letter may occur at most 15 times. - Words in the dictionary may be at most 255 bytes long. -- AG cannot handle characters that sign-extend to negative values. -- Although AG works on both 16-bit and 32-bit machines, the size of the problems +- `AG` cannot handle characters that sign-extend to negative values. +- Although `AG` works on both 16-bit and 32-bit machines, the size of the problems it can solve is severely limited on machines that limit the stack size to 64k or less. -### Obfuscatory notes - -As you can see, AG takes advantage of the new '92 whitespace rules' to -achieve a clear, readable, self-documenting layout. The identifiers -have been chosen in a way appropriate for an alphabet game, and common -sources of bugs such as goto statements and malloc/free have been -eliminated. As AG also refrains from abusing the preprocessor, it -doesn't really have much to offer in terms of "surface obfuscation". -Instead, it tries to achieve both its speed and its obscurity through a -careful choice of algorithms. Some of the finer points of those -algorithms are outlined the section below. - - -### NOTICE to those who wish for a greater challenge +### NOTICE to those who wish for a greater challenge: **If you want a greater challenge, don't read any further**: just try to understand the program via the source. @@ -153,15 +136,29 @@ just try to understand the program via the source. If you get stuck, come back and read below for additional hints and information. +### Obfuscatory notes + +As you can see, `AG` takes advantage of the new '92 whitespace rules' to +achieve a clear, readable, self-documenting layout. The identifiers +have been chosen in a way appropriate for an alphabet game, and common +sources of bugs such as goto statements and malloc/free have been +eliminated. As `AG` also refrains from abusing the preprocessor, it +doesn't really have much to offer in terms of "surface obfuscation". +Instead, it tries to achieve both its speed and its obscurity through a +careful choice of algorithms. Some of the finer points of those +algorithms are outlined the section below. + + + ### How this entry works: Here follows a description of some of the data structures and -algorithms used by AG. It is by no means complete, but it may help +algorithms used by `AG`. It is by no means complete, but it may help you get an idea about the general principles.
The current status of this entry is:
- STATUS: uses gets() - change to fgets() if possible
+ STATUS: uses gets() - change to fgets() if possible
+ STATUS: INABIAF - please DO NOT fix
For more detailed information see 1992/gson in bugs.html.
./ag word word2 word3 < /path/to/dictionary
+ ./ag word word2 word3 < dictionary
./try.sh
This script will determine (or try and determine) where your system dictionary is located and assuming that it can find one it’ll use that. It checks the following locations though the last one is more ironic:
- /usr/share/dict/words
- /usr/share/lib/spell/words
- /usr/ucblib/dict/words
- /dev/null # <-- for machines with nothing to say
-Then using the proper dictionary file it does:
- ./ag free software foundation < /usr/share/dict/words
- ./ag obfuscated c contest < /usr/share/dict/words
- ./ag unix international < /usr/share/dict/words
- ./ag george bush < /usr/share/dict/words
- ./ag bill clinton < /usr/share/dict/words
- ./ag ross perot < /usr/share/dict/words
- ./ag paul e tsongas < /usr/share/dict/words
-where /usr/share/dict/words is the dictionary file.
/usr/share/dict/words/usr/share/lib/spell/words/usr/ucblib/dict/words/dev/null # <– for machines with nothing to sayThen it runs the program with the following strings, using the proper dictionary +file:
+free software foundationobfuscated c contestunix internationalgeorge bushbill clintonross perotpaul e tsongasThen it uses the mkdict.sh script to create a dictionary file out -of the files index.html, try.sh (itself) and -Makefile and it repeats the same commands as above. In the case no +of the files README.md, try.sh (itself) and +Makefile and it repeats the same process as above. In the case no dictionary file can be found in the first step it only runs the commands once with the created dictionary file.
The name of the game:
-AG is short for either Anagram Generator or simply AnaGram. It might also be -construed to mean Alphabet Game, and by pure coincidence it happens to be the +
AG is short for either Anagram Generator or simply AnaGram. It might also be
+construed to mean Alphabet Game, and by pure coincidence it happens to be the
author’s initials.
AG takes one or more words as arguments, and tries to find anagrams of those +
AG takes one or more words as arguments, and tries to find anagrams of those
words, i.e. words or sentences containing exactly the same letters.
To run AG, you need a dictionary file consisting of distinct words in the +
To run AG, you need a dictionary file consisting of distinct words in the
natural language of your choice, one word on each line. If your machine doesn’t
have one already, you can make your own dictionary by concatenating a few
hundred of your favourite Usenet articles and piping them through the following
obfuscated shell script:
#!/bin/sh
z=a-z];tr [A-Z\] \[$z|sed s/[\^$z[\^$z*/_/g|tr _ \\012|grep ..|sort -u
-Using articles from alt.folklore.computers is likely to make -a more professional-looking dictionary than rec.arts.erotica.
-AG must be run with the dictionary file as standard input.
+Using articles from alt.folklore.computers is likely to make
+a more professional-looking dictionary than rec.arts.erotica.
AG must be run with the dictionary file as standard input.
Because anagrams consisting of just a few words are generally more meaningful than those consisting of dozens of very short words, the number of words in the anagrams is limited to 3 by default. This @@ -469,35 +474,35 @@ limit can be changed using a numeric command line option, as in
AG.AG cannot handle characters that sign-extend to negative values.AG works on both 16-bit and 32-bit machines, the size of the problems
it can solve is severely limited on machines that limit the stack size to 64k or
less.If you want a greater challenge, don’t read any further: +just try to understand the program via the source.
+If you get stuck, come back and read below for additional hints and information.
As you can see, AG takes advantage of the new ‘92 whitespace rules’ to +
As you can see, AG takes advantage of the new ‘92 whitespace rules’ to
achieve a clear, readable, self-documenting layout. The identifiers
have been chosen in a way appropriate for an alphabet game, and common
sources of bugs such as goto statements and malloc/free have been
-eliminated. As AG also refrains from abusing the preprocessor, it
+eliminated. As AG also refrains from abusing the preprocessor, it
doesn’t really have much to offer in terms of “surface obfuscation”.
Instead, it tries to achieve both its speed and its obscurity through a
careful choice of algorithms. Some of the finer points of those
algorithms are outlined the section below.
If you want a greater challenge, don’t read any further: -just try to understand the program via the source.
-If you get stuck, come back and read below for additional hints and information.
Here follows a description of some of the data structures and
-algorithms used by AG. It is by no means complete, but it may help
+algorithms used by AG. It is by no means complete, but it may help
you get an idea about the general principles.
Internally, AG represents words and sentences as arrays of 32 +
Internally, AG represents words and sentences as arrays of 32
4-bit integer elements. Each element represents the number of
times a letter occurs in the word/sentence. There are 32 elements
because 32 is a convenient power of two larger than the number of
@@ -519,21 +524,21 @@ Thus, 32 independent 4-bit additions can be performed by just four
iterations of a loop containing some 32-bit bitwise logical
operations, but no arithmetic operations other than those implied
by array indexing.
Subtraction works similarly, and in fact AG only implements +
Subtraction works similarly, and in fact AG only implements
subtraction directly, handling addition by means of the identity
a+b = a-(0-b).
In addition to this 32*4-bit representation, AG also forms a so-called
+
In addition to this 32*4-bit representation, AG also forms a so-called
“signature” that is the bitwise OR of the four longs, which is
equivalent to saying that the signature of a word contains a logical 1
in the bit positions corresponding to letters occurring at least once
in that word.
The first thing AG does is to construct a lookup table of 256 +
The first thing AG does is to construct a lookup table of 256
longs, one for each 8-bit character value. The entry for a
character will be zero if that character doesn’t appear in the
sentence given on the command line, or it will have a single bit
set if the character does appear in the sentence. By adding
together the bit masks for all the letters in the input sentence
-using the transpose addition method described above, AG forms the
+using the transpose addition method described above, AG forms the
32*4 bit array representation of the input sentence.
The next action performed is reading the dictionary. Those words that contain letters not in the input sentence are immediately discarded. @@ -568,11 +573,11 @@ remaining letters. The depth of the recursion is limited to the maximum number of words in the anagram, as specified by the user.
When the deepest recursion level has been reached, an optimization can
be applied: because no further recursion will be done, there is no
-need to look for partial anagrams, and therefore AG only needs to
+need to look for partial anagrams, and therefore AG only needs to
check for words that contain exactly the same letters as the current
sentence. Those words can be found simply by indexing the hash table
with the signature of the current sentence.
Even when not on the deepest recursion level, AG generally avoids +
Even when not on the deepest recursion level, AG generally avoids
examining all the entries of the hash table. The idea is that we are
not interested in hash buckets whose words contain any letters not
in the current sentence; these buckets are exactly those whose index
@@ -589,7 +594,7 @@ those bits that should remain zero. For example, the following
program prints all those 16-bit integers that contain zeroes in all
even bit positions:
main(){int i=0,s=0xAAAA;do{printf("%04x\t",i);}while(i=((i|~s)+1)&s);}
-AG uses a similar method but works in the opposite direction, finding +
AG uses a similar method but works in the opposite direction, finding
the next lower value with zeroes in given bit positions by propagating
borrows across those bits. Some additional adjustments are made
to the hash table index when initiating a recursive search, using
diff --git a/bugs.html b/bugs.html
index 721274cc8..f47eee293 100644
--- a/bugs.html
+++ b/bugs.html
@@ -1128,18 +1128,29 @@ entry itself. Can you fix the actual entry? You are welcome to try and do so.
Cody changed it so that the buffer size is ARG_MAX+1 to try and get past the
-problem of gets() being used in a more complex way.
It would be ideal if it were to use fgets() though. A tip on how
-gets() is being used from Cody:
Previously it had a buffer size of 256 which could easily overflow. In this
+problem of gets() being used in a more complex way. It is most unlikely that
+the dictionary file will ever have a line longer than 256 but even so it would
+be ideal if the code used fgets(3) instead. A tip on how gets(3) is being
+used:
Previously it had a buffer size of 256 for reading in the dictionary lines. In this
entry gets(3) is used in a more complicated way: first m is set to *++p in
a for loop where p is argv. Later m is set to point to h which was of size
-256. gets(3) is called as m = gets(m)) but trying to change it to use
-fgets(3) proved more a problem. Since the input must come from the command
-line Cody changed the buffer size to ARG_MAX+1 which should be enough (again
-theoretically) especially since the command expects redirecting a dictionary
-file as part of the command line. This also makes it possible for longer strings
-to be read (in case the gets(3) was not used in a loop).
gets(3) is called as m = gets(m)) but trying to change it to use
+On the other hand, the author noted the following bugs and limitations:
+AG.AG cannot handle characters that sign-extend to negative values.AG works on both 16-bit and 32-bit machines, the size of the problems
+it can solve is severely limited on machines that limit the stack size to 64k or
+less.… so whether or not the gets(3) should be changed to fgets(3) is up to
+debate.
When your own checkmate is imminent it prints "Har har" but does not exit so
@@ -1227,7 +1238,7 @@ it yourself through ctrl-c or killing it in some other fashion.
Cody improved the usability of this program by making it so that as long as the @@ -1256,7 +1267,7 @@ it’s not a misunderstanding).
The author stated that:
@@ -1282,7 +1293,7 @@ system), this entry just shows a blank screen.This entry relied on a bug in gcc that was fixed with gcc version 2.3.3. This @@ -1292,7 +1303,7 @@ the index.html file for details.
Although the code checks if the file can be opened or not, badly formatted files @@ -1302,7 +1313,7 @@ through ctrl-c or such.
If the file cannot be opened it will very likely segfault. This should not be @@ -1331,7 +1342,7 @@ question you might cause an error. For instance don’t do this:
No spaces are allowed in the expression.
@@ -1347,7 +1358,7 @@ notd-46.
When you initiate shooting via the s command you immediately lose an arrow
@@ -1358,7 +1369,7 @@ there.
Cody Boone Ferguson fixed this to compile @@ -1461,7 +1472,7 @@ compiled!
This program will likely crash if the source code file (by the name of the file @@ -1510,7 +1521,7 @@ doesn’t break something else.
This did not originally compile under macOS and after it did compile under @@ -1542,7 +1553,7 @@ it would be good if it was fixed.
This program expects a POSITIVE number. If you specify a negative number it will @@ -1607,7 +1618,7 @@ almost be done except that some of the output of the
If X is not running this program will very likely crash or do something funny. @@ -1650,7 +1661,7 @@ to the page as well! You’ll have IOCCC fame for reviving a pootifier! :-)
A point worth considering is that as the number passed into the program gets @@ -1807,7 +1818,7 @@ on the stack at that point:
5which might (?) suggest that the + operator is unimplemented. Unfortunately it
has been many years since I have used perl and I was never a guru either.
The author states that in perl < 5.6.0 there is a bug with a core dump in what
they said is in Perl_sv_upgrade. As this is documented it is not considered a
bug to be fixed. For the curious this will crash in macOS. Cody notes that the
@@ -1849,7 +1860,7 @@ of 92 warnings! Nonetheless neither works okay and both crash.
This program does not do what you might think it does! Running it like:
@@ -1867,7 +1878,7 @@ make a pull request.If DISPLAY is not set the program will very likely crash, do something strange
@@ -1881,7 +1892,7 @@ fire! :-) ).
Cody Boone Ferguson fixed this so that it @@ -1900,7 +1911,7 @@ elves of Imladris :-(
This program will crash without an arg.
This program deliberately crashes if it loses (which is what it aims to do).
@@ -1977,7 +1988,7 @@ appreciate your help!Sometimes when one player presses q it will result in broken pipe on the other
@@ -1995,7 +2006,7 @@ set. In other words both have to be ASCII or EBCDIC - not one of each.
This program will very likely crash or do something unexpected if you do not @@ -2011,7 +2022,7 @@ wanted to install it as a tool but this is missing.
The glob pattern must match the whole string. See the author’s comments for @@ -2179,13 +2190,13 @@ compile under clang. The following patch was applied:
gavin_files: boot.b lilo.conf prim gavin_install.txtThe current (Makefile was modified to try and fit into the current IOCCC build environment.
-See known features in the index.html for things that are not bugs but documented (mis)features.
The author stated that:
@@ -2210,7 +2221,7 @@ things that are not bugs but documented (mis)features.The generated code will very likely segfault or do something not intended if not @@ -2223,7 +2234,7 @@ given the right args. See the index.html file for the correct syntax.
This program sometimes will create unsolvable puzzles :-) just to hook you.
@@ -2237,7 +2248,7 @@ dimensions. Try 100 100 100 for instance and see what happens!
This entry will very likely segfault or do something strange if the source code @@ -2246,7 +2257,7 @@ does not exist.
The author states:
@@ -2280,7 +2291,7 @@ for running itself.Cody Boone Ferguson notes that, though @@ -2294,7 +2305,7 @@ website itself.
The author stated the below points of interest.
@@ -2335,7 +2346,7 @@ with at leastcomputer.tofu input file:
The string specified must be <= 42 characters and may only consist of the @@ -2344,7 +2355,7 @@ with possibly corrupt GIF files.
This program will likely crash or do something funny without an arg.
@@ -2363,12 +2374,12 @@ but you are welcome to try and fix it. provide it as an additional alt version. Fixing this is very likely to be very challenging and in some systems it will not be possible to fix but you are welcome to try and fix it if you wish to! -Incorrect formulas will ungracefully crash the program.
This program will likely crash or do something funny if the file cannot be @@ -2376,7 +2387,7 @@ opened. The number of args is however checked.
The author stated:
@@ -2393,7 +2404,7 @@ opened. The number of args is however checked.Cody Boone Ferguson fixed this program to @@ -2440,7 +2451,7 @@ case-sensitive.
For a great amount of data points the program will crash, depending on your @@ -2463,7 +2474,7 @@ bins at the edges.
instead being something else entirely. The Internet Wayback Machine, although it archived it, did not load scripts. Do you know if the domain was moved? Do you have an archive or mirror? Please provide us it! Thank you. -The author states the following:
Bad input (e.g. nonexistent files, non-numeric number of iterations, etc.) @@ -2476,7 +2487,7 @@ tends to result in empty output.
The author stated that there are a number of features and limitations. As the @@ -2486,7 +2497,7 @@ remarks instead.
This program will very likely crash or do something funny without an arg.
@@ -2655,7 +2666,7 @@ defined.The author stated that the program will crash if no argument is passed to the @@ -2669,7 +2680,7 @@ fire :-)
The author stated:
@@ -2678,7 +2689,7 @@ fire :-)The author stated:
@@ -2711,7 +2722,7 @@ fire :-)The author stated:
@@ -2725,7 +2736,7 @@ doesn’t make it possible to lock drawing to the display refresh rate.)The author stated:
@@ -2746,7 +2757,7 @@ doesn’t make it possible to lock drawing to the display refresh rate.)The author stated that the program will crash if no argument is passed to the @@ -2762,7 +2773,7 @@ fire :-)
The author stated:
@@ -2782,7 +2793,7 @@ and endianness conversion would make the source too large for IOCCC rule 2).This program will possibly crash or draw something strange with 0 args. Then @@ -2801,7 +2812,7 @@ used.
From the author:
@@ -2817,7 +2828,7 @@ used.From the author:
@@ -2830,14 +2841,14 @@ such asC2E2.
Invalid input files will very likely crash the program.
This program will not terminate on its own; you must kill hou (but not Qiming
@@ -2845,7 +2856,7 @@ Hou :-) ) yourself. This should not be fixed.
The author reminds us that if you kill the program you will have to wait a short @@ -2862,7 +2873,7 @@ it out as a known limitation it is not a bug but a feature.
The author noted that in macOS the colours might be wrong. They gave a solution. @@ -2886,7 +2897,7 @@ player become bigger, stay away from blocks!
This program will very likely crash if no arg is given.
@@ -2927,7 +2938,7 @@ rely on the entry as the below shows. One should be able to do:The author stated:
@@ -2971,7 +2982,7 @@ because it is the same thing as the other, just updated to useprog.alt
2015/mills2
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2015/mills2/prog.c
Information: 2015/mills2/index.html
The program doesn’t look at the header of files so if it’s passed something hat
@@ -2980,7 +2991,7 @@ is not compressed data it’s likely to crash.
2015/schweikhardt
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2015/schweikhardt/prog.c
Information: 2015/schweikhardt/index.html
The program assumes that EOF is -1. This can be fixed but at this time it is
@@ -3013,7 +3024,7 @@ use 8 * sizeof(typ) bits per place. It does not work when CHA
2018/algmyr
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2018/algmyr/prog.c
Information: 2018/algmyr/index.html
The author wrote:
@@ -3032,7 +3043,7 @@ loop printing whitespace.
2018/hou
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2018/hou/prog.c
Information: 2018/hou/index.html
When you run it on a JSON file you will see something like:
@@ -3057,7 +3068,7 @@ likely see:
where [] is the cursor. When this happens if you hit enter (this is necessary
or else it’ll happen again) and then exit again (ctrl-e) and run prog again
it’ll be okay.
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
The author stated that if you make a typo it can happen that the boot loader can
crash and halt. If this is the case type ctrl-e to quit the emulator and try
again.
@@ -3072,7 +3083,7 @@ in the case of compiled code it won’t be executable).
2018/vokes
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2018/vokes/prog.c
Information: 2018/vokes/index.html
The author wrote the following:
@@ -3122,7 +3133,7 @@ this program has nothing to do with a hand.
2019/adamovsky
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/adamovsky/prog.c
Information: 2019/adamovsky/index.html
Certain input can crash this program. The file
@@ -3130,7 +3141,7 @@ this program has nothing to do with a hand.
2019/burton
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/burton/prog.c
Information: 2019/burton/index.html
The author pointed out that some implementations of wc(1) show different
@@ -3138,7 +3149,7 @@ values but his implementation matches that of macOS and FreeBSD.
2019/ciura
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/ciura/prog.c
Information: 2019/ciura/index.html
Cody Boone Ferguson fixed the scripts so
@@ -3170,7 +3181,7 @@ ideal if this was not the case.
2019/duble
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/duble/prog.c
Information: 2019/duble/index.html
There are two things to be aware of with this entry.
@@ -3199,7 +3210,7 @@ in the directory:
2019/endoh
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/endoh/prog.c
Information: 2019/endoh/index.html
As a backtrace quine this entry is SUPPOSED to segfault so this should not be
@@ -3207,7 +3218,7 @@ touched either.
2019/karns
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/karns/prog.c
Information: 2019/karns/index.html
The author stated the following:
@@ -3237,7 +3248,7 @@ touched either.
2019/lynn
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/lynn/prog.c
Information: 2019/lynn/index.html
The author wrote that there are a number of differences from what one might
@@ -3247,7 +3258,7 @@ remarks in the sections Syntax and
2019/mills
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/mills/prog.c
Information: 2019/mills/index.html
The author wrote that if you decide to change networks or use a different input
@@ -3267,7 +3278,7 @@ a crash.
2019/poikola
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/poikola/prog.c
Information: 2019/poikola/index.html
This program will not validate input so it might fail or get stuck if invoked
@@ -3276,7 +3287,7 @@ erroneously.
2019/yang
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2019/yang/prog.c
Information: 2019/yang/index.html
The author noted that if the program runs out of memory it is likely to crash.
@@ -3291,7 +3302,7 @@ ignored except line feeds (preserved) and tabs (expanded to 8 spaces).’
2020/burton
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2020/burton/prog.c
Information: 2020/burton/index.html
This entry is known to crash if no arg is specified. Although easy to fix it is
@@ -3302,7 +3313,7 @@ either. But can you figure out why this happens?
2020/carlini
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2020/carlini/prog.c
Information: 2020/carlini/index.html
The author stated that bad things happen if the entered move is outside of the
@@ -3316,7 +3327,7 @@ move.
2020/ferguson1
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2020/ferguson1/prog.c
Information: 2020/ferguson1/index.html
There are some things that might appear to be bugs but are actually features or
@@ -3326,7 +3337,7 @@ things that are misinterpreted as bugs. See the
2020/giles
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2020/giles/prog.c
Information: 2020/giles/index.html
The author noted that the program only supports WAV files that have
@@ -3335,7 +3346,7 @@ audio channels.
2020/otterness
-STATUS: INABIAF - please DO NOT fix
+STATUS: INABIAF - please DO NOT fix
Source code: 2020/otterness/prog.c
Information: 2020/otterness/index.html
The author listed the following limitations:
diff --git a/bugs.md b/bugs.md
index 5c82b5242..1b7a5dff5 100644
--- a/bugs.md
+++ b/bugs.md
@@ -1071,22 +1071,34 @@ entry itself. Can you fix the actual entry? You are welcome to try and do so.
### Information: [1992/gson/index.html](1992/gson/index.html)
Cody changed it so that the buffer size is `ARG_MAX+1` to try and get past the
-problem of `gets()` being used in a more complex way.
+problem of `gets()` being used in a more complex way. It is most unlikely that
+the dictionary file will ever have a line longer than 256 but even so it would
+be ideal if the code used `fgets(3)` instead. A tip on how `gets(3)` is being
+used:
-It would be ideal if it were to use `fgets()` though. A tip on how
-`gets()` is being used from Cody:
-
-Previously it had a buffer size of 256 which could easily overflow. In this
+Previously it had a buffer size of 256 for reading in the dictionary lines. In this
entry `gets(3)` is used in a more complicated way: first `m` is set to `*++p` in
a for loop where `p` is argv. Later `m` is set to point to `h` which was of size
256\. `gets(3)` is called as `m = gets(m)`) but trying to change it to use
-`fgets(3)` proved more a problem. Since the input must come from the command
-line Cody changed the buffer size to `ARG_MAX+1` which should be enough (again
-theoretically) especially since the command expects redirecting a dictionary
-file as part of the command line. This also makes it possible for longer strings
-to be read (in case the `gets(3)` was not used in a loop).
+### STATUS: INABIAF - please **DO NOT** fix
+
+On the other hand, the author noted the following bugs and limitations:
+
+- There is no error checking.
+- Standard input must be seekable, so you can't pipe the dictionary into `AG`.
+- The input sentence and each line in the dictionary may contain at most 32
+distinct letters, and each letter may occur at most 15 times.
+- Words in the dictionary may be at most 255 bytes long.
+- `AG` cannot handle characters that sign-extend to negative values.
+- Although `AG` works on both 16-bit and 32-bit machines, the size of the problems
+it can solve is severely limited on machines that limit the stack size to 64k or
+less.
+
+... so whether or not the `gets(3)` should be changed to `fgets(3)` is up to
+debate.
+
## 1992/kivinen
diff --git a/thanks-for-help.html b/thanks-for-help.html
index 335466aa4..433d04261 100644
--- a/thanks-for-help.html
+++ b/thanks-for-help.html
@@ -1735,11 +1735,6 @@ included in their remarks. See the index.html for its purpose. It was NOT fixed
for ShellCheck
because the author deliberately obfuscated it so PLEASE DO NOT FIX THIS OR
MODERNISE IT.
-Cody also changed the buffer size in such a way that gets(3) should be safe
-(well, theoretically) as it comes from the command line (though it can also read input
-from stdin after starting the program). Ideally fgets(3) would be used but this
-is a more problematic. See 1992/gson in bugs.html for more
-details if you’re interested in trying to understand it (or fix?).
Winning entry: 1992/imc
Winning entry source code: imc.c
diff --git a/thanks-for-help.md b/thanks-for-help.md
index f5a2f7621..7f2fb99ea 100644
--- a/thanks-for-help.md
+++ b/thanks-for-help.md
@@ -1932,12 +1932,6 @@ for [ShellCheck](https://www.shellcheck.net)
because the author deliberately obfuscated it so **PLEASE *DO NOT* FIX THIS OR
MODERNISE IT**.
-Cody also changed the buffer size in such a way that `gets(3)` should be safe
-(well, theoretically) as it comes from the command line (though it can also read input
-from `stdin` after starting the program). Ideally `fgets(3)` would be used but this
-is a more problematic. See [1992/gson in bugs.html](bugs.html#1992_gson) for more
-details if you're interested in trying to understand it (or fix?).
-
## Winning entry: [1992/imc](1992/imc/index.html)