About why it's useful. It's a problem to keep gets() but it might be a
problem to not keep it as well. Nevertheless with macOS the output of
the alternative code (which probably should be deleted but this can
happen another time) is confusing:
$ ./tbr.alt
$ warning: this program uses gets(), which is unsafe.
[]
The [] is the cursor on a blank line. The first line of output of the
program (which is not supposed to have a newline) instead has the
warning and then a newline appended to it.
About why it's useful. It's both a problem to keep gets() but it's also
potentially a problem to change it to fgets(). But as it will prevent
alarming the user with warnings about gets() and also causing messed up
output (see below) this is useful.
With the original code one will see under macOS something like:
$ ./cmills.alt
Shuffle...
warning: this program uses gets(), which is unsafe.
Total $1000. Wager?
which is very wrong.
I did not delete the cmills.alt.c but perhaps it should be deleted. That
can come another time.
As part of the redefinition of INABIAF two segfault fixes were undone.
These are noted in the Makefile and README.md file.
One fix was necessary and that has been left alone.
As part of the redefinition of INABIAF one of the segfault fixes has
been undone. The others were necessary as part of making the entry work
in modern systems but this one should not have been done. Instead the
Makefile and README.md warn about it.
I did however discover another bug with this entry that makes one of the
generated programs not work. I documented that in bugs.md and I'll look
at it another time.
As part of the redefinition of INABIAF the NULL file protection was
removed. The bus error fix, the erroneous prototype to fopen() and the
fgets() fix are still applied as these allow the entry to work properly
(and without an obnoxious warning at compile, linking or runtime about
gets()).
As part of redefining INABIAF the entry now has an equivalent
functionality with the generated output. The bugs.md file still has
hints on how to get this to use fgets() (for why this is helpful see
that file). As a starting point I have the original buffer size increase
in schnitzi.alt.c as it would be useful to see how it works and to maybe
get the entry to use fgets(). Unfortunately keeping it using gets() is a
potential problem but changing it to fgets() is also a potential problem
(this goes for all of the entries that use or used gets()). This entry
however still uses gets(). The change is the smaller buffer size which
means that the entry can not handle big files.
The Makefile and README.md now refer to the small buffer size.
When fixing the entries that did not work I went a bit too far and fixed
other problems as well. This should not have been done and there was
ever a doubt in my mind about it. The coming commits will be undoing
these changes (though the vast majority that were modified were not in
this category). An INABIAF now includes segfaults both that are
documented and not documented unless it prevents the entry from working.
It also includes other things that are both documented and not
documented.
After all it's not like the winning entries are meant to be code that is
maintainable or good quality (even if they work well). One might even
say that they should be buggy! :-) (and in some cases which were never
touched they're supposed to crash or do this or that).
In the case of gets() versus fgets() this is not so clear. The reason is
that in modern systems one will get a warning at compile time or linking
time (I mostly noted linking time) but also (in some systems like macOS)
runtime. These warnings can be alarming and interfering. In some entries
it caused confusing output a great example being 1990/tbr. The alt code
(which might want to be removed) will show something like:
$ ./tbr.alt
$ warning: this program uses gets(), which is unsafe.
#
The '#' is a blank line but if you notice above it the first line of
output of the program has the warning attached to it. This is both
confusing and annoying. There are other entries with this same problem,
some of them fixed and some not.
If an entry did not work and I fixed that part but also fixed other
issues I've done my best to make sure that only the fixes that are
needed are there.
I also tried to put notes in both the Makefile and README.md of each
entry where there is a problem so as to alert users that this or that
entry does crash if not given valid input so they don't think it's
broken. I might have missed some but as I go through the upcoming
commits I will look at them again to see if I covered them all.
But this commit and the next commits will make the quality of the
winning entries better (if making them more buggy can be called better
quality :-) ) or at least more correct.
Should one wish to see fixes they can use git to find them. In the
bugs.md file I have reworded (and added the exception of the author) the
INABIAF status and moved it to the bottom of the statuses list. I also
probably reworded some of the other statuses and possibly added a status
as well.
The entries that have been added to the file will be committed one at a
time. Some other entries that needn't be in the bugs.md will also be
updated (README.md files for instance) but all of these are ones that
were updated already in some form or another.
One needs to make clobber for this entry to work right! It cannot easily
be added to the Makefile as the rule depends on the source code. This
probably should be fixed.
Make it a bit more portable (assuming env is under /usr/bin):
#!/usr/bin/env bash
instead of
#!/bin/bash
And although Landon suggested that I will never be done with changes in
my entries (which is probably true I confess ... :-) ) I suggest that in
this case this is rather useful (in fact I should do this for
2020/ferguson1 as there are several scripts there .. maybe
2020/ferguson2 but I don't know for sure).
I've not gone through the file entirely but I have some significant
fixes to make and I want to get my working repo clean so I can do these
fixes. I'll go through this file in full later.
This tmp directory will go away.
The purpose of this directory is to hold temporary files.
For example: CVS text files, that will later be used to generate JSON files.
Instead of relying on curl to obtain the text files just add them to the
repo.
Typo fixes.
Formatting fixes.
Added what on Middle-earth lámatyávë is to the README.md so that people
may enjoy the award title a bit better. From Morgoth's Ring, volume X of
the wonderful set History of Middle-earth (HoMe), one of many things
that were edited and published by the late Christopher Tolkien, heir and
literary executor of the great Tolkien.