Merge pull request #2705 from xexyl/clean-up-bugs
This commit is contained in:
2 files changed
+320
-350
No files matched your search
@@ -443,14 +443,13 @@ might seem to be fine but is actually not! We will note some where this is known
|
|||||||
to happen (if it’s not yet fixed). This has actually already happened to us.
|
to happen (if it’s not yet fixed). This has actually already happened to us.
|
||||||
Sometimes it is okay: some entries are known to not work but they can still have
|
Sometimes it is okay: some entries are known to not work but they can still have
|
||||||
improvements (rarer situation but it’s happened). Some might have slightly
|
improvements (rarer situation but it’s happened). Some might have slightly
|
||||||
different output but which is not a problem for instance a newline after output
|
different output but which is not a problem for instance a newline after output.
|
||||||
in <a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a>’s changing it to
|
This is not the most ideal but it is okay.</p>
|
||||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/ldb/ldb.c">1994/ldb</a> use <code>fgets()</code> from <code>gets()</code>.</p>
|
|
||||||
<p>Make <strong>ABSOLUTE CERTAIN</strong> that you read the index.html file <em>BEFORE</em> your changes
|
<p>Make <strong>ABSOLUTE CERTAIN</strong> that you read the index.html file <em>BEFORE</em> your changes
|
||||||
as it’s important to see that the code is doing what it is supposed to. In the
|
as it’s important to see that the code is doing what it is supposed to. In the
|
||||||
case that it’s not obvious (some index.html files do not even have commands to
|
case that it’s not obvious (some index.html files do not even have commands to
|
||||||
try or even explain how to use it!) then you should either skip the entry OR ask
|
try or even explain how to use it!) then you should either skip the entry OR ask
|
||||||
someone who will know e.g. us.</p>
|
someone who will know for instance the Judges.</p>
|
||||||
<p>Make <strong>ABSOLUTE CERTAIN</strong> that you read the next section, the list of statuses
|
<p>Make <strong>ABSOLUTE CERTAIN</strong> that you read the next section, the list of statuses
|
||||||
and the related information, BEFORE you submit a pull request!</p>
|
and the related information, BEFORE you submit a pull request!</p>
|
||||||
<p><strong>BE VERY AWARE</strong> that sometimes fixing an entry for one platform will break it
|
<p><strong>BE VERY AWARE</strong> that sometimes fixing an entry for one platform will break it
|
||||||
@@ -480,17 +479,17 @@ different warnings.</p>
|
|||||||
sizes on different platforms. These tend to be required at the risk that
|
sizes on different platforms. These tend to be required at the risk that
|
||||||
sometimes the entry will not work for certain platforms, some of which might or
|
sometimes the entry will not work for certain platforms, some of which might or
|
||||||
might not be fixable; a good example where it was required to change and is okay
|
might not be fixable; a good example where it was required to change and is okay
|
||||||
is when <a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed the
|
is the fix of the segfault in macOS of
|
||||||
segfault in macOS of <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.c">1989/paul</a>: changing the <code>int *</code> to a
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/paul/paul.c">1989/paul</a>: changing the <code>int *</code> to a <code>long *</code>
|
||||||
<code>long *</code> was required and it works just as well with linux.</p>
|
was required and it works just as well with linux.</p>
|
||||||
<p>But even if they are fixable (which will likely be hard to do) it’s almost
|
<p>But even if they are fixable (which will likely be hard to do) it’s almost
|
||||||
certain that such code would be just as non-portable (importable ? :-) ).</p>
|
certain that such code would be just as non-portable (importable ? :-) ).</p>
|
||||||
<p>In rare cases they are valid. For instance Cody noticed in linux the following
|
<p>In rare cases they are valid. For instance in linux the following
|
||||||
warning in <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/applin/applin.c">1985/applin</a> with gcc:</p>
|
warning in <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1985/applin/applin.c">1985/applin</a> with gcc:</p>
|
||||||
<pre><code> applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
|
<pre><code> applin.c:1:78: warning: incompatible implicit declaration of built-in function 'execlp' [-Wbuiltin-declaration-mismatch]
|
||||||
1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
|
1 | main(v,c)char**c;{for(v[c++]=strdup("Hello, world!\n");(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
|
||||||
| ^~~~~~</code></pre>
|
| ^~~~~~</code></pre>
|
||||||
<p>and this reminded him of his fix to
|
<p>and this is is kind of like the fix to
|
||||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.c">1984/anonymous</a>. In the case of <code>1984/anonymous</code> it
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/anonymous/anonymous.c">1984/anonymous</a>. In the case of <code>1984/anonymous</code> it
|
||||||
was a bit more involved but with <code>1985/applin</code> one need only add to the Makefile
|
was a bit more involved but with <code>1985/applin</code> one need only add to the Makefile
|
||||||
<code>-include unistd.h</code>. So there are some cases where fixing warnings can fix a
|
<code>-include unistd.h</code>. So there are some cases where fixing warnings can fix a
|
||||||
@@ -507,14 +506,14 @@ include you can update the Makefile <code>CINCLUDE</code> variable. For instance
|
|||||||
needs <code>stdio.h</code> you could do <code>-include stdio.h</code>. Please leave a space after the
|
needs <code>stdio.h</code> you could do <code>-include stdio.h</code>. Please leave a space after the
|
||||||
<code>=</code> in the Makefile. You may also have extra long lines if this seems useful to
|
<code>=</code> in the Makefile. You may also have extra long lines if this seems useful to
|
||||||
make it a one-liner even if it kind of makes it longer than what the judges
|
make it a one-liner even if it kind of makes it longer than what the judges
|
||||||
consider a one-liner. Thank you!</p>
|
consider a one-liner, at least within reason. Thank you!</p>
|
||||||
<h3 id="on-layout-of-program-source">On layout of program source:</h3>
|
<h3 id="on-layout-of-program-source">On layout of program source:</h3>
|
||||||
<p>If you make changes <em>PLEASE TRY AND KEEP THE SOURCE CODE LAYOUT AS CLOSE TO THE
|
<p>If you make changes <em>PLEASE TRY AND KEEP THE SOURCE CODE LAYOUT AS CLOSE TO THE
|
||||||
ORIGINAL AS POSSIBLE</em>. This might not always be possible and if you have an
|
ORIGINAL AS POSSIBLE</em>. This might not always be possible and if you have an
|
||||||
editor that does formatting it can cause problems. Sometimes formatters can even
|
editor that does formatting it can cause problems. Sometimes formatters can even
|
||||||
break code! <a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> has
|
break code! Some have experienced this many times with vim so he tends to
|
||||||
experienced this many times with vim so he tends to disable all format options
|
disable all format options when formatting code. In vim you should be able to do
|
||||||
when formatting code. In vim you should be able to do that with:</p>
|
that with:</p>
|
||||||
<pre><code> :set formatoptions=</code></pre>
|
<pre><code> :set formatoptions=</code></pre>
|
||||||
<h2 id="status-known-bug">STATUS: known bug</h2>
|
<h2 id="status-known-bug">STATUS: known bug</h2>
|
||||||
<p><strong>Please help us fix</strong>!</p>
|
<p><strong>Please help us fix</strong>!</p>
|
||||||
@@ -564,7 +563,7 @@ much as possible given the nature of how it generates code: the entry itself
|
|||||||
compiles but two versions of code it generates does not work with clang.</p>
|
compiles but two versions of code it generates does not work with clang.</p>
|
||||||
<p>However some still might have problems of some kind or another and some might
|
<p>However some still might have problems of some kind or another and some might
|
||||||
not yet be located as an additional defect of clang was noticed where <code>main()</code>
|
not yet be located as an additional defect of clang was noticed where <code>main()</code>
|
||||||
is not allowed four args or one arg.</p>
|
is not allowed four args or one arg (see below).</p>
|
||||||
<p>This is what the status means, however.</p>
|
<p>This is what the status means, however.</p>
|
||||||
<p>Entries with this status have a problem in that the args to main() are not of a
|
<p>Entries with this status have a problem in that the args to main() are not of a
|
||||||
specific type or there are too many due to this being allowed in earlier C. Some
|
specific type or there are too many due to this being allowed in earlier C. Some
|
||||||
@@ -572,24 +571,24 @@ compilers like clang have a defect where they do not allow this and some
|
|||||||
versions have an additional defect where they only allow 0, 2 or 3 args, the
|
versions have an additional defect where they only allow 0, 2 or 3 args, the
|
||||||
latter of which affected <code>1989/westley</code>, so these entries do not work with
|
latter of which affected <code>1989/westley</code>, so these entries do not work with
|
||||||
clang.</p>
|
clang.</p>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> looked at the source
|
<p>Looking at the source
|
||||||
code of clang and reported that there is no way to override the requirement of
|
code of clang, it appears that there is no way to override the requirement of
|
||||||
arg types so these entries will fail to compile with clang. That’s why in some
|
arg types so these entries will fail to compile with clang. That’s why in some
|
||||||
entries he fixed he did it by adding a function called <code>pain()</code>. :-) He did not
|
entries the fix was done with a new function, often called <code>pain()</code> :-)</p>
|
||||||
check for the number of args as that was discovered later but he suspects it’s
|
|
||||||
the same issue.</p>
|
|
||||||
<p><strong>NOTE for macOS users</strong>: please be aware that <em>gcc</em> under macOS <strong>is actually
|
<p><strong>NOTE for macOS users</strong>: please be aware that <em>gcc</em> under macOS <strong>is actually
|
||||||
clang</strong> despite the fact it might appear to be gcc: no symlink and both gcc and
|
clang</strong> despite the fact it might appear to be gcc: no symlink and both gcc and
|
||||||
clang exist but the gcc is clang which you’ll see if you run <code>gcc --version</code>.</p>
|
clang exist but the gcc is clang which you’ll see if you run <code>gcc --version</code>.</p>
|
||||||
<p>A tip and some fix methods from Cody: in the older days args to main() not given
|
<p>A tip and some fix methods from <a href="authors.html#Cody_Boone_Ferguson">Cody Boone
|
||||||
a type were implicit ints but when they’re required to be <code>char **</code> this can
|
Ferguson</a>: in the older days args to main()
|
||||||
cause a problem. In some cases Cody was able to use a <code>char *</code> inside <code>main()</code>
|
not given a type were implicit ints but when they’re required to be <code>char **</code>
|
||||||
(see <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/tromp/tromp.c">1989/tromp/tromp.c</a> and
|
this can cause a problem. In some cases it was possible to use a <code>char *</code> inside
|
||||||
<a href="1986/holloway/index.html">1986/holloway/holloway.c</a> for two examples though done slightly
|
<code>main()</code> (see <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1989/tromp/tromp.c">1989/tromp/tromp.c</a> and
|
||||||
differently). In other cases he was able to dereference the pointers to be used
|
<a href="1986/holloway/index.html">1986/holloway/holloway.c</a> for two examples though
|
||||||
like an int and other times a cast was necessary. He used other various
|
done slightly differently). In other cases it was possible to dereference the
|
||||||
techniques to get them to compile. In some cases this introduced a problem but
|
pointers to be used like an int and other times a cast was necessary. There are
|
||||||
typically if not always that problem exists with compilers that are less strict.</p>
|
various techniques to get these to compile. In some cases this introduced a
|
||||||
|
problem but typically if not always that problem exists with compilers that are
|
||||||
|
less strict.</p>
|
||||||
<h2 id="status-main-has-only-one-arg">STATUS: main() has only one arg</h2>
|
<h2 id="status-main-has-only-one-arg">STATUS: main() has only one arg</h2>
|
||||||
<p><strong>Please help modify so that main() as 2 or 3 args</strong>!</p>
|
<p><strong>Please help modify so that main() as 2 or 3 args</strong>!</p>
|
||||||
<p>Because some versions of clang complain about the number of args of <code>main()</code> and
|
<p>Because some versions of clang complain about the number of args of <code>main()</code> and
|
||||||
@@ -611,37 +610,35 @@ or if you can <code>-ggdb3</code> when compiling as that will help with debuggin
|
|||||||
<h2 id="status-uses-gets">STATUS: uses gets()</h2>
|
<h2 id="status-uses-gets">STATUS: uses gets()</h2>
|
||||||
<p><strong>Please help us change use of gets() to fgets()</strong>, if possible.</p>
|
<p><strong>Please help us change use of gets() to fgets()</strong>, if possible.</p>
|
||||||
<p>Entries with this status use <code>gets()</code> which is unsafe because it has no limit on
|
<p>Entries with this status use <code>gets()</code> which is unsafe because it has no limit on
|
||||||
the length of the string. <a href="authors.html#Cody_Boone_Ferguson">Cody Boone
|
the length of the string. Many were fixed but not all.</p>
|
||||||
Ferguson</a> has fixed several of these and he’s
|
<p>There’s a very good reason for this change even though it is bordering on tampering
|
||||||
working on others in between fixing other things.</p>
|
|
||||||
<p>There’s a very good reason for this even though it is bordering on tampering
|
|
||||||
entries: in modern systems one will get possibly alarming and certainly annoying
|
entries: in modern systems one will get possibly alarming and certainly annoying
|
||||||
warnings during at least one of compiling, linking and execution. In macOS it’s
|
warnings during at least one of compiling, linking and execution. In macOS it’s
|
||||||
most annoying as it happens during execution (also compilation) with the warning
|
most annoying as it happens during execution (also compilation) with the warning
|
||||||
being interspersed with the output of the program, often causing confusing
|
being interspersed with the output of the program, often causing confusing
|
||||||
output with the entry. A good example that was fixed is
|
output with the entry. A good example that was fixed is
|
||||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.c">1990/tbr</a>.</p>
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.c">1990/tbr</a>.</p>
|
||||||
<p>Cody provided some important notes on this status with respect to fixing /
|
<p>Some important notes on this status with respect to fixing / changing the
|
||||||
changing entries:</p>
|
entries:</p>
|
||||||
<ol start="0" type="1">
|
<ol start="0" type="1">
|
||||||
<li><p>In some cases changing the entry to use <code>fgets()</code> will break the entry and in
|
<li><p>In some cases changing the entry to use <code>fgets()</code> will break the entry and in
|
||||||
some cases cause it to crash. Where this is known we will document it. Some of
|
some cases cause it to crash. Where this is known we will document it.</p></li>
|
||||||
these Cody is also off and on working on.</p></li>
|
|
||||||
<li><p>You <strong>MUST</strong> check the output before and after to make sure that it remains
|
<li><p>You <strong>MUST</strong> check the output before and after to make sure that it remains
|
||||||
the same. Sometimes the output might not be immediately obviously wrong but is.
|
the same. Sometimes the output might not be immediately obviously wrong but is.
|
||||||
We will document known examples as we come across them.</p></li>
|
We will document known examples as we come across them.</p></li>
|
||||||
<li><p><code>gets()</code> does NOT STORE the <code>'\n'</code> but <code>fgets()</code> DOES! This is one of the
|
<li><p><code>gets()</code> does NOT STORE the <code>'\n'</code> but <code>fgets()</code> DOES! This is one of the
|
||||||
reasons some of the entries break when changed to <code>fgets()</code>. Cody has fixed some
|
reasons some of the entries break when changed to <code>fgets()</code>. Some of those have
|
||||||
of these but there are others he hasn’t had time to address or even discover
|
been fixed but there are others that have not been.</p></li>
|
||||||
yet.</p></li>
|
|
||||||
<li><p>Just because you don’t see the string <code>gets</code> in the code does not mean it’s
|
<li><p>Just because you don’t see the string <code>gets</code> in the code does not mean it’s
|
||||||
not used. It is after all the International <em>Obfuscated C Code</em> Contest! :-)
|
not used. It is after all the International <em>Obfuscated C Code</em> Contest! :-)
|
||||||
Sometimes it will be in the Makefile and other times it will be obfuscated in
|
Sometimes it will be in the Makefile and other times it will be obfuscated in
|
||||||
other ways. Compilers and linkers tend to warn about its use (and as noted in
|
other ways; a good example of that that was fixed is
|
||||||
macOS it also happens at execution) and this is a good way to find entries that
|
<a href="1991/dds/index.html">1991/dds</a>: in this case the string was encrypted.
|
||||||
use it even if it’s not visible in the code.</p></li>
|
Compilers and linkers tend to warn about its use (and as noted in macOS it also
|
||||||
|
happens at execution) and this is a good way to find entries that use it even if
|
||||||
|
it’s not visible in the code.</p></li>
|
||||||
</ol>
|
</ol>
|
||||||
<p><em>NOTE</em>: this status is <em>NOT necessarily mutually exclusive</em> with the <em>INABIAF</em>
|
<p><strong>NOTE</strong>: this status is <em>NOT necessarily mutually exclusive</em> with the <em>INABIAF</em>
|
||||||
(it’s not a bug it’s a feature) status. The reason for this is due to warnings
|
(it’s not a bug it’s a feature) status. The reason for this is due to warnings
|
||||||
during compiling, linking and/or runtime, sometimes causing confusing output (as
|
during compiling, linking and/or runtime, sometimes causing confusing output (as
|
||||||
noted above).</p>
|
noted above).</p>
|
||||||
@@ -683,7 +680,7 @@ version that works in modern systems) is very system specific and was before
|
|||||||
system specific winning entries were discouraged. This is an all time personal
|
system specific winning entries were discouraged. This is an all time personal
|
||||||
favourite of Landon Curt Noll. Run the alternate code to understand why this
|
favourite of Landon Curt Noll. Run the alternate code to understand why this
|
||||||
might be (along with how strange the source code is :-) ).</p>
|
might be (along with how strange the source code is :-) ).</p>
|
||||||
<p>An example where a crash is not a bug: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2019/endoh/prog.c">2019/endoh</a> is
|
<p>An example where a crash is not a bug: <a href="2019/endoh/index.html">2019/endoh</a> is
|
||||||
supposed to crash. There are others that are also supposed to crash or that are
|
supposed to crash. There are others that are also supposed to crash or that are
|
||||||
known to segfault but are considered features.</p>
|
known to segfault but are considered features.</p>
|
||||||
<p>An important note is that if the index.html of the entry has a bug status that
|
<p>An important note is that if the index.html of the entry has a bug status that
|
||||||
@@ -695,7 +692,7 @@ figure it out you’re invited to look at the git diffs, where there are some
|
|||||||
(some were fixed earlier on but rolled back as both Cody and Landon individually
|
(some were fixed earlier on but rolled back as both Cody and Landon individually
|
||||||
felt that the fix was tampering with the entry).</p>
|
felt that the fix was tampering with the entry).</p>
|
||||||
<p><strong>NOTE</strong>: in the case of <code>gets()</code> we’ve fixed some to avoid the warning of the
|
<p><strong>NOTE</strong>: in the case of <code>gets()</code> we’ve fixed some to avoid the warning of the
|
||||||
compiler, linker or even during runtime, depending on the system. In <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/tbr/tbr.c">some cases
|
compiler, linker or even during runtime, depending on the system. In <a href="1990/tbr/index.html">some cases
|
||||||
like 1990/tbr</a> the fix actually prevents confusing output (though that
|
like 1990/tbr</a> the fix actually prevents confusing output (though that
|
||||||
was not the only fix made in that entry).</p>
|
was not the only fix made in that entry).</p>
|
||||||
<h3 id="exception-your-own-entries">Exception: your own entries</h3>
|
<h3 id="exception-your-own-entries">Exception: your own entries</h3>
|
||||||
@@ -733,16 +730,17 @@ code. In particular you should see something like:</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-3">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-3">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-1984mullendermullender.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.c">1984/mullender/mullender.c</a></h3>
|
<h3 id="source-code-1984mullendermullender.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/mullender.c">1984/mullender/mullender.c</a></h3>
|
||||||
<h3 id="information-1984mullenderindex.html">Information: <a href="1984/mullender/index.html">1984/mullender/index.html</a></h3>
|
<h3 id="information-1984mullenderindex.html">Information: <a href="1984/mullender/index.html">1984/mullender/index.html</a></h3>
|
||||||
<p>Although there is an alt version and supplementary program added by Cody that
|
<p>Although there is an alt version and supplementary program added, that
|
||||||
will work in modern systems, if you do not have a
|
will work in modern systems, if you do not have a
|
||||||
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> or
|
<a href="https://en.wikipedia.org/wiki/VAX-11">VAX-11</a> or
|
||||||
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> to run the original entry on it
|
<a href="https://en.wikipedia.org/wiki/PDP-11">PDP-11</a> to run the original entry on it
|
||||||
will not work. See the index.html for details on the alternate versions.</p>
|
will not work. See the index.html for details on the alternate versions.</p>
|
||||||
<p>Cody added and fixed the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a> which is from the
|
<p>The file <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1984/mullender/gentab.c">gentab.c</a> which is from the
|
||||||
author’s (or one of them, Mullender) remarks found by Cody. Cody fixed this to
|
author’s (or one of them, Mullender) remarks, was fixed for modern systems, at
|
||||||
compile and work (as best as he can determine: he has no VAX-11 or PDP-11 or
|
least as best as can be determined: running the code on the binary itself does
|
||||||
emulator to test it) but running the code on the binary itself produces a
|
produce a <code>short[]</code> that can compile in modern systems but it will not work.
|
||||||
<code>short[]</code> that can compile in modern systems though it’ll not work.</p>
|
Before the fix it would fail in some cases and it is possible that in some cases
|
||||||
|
it might still fail.</p>
|
||||||
<hr style="width:10%;text-align:left;margin-left:0">
|
<hr style="width:10%;text-align:left;margin-left:0">
|
||||||
<div id="1985">
|
<div id="1985">
|
||||||
<h1 id="section-1">1985</h1>
|
<h1 id="section-1">1985</h1>
|
||||||
@@ -823,8 +821,10 @@ reverse of other code (also wrt names). See the source file and the index.html
|
|||||||
(in the author’s remarks) for more details.</p>
|
(in the author’s remarks) for more details.</p>
|
||||||
<p>Fixing the (mis)feature is likely to be a very difficult challenge especially
|
<p>Fixing the (mis)feature is likely to be a very difficult challenge especially
|
||||||
without breaking something else which is far more likely (see below in tips from
|
without breaking something else which is far more likely (see below in tips from
|
||||||
Cody). You are welcome to try and fix it if you can!</p>
|
Cody, who fixed it so the original would compile with <code>clang</code> and at least one
|
||||||
<h3 id="tips-from-cody">Tips from Cody:</h3>
|
generated version would compile with <code>clang</code> too, not compromising the other
|
||||||
|
versions with <code>gcc</code>). You are welcome to try and fix it if you can!</p>
|
||||||
|
<h3 id="tips">Tips:</h3>
|
||||||
<p>The reason this is crashing is that the array <code>irk</code> is being accessed way out of
|
<p>The reason this is crashing is that the array <code>irk</code> is being accessed way out of
|
||||||
bounds by the int <code>gnat</code>. For instance:</p>
|
bounds by the int <code>gnat</code>. For instance:</p>
|
||||||
<pre><code> Program terminated with signal SIGSEGV, Segmentation fault.
|
<pre><code> Program terminated with signal SIGSEGV, Segmentation fault.
|
||||||
@@ -836,12 +836,11 @@ bounds by the int <code>gnat</code>. For instance:</p>
|
|||||||
<h3 id="magic-of-the-entry">Magic of the entry:</h3>
|
<h3 id="magic-of-the-entry">Magic of the entry:</h3>
|
||||||
<p>The real trouble is that the code is generated and in a complex way or rather
|
<p>The real trouble is that the code is generated and in a complex way or rather
|
||||||
ways.</p>
|
ways.</p>
|
||||||
<p>I will explain this a little bit (though it might be more than a bit according
|
<p>Trying to explain this might be tricky but here is an attempt. The program, when
|
||||||
to many :-) ) but that is all I can do for now. The program, when used without
|
used without any args, will print out what it reads. If one arg is specified it
|
||||||
any args, will print out what it reads. If one arg is specified it will do a
|
will do a ROT13 of it. If two args are specified it will print out the text
|
||||||
ROT13 of it. If two args are specified it will print out the text backwards
|
backwards (<em>WITHOUT ROT13!</em>). If three args are specified it will do both
|
||||||
(<em>WITHOUT ROT13!</em>). If three args are specified it will do both <strong><em>reversal AND
|
<strong><em>reversal AND ROT13</em></strong>.</p>
|
||||||
ROT13</em></strong>.</p>
|
|
||||||
<p>So <code>ver0</code> is the same as the main program; <code>ver1</code> is the ROT13 of the code (but
|
<p>So <code>ver0</code> is the same as the main program; <code>ver1</code> is the ROT13 of the code (but
|
||||||
see below); <code>ver2</code> will reverse the code and <code>ver3</code> will both reverse and ROT13
|
see below); <code>ver2</code> will reverse the code and <code>ver3</code> will both reverse and ROT13
|
||||||
the code. But it’s trickier than that as one might expect.</p>
|
the code. But it’s trickier than that as one might expect.</p>
|
||||||
@@ -879,19 +878,17 @@ just the reversal version, of course but ver1 is the ROT13 version.</p>
|
|||||||
and then another version that has the reversal <em>and</em> ROT13 then you can see it’s
|
and then another version that has the reversal <em>and</em> ROT13 then you can see it’s
|
||||||
nigh impossible to fix if not impossible.</p>
|
nigh impossible to fix if not impossible.</p>
|
||||||
<p>The fix to get it to even compile with clang and then get the first two
|
<p>The fix to get it to even compile with clang and then get the first two
|
||||||
(counting the original, <code>ver0</code>) to work was the hardest fix I made due to how
|
(counting the original, <code>ver0</code>) to work was quite hard due to how the comments
|
||||||
the comments in reverse and ROT13 of it all works together, especially allowing
|
in reverse and ROT13 of it all works together, especially allowing all versions
|
||||||
all versions to compile with gcc. The only reason that it doesn’t work
|
to compile with gcc. The only reason that it doesn’t work completely with clang
|
||||||
completely with clang is the arg types of main() (see if you can figure out how
|
is the arg types of main() (see if you can figure out how the change of <code>main()</code>
|
||||||
the change of <code>main()</code> in <code>westley.c</code> is not carried over to versions 2 and 3!);
|
in <code>westley.c</code> is not carried over to versions 2 and 3!); originally none of
|
||||||
originally none of them compiled with clang.</p>
|
them compiled with clang.</p>
|
||||||
<p>But it was possible to get the ROT13 code to compile with clang but the other
|
<p>But it was possible to get the ROT13 code to compile with clang but the other
|
||||||
versions, reversed as well as ROT13 and reversed code, proved much more
|
versions, reversed as well as ROT13 and reversed code, proved much more
|
||||||
problematic. I got it to compile (or maybe mostly compile) all versions with
|
problematic. It is now possible to compile (or maybe mostly compile) all versions with
|
||||||
clang but I then carried it over to gcc in another system and it had syntax
|
clang but on another system and it had syntax errors.</p>
|
||||||
errors.</p>
|
<p>Enjoy! :-)</p>
|
||||||
<p>That’s about all I can say for how it works as other things have to be done too.
|
|
||||||
Enjoy! :-)</p>
|
|
||||||
<hr style="width:10%;text-align:left;margin-left:0">
|
<hr style="width:10%;text-align:left;margin-left:0">
|
||||||
<div id="1990">
|
<div id="1990">
|
||||||
<h1 id="section-6">1990</h1>
|
<h1 id="section-6">1990</h1>
|
||||||
@@ -968,11 +965,10 @@ more time and resources to run as well. For instance:</p>
|
|||||||
<h3 id="status-known-bug---please-help-us-fix-1">STATUS: known bug - please help us fix</h3>
|
<h3 id="status-known-bug---please-help-us-fix-1">STATUS: known bug - please help us fix</h3>
|
||||||
<h3 id="source-code-1990jawjaw.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/jaw/jaw.c">1990/jaw/jaw.c</a></h3>
|
<h3 id="source-code-1990jawjaw.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/jaw/jaw.c">1990/jaw/jaw.c</a></h3>
|
||||||
<h3 id="information-1990jawindex.html">Information: <a href="1990/jaw/index.html">1990/jaw/index.html</a></h3>
|
<h3 id="information-1990jawindex.html">Information: <a href="1990/jaw/index.html">1990/jaw/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a>
|
<p>Some issues in this program were fixed and <a href="authors.html#Yusuke_Endoh">Yusuke
|
||||||
fixed some issues in this program and <a href="authors.html#Yusuke_Endoh">Yusuke
|
Endoh</a> then provided the <code>btoa</code> script but it appears
|
||||||
Endoh</a> provided the <code>btoa</code>
|
there is a bug in this entry. The judges wrote that to test the entry one can
|
||||||
script but it appears there is a bug in this entry. The judges wrote that to
|
do:</p>
|
||||||
test the entry one can do:</p>
|
|
||||||
<pre><code> echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw</code></pre>
|
<pre><code> echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw</code></pre>
|
||||||
<p>which should apply the identity transformation to a minimal holoalphabetic
|
<p>which should apply the identity transformation to a minimal holoalphabetic
|
||||||
sentence.</p>
|
sentence.</p>
|
||||||
@@ -1011,18 +1007,18 @@ defeat the purpose. This would ideally be fixed.</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-10">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-10">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-1990theoremtheorem.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/theorem/theorem.c">1990/theorem/theorem.c</a></h3>
|
<h3 id="source-code-1990theoremtheorem.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/theorem/theorem.c">1990/theorem/theorem.c</a></h3>
|
||||||
<h3 id="information-1990theoremindex.html">Information: <a href="1990/theorem/index.html">1990/theorem/index.html</a></h3>
|
<h3 id="information-1990theoremindex.html">Information: <a href="1990/theorem/index.html">1990/theorem/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed many bugs that
|
<p>Many bugs that prevented this from working properly (including segfaults) were
|
||||||
prevented this from working properly (including segfaults) but one thing to note
|
fixed but one thing to note is that if you pass two zeroes to <code>theorem_bkp</code> or
|
||||||
is that if you pass two zeroes to <code>theorem_bkp</code> or <code>fibonacci</code> the program
|
<code>fibonacci</code> the program will enter an infinite loop, printing 0 over and over
|
||||||
will enter an infinite loop, printing 0 over and over again; another condition
|
again; another condition where this occurred was fixed but this one should not
|
||||||
where this occurred was fixed but this one should not be fixed. Thank you.</p>
|
be fixed.</p>
|
||||||
<div id="1990_westley">
|
<div id="1990_westley">
|
||||||
<h2 id="westley-1">1990/westley</h2>
|
<h2 id="westley-1">1990/westley</h2>
|
||||||
</div>
|
</div>
|
||||||
<h3 id="status-inabiaf---please-do-not-fix-11">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-11">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-1990westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/westley/westley.c">1990/westley/westley.c</a></h3>
|
<h3 id="source-code-1990westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1990/westley/westley.c">1990/westley/westley.c</a></h3>
|
||||||
<h3 id="information-1990westleyindex.html">Information: <a href="1990/westley/index.html">1990/westley/index.html</a></h3>
|
<h3 id="information-1990westleyindex.html">Information: <a href="1990/westley/index.html">1990/westley/index.html</a></h3>
|
||||||
<p>Although Cody fixed this to not enter an infinite loop if the arg (converted to
|
<p>Although this was fixed to not enter an infinite loop if the arg (converted to
|
||||||
a number) is < 0 the lack of an arg check at all was kept in to make it like the
|
a number) is < 0 the lack of an arg check at all was kept in to make it like the
|
||||||
original. The reason for the < 0 check is it floods the screen (yes this is
|
original. The reason for the < 0 check is it floods the screen (yes this is
|
||||||
indeed inconsistent with some other entries but it is not worth the time spent,
|
indeed inconsistent with some other entries but it is not worth the time spent,
|
||||||
@@ -1067,9 +1063,8 @@ when you’re cheating it ends up winning! Can you figure that out as well?</p>
|
|||||||
<h3 id="source-code-1992adrianadrian.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.c">1992/adrian/adrian.c</a></h3>
|
<h3 id="source-code-1992adrianadrian.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/adrian/adrian.c">1992/adrian/adrian.c</a></h3>
|
||||||
<h3 id="information-1992adrianindex.html">Information: <a href="1992/adrian/index.html">1992/adrian/index.html</a></h3>
|
<h3 id="information-1992adrianindex.html">Information: <a href="1992/adrian/index.html">1992/adrian/index.html</a></h3>
|
||||||
<p>The author stated that if the file cannot be opened then it will print a system
|
<p>The author stated that if the file cannot be opened then it will print a system
|
||||||
error but this is not the case unless it’s showing a fault. However this was
|
error but this is not the case unless it’s showing a fault. This was fixed as
|
||||||
instead fixed by Cody as part of another problem that was detected so that the
|
part of another problem that was detected.</p>
|
||||||
program just exits 1 if the file cannot be opened.</p>
|
|
||||||
<p>Also, if <em>some</em> of the programs are not given an arg they will very likely crash
|
<p>Also, if <em>some</em> of the programs are not given an arg they will very likely crash
|
||||||
or do something funny. For instance <code>adsleep</code> and <code>adbasename</code>. This is very
|
or do something funny. For instance <code>adsleep</code> and <code>adbasename</code>. This is very
|
||||||
simple to fix but the author explicitly noted that this will segfault and it is
|
simple to fix but the author explicitly noted that this will segfault and it is
|
||||||
@@ -1103,7 +1098,7 @@ in <code>albert.orig.c</code> that has been fixed in <code>albert.c</code>,</p>
|
|||||||
Both albert and albert.orig loop without printing anything, although
|
Both albert and albert.orig loop without printing anything, although
|
||||||
the first factor is 101 and is usually found in an instant.</p>
|
the first factor is 101 and is usually found in an instant.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>A quick debugging session from Cody suggests that the problem with this value
|
<p>A quick debugging session suggests that the problem with this value
|
||||||
is that:</p>
|
is that:</p>
|
||||||
<pre><code> if ( ppp->qq!=48 ) return;</code></pre>
|
<pre><code> if ( ppp->qq!=48 ) return;</code></pre>
|
||||||
<p>is never reached because the value is never 48 (it is in other cases but not for
|
<p>is never reached because the value is never 48 (it is in other cases but not for
|
||||||
@@ -1170,13 +1165,13 @@ click the mouse it takes it back towards the centre.</p>
|
|||||||
<h3 id="status-doesnt-work-with-some-compilers---please-provide-alternative-code-or-fix-for-more-compilers">STATUS: doesn’t work with some compilers - please provide alternative code or fix for more compilers</h3>
|
<h3 id="status-doesnt-work-with-some-compilers---please-provide-alternative-code-or-fix-for-more-compilers">STATUS: doesn’t work with some compilers - please provide alternative code or fix for more compilers</h3>
|
||||||
<h3 id="source-code-1992lushlush.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/lush/lush.c">1992/lush/lush.c</a></h3>
|
<h3 id="source-code-1992lushlush.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/lush/lush.c">1992/lush/lush.c</a></h3>
|
||||||
<h3 id="information-1992lushindex.html">Information: <a href="1992/lush/index.html">1992/lush/index.html</a></h3>
|
<h3 id="information-1992lushindex.html">Information: <a href="1992/lush/index.html">1992/lush/index.html</a></h3>
|
||||||
<p>We used a patch from <a href="authors.html#Yusuke_Endoh">Yusuke Endoh</a> to get this to
|
<p>This was fixed but it only properly works with gcc; it was also changed to use
|
||||||
work but it only works with gcc. Cody removed the warnings of <code>gets()</code> and
|
<code>fgets()</code> instead of <code>gets()</code> and a script was provided to run the entry
|
||||||
provided a script to run the entry properly.</p>
|
properly. Nonetheless it will only work with gcc.</p>
|
||||||
<p>Unfortunately due to the way the entry works and the fact that other compilers
|
<p>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
|
like clang have different warnings and errors this simply does not work with
|
||||||
them.</p>
|
them.</p>
|
||||||
<p>Some tips from Cody:</p>
|
<p>Some tips:</p>
|
||||||
<p>This entry relies on specific compiler warnings. With gcc it will look something
|
<p>This entry relies on specific compiler warnings. With gcc it will look something
|
||||||
like:</p>
|
like:</p>
|
||||||
<pre><code> [...]
|
<pre><code> [...]
|
||||||
@@ -1244,7 +1239,7 @@ it yourself through ctrl-c or killing it in some other fashion.</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-17">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-17">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-1992westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/westley/westley.c">1992/westley/westley.c</a></h3>
|
<h3 id="source-code-1992westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1992/westley/westley.c">1992/westley/westley.c</a></h3>
|
||||||
<h3 id="information-1992westleyindex.html">Information: <a href="1992/westley/index.html">1992/westley/index.html</a></h3>
|
<h3 id="information-1992westleyindex.html">Information: <a href="1992/westley/index.html">1992/westley/index.html</a></h3>
|
||||||
<p>Cody improved the usability of this program by making it so that as long as the
|
<p>The usability of this program was improved by making it so that as long as the
|
||||||
terminal columns is >= 80 it will display properly, rather than having to wrap
|
terminal columns is >= 80 it will display properly, rather than having to wrap
|
||||||
at 80 columns. However due to the nature of the program if the terminal is < 80
|
at 80 columns. However due to the nature of the program if the terminal is < 80
|
||||||
in column width it will not display right. To see the number of columns in your
|
in column width it will not display right. To see the number of columns in your
|
||||||
@@ -1359,12 +1354,12 @@ there.</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-24">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-24">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-1994ldbldb.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/ldb/ldb.c">1994/ldb/ldb.c</a></h3>
|
<h3 id="source-code-1994ldbldb.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/ldb/ldb.c">1994/ldb/ldb.c</a></h3>
|
||||||
<h3 id="information-1994ldbindex.html">Information: <a href="1994/ldb/index.html">1994/ldb/index.html</a></h3>
|
<h3 id="information-1994ldbindex.html">Information: <a href="1994/ldb/index.html">1994/ldb/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed this to compile
|
<p>This was fixed to compile with modern systems but the entry also used <code>gets(3)</code>
|
||||||
with modern systems but the entry also used <code>gets(3)</code> which in some systems would
|
which in some systems would print out a warning along with the output of the
|
||||||
print out a warning along with the output of the program. Naturally it could
|
program. Naturally it could also overflow long lines, of which there are many,
|
||||||
also overflow long lines, of which there are many, though that is more
|
though that is more considered a feature, not a bug, as it was documented by the
|
||||||
considered a feature, not a bug, as it was documented by the author.</p>
|
author.</p>
|
||||||
<p>Cody changed it to <code>fgets(3)</code> to prevent the display problem but this introduces
|
<p>It was changed to use <code>fgets(3)</code> to prevent the display problem but this introduces
|
||||||
another problem namely that newlines can be printed if the line length < 231.</p>
|
another problem namely that newlines can be printed if the line length < 231.</p>
|
||||||
<p>This seems like a worthy compromise to not have messed up output and although it
|
<p>This seems like a worthy compromise to not have messed up output and although it
|
||||||
would be ideal for it to never print a newline (unless that’s the line itself)
|
would be ideal for it to never print a newline (unless that’s the line itself)
|
||||||
@@ -1383,30 +1378,28 @@ for more information on the change to <code>fgets(3)</code>.</p>
|
|||||||
even when it works. See the author’s remarks in the index.html for details.
|
even when it works. See the author’s remarks in the index.html for details.
|
||||||
Increasing the buffer size and having it, when fed its own source code,
|
Increasing the buffer size and having it, when fed its own source code,
|
||||||
generate code that will compile with the same buffer size is difficult: it just
|
generate code that will compile with the same buffer size is difficult: it just
|
||||||
uses the original size. Cody explains this further down.</p>
|
uses the original size. This is explained later down.</p>
|
||||||
<p>Getting it to use <code>fgets()</code> is even harder as when fed its own code it will
|
<p>Getting it to use <code>fgets()</code> is even harder as when fed its own code it will
|
||||||
generate code that cannot even compile let alone use <code>fgets(3)</code>.</p>
|
generate code that cannot even compile let alone use <code>fgets(3)</code>.</p>
|
||||||
<p>In both cases, changing the buffer size and changing it to use <code>fgets(3)</code>, will
|
<p>In both cases, changing the buffer size and changing it to use <code>fgets(3)</code>, will
|
||||||
cause compilation errors without other adjustments.</p>
|
cause compilation errors without other adjustments.</p>
|
||||||
<p>See the below magic for details. Along with the author’s remarks in the
|
<p>See the below magic for details. Along with the author’s remarks in the
|
||||||
index.html file it might prove possible to get it to use <code>fgets(3)</code>. Cody,
|
index.html file it might prove possible to get it to use <code>fgets(3)</code>.</p>
|
||||||
writing this on 02 November 2023, only just noticed the author’s remarks and
|
<p>Here is the magic of how this entry works, to help anyone who wishes to work on
|
||||||
will later on look at this if nobody takes up the challenge. More important work
|
this.</p>
|
||||||
like getting to a place that the next contest can run must be done first.</p>
|
<p>You might wish to run the commands:</p>
|
||||||
<p>Cody explains the magic of how this entry works, which will be necessary if this
|
<pre><code> diff schnitzi.alt.c schnitzi.alt2.c
|
||||||
entry is to be fixed, below.</p>
|
|
||||||
<p>You might wish to run the command:</p>
|
diff schnitzi.alt2.c schnitzi.alt.c</code></pre>
|
||||||
<pre><code> make diff_orig_prog</code></pre>
|
<p>to see how the buffer size and how the <code>gets(3)</code> was changed to use <code>fgets()</code>,
|
||||||
<p>to see what had to change for the buffer size, when looking at the below.
|
in the two alternate versions. Notice that the <code>fgets(3)</code> version can compile it
|
||||||
Furthermore you will want to look at:</p>
|
just can’t <strong>generate</strong> compilable code (let alone using <code>fgets(3)</code>) when fed
|
||||||
<pre><code> diff schnitzi.alt.c schnitzi.alt2.c</code></pre>
|
itself (to reiterate, just changing the call to <code>fgets(3)</code> does not mean it can
|
||||||
<p>as the <code>fgets(3)</code> version can compile it just can’t generate compilable code (let
|
compile and there’s a further problem in that <code>fgets(3)</code> retains the newline
|
||||||
alone using <code>fgets(3)</code>) when fed itself (to reiterate, just changing the call to
|
whereas <code>gets(3)</code> does not). Nevertheless looking at these commands will be of
|
||||||
<code>fgets(3)</code> does not mean it can compile and there’s a further problem in that
|
help to understand how it works, in case one wishes to try and fix it.</p>
|
||||||
<code>fgets(3)</code> retains the newline whereas <code>gets(3)</code> does not). Nevertheless looking
|
|
||||||
at these commands will be of help to understand how it works.</p>
|
|
||||||
<p>For the alternate versions the other functionality is unaffected.</p>
|
<p>For the alternate versions the other functionality is unaffected.</p>
|
||||||
<h3 id="the-magic-of-1994schnitzi-and-how-it-flips-text">The magic of <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1994/schnitzi/schnitzi.c">1994/schnitzi</a> and how it flips text</h3>
|
<h3 id="the-magic-of-1994schnitzi-and-how-it-flips-text">The magic of <a href="1994/schnitzi/index.html">1994/schnitzi</a> and how it flips text</h3>
|
||||||
<p>The problem is getting the generated code to use <code>fgets()</code> (once it even
|
<p>The problem is getting the generated code to use <code>fgets()</code> (once it even
|
||||||
compiles which was easy to do) and also have the updated buffer size be the
|
compiles which was easy to do) and also have the updated buffer size be the
|
||||||
same (which was easy to do too at least in the original version). The generated
|
same (which was easy to do too at least in the original version). The generated
|
||||||
@@ -1450,9 +1443,9 @@ changing the buffer size, see below).</p>
|
|||||||
<p>Getting this entry to use <code>fgets(3)</code> is easy but the problem is you’re supposed
|
<p>Getting this entry to use <code>fgets(3)</code> is easy but the problem is you’re supposed
|
||||||
to be able to feed the source to the program and the output of that will be
|
to be able to feed the source to the program and the output of that will be
|
||||||
compilable. It however will create compiler errors. So it’s not just changing
|
compilable. It however will create compiler errors. So it’s not just changing
|
||||||
the code to get it to use <code>fgets(3)</code>! I (Cody) already did this before I noticed
|
the code to get it to use <code>fgets(3)</code>! This was done but
|
||||||
the other part which is why I rolled that part back. I did increase the buffer
|
the other part is why that part was rolled back. The buffer size was increased
|
||||||
size but that only works on the original source.</p>
|
but that only works on the original source.</p>
|
||||||
<p>To say just how sensitive this entry is: even a space, lack of space or a
|
<p>To say just how sensitive this entry is: even a space, lack of space or a
|
||||||
character, wrong character, lack of character or character in the wrong place
|
character, wrong character, lack of character or character in the wrong place
|
||||||
can cause a compilation error! Make sure that the output of:</p>
|
can cause a compilation error! Make sure that the output of:</p>
|
||||||
@@ -1468,7 +1461,7 @@ compiled!</p>
|
|||||||
<p>This program will likely crash if the source code file (by the name of the file
|
<p>This program will likely crash if the source code file (by the name of the file
|
||||||
that’s compiled) cannot be opened in the directory it is run from.</p>
|
that’s compiled) cannot be opened in the directory it is run from.</p>
|
||||||
<h3 id="important-reminder-and-a-note-about-the--1-value-check-for-getc">Important reminder and a note about the <code>-1</code> value check for <code>getc()</code>:</h3>
|
<h3 id="important-reminder-and-a-note-about-the--1-value-check-for-getc">Important reminder and a note about the <code>-1</code> value check for <code>getc()</code>:</h3>
|
||||||
<p>Cody fixed the code to not use <code>-1</code> for the return value of <code>getc()</code>; this is
|
<p>This code was fixed to not use <code>-1</code> for the return value of <code>getc()</code>; this is
|
||||||
important because <code>EOF</code> is <strong>NOT</strong> guaranteed to be <code>-1</code> but rather any negative
|
important because <code>EOF</code> is <strong>NOT</strong> guaranteed to be <code>-1</code> but rather any negative
|
||||||
value. On systems where <code>EOF != -1</code> the program would enter an infinite loop
|
value. On systems where <code>EOF != -1</code> the program would enter an infinite loop
|
||||||
until the program crashed, by chance reads a <code>-1</code> or was killed (it is for this
|
until the program crashed, by chance reads a <code>-1</code> or was killed (it is for this
|
||||||
@@ -1515,8 +1508,7 @@ as documented, are considered features.</p>
|
|||||||
<h3 id="source-code-1995cduacdua.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1995/cdua/cdua.c">1995/cdua/cdua.c</a></h3>
|
<h3 id="source-code-1995cduacdua.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/1995/cdua/cdua.c">1995/cdua/cdua.c</a></h3>
|
||||||
<h3 id="information-1995cduaindex.html">Information: <a href="1995/cdua/index.html">1995/cdua/index.html</a></h3>
|
<h3 id="information-1995cduaindex.html">Information: <a href="1995/cdua/index.html">1995/cdua/index.html</a></h3>
|
||||||
<p>This did not originally compile under macOS and after it did compile under
|
<p>This did not originally compile under macOS and after it did compile under
|
||||||
macOS, it crashed. <a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a>
|
macOS, it crashed. These problems were fixed.</p>
|
||||||
fixed these problems.</p>
|
|
||||||
<p>It should be noted however that there is a condition where the program will
|
<p>It should be noted however that there is a condition where the program will
|
||||||
prompt you to press return again. This was thought to be a bug but looking at
|
prompt you to press return again. This was thought to be a bug but looking at
|
||||||
the code it can clearly be seen that if <code>g - a</code> is 0 then the message is
|
the code it can clearly be seen that if <code>g - a</code> is 0 then the message is
|
||||||
@@ -1754,7 +1746,7 @@ with things but we don’t know.</p>
|
|||||||
<pre><code> $ echo poot | ./dlowe
|
<pre><code> $ echo poot | ./dlowe
|
||||||
poot was here!</code></pre>
|
poot was here!</code></pre>
|
||||||
<p>Can you help fix these problems?</p>
|
<p>Can you help fix these problems?</p>
|
||||||
<p>Cody provided the C code that creates an unformatted perl script that will just
|
<p>Here is some C code that creates an unformatted perl script that will just
|
||||||
print ‘unimplemented’ for operators but it seems to work in some other ways (see
|
print ‘unimplemented’ for operators but it seems to work in some other ways (see
|
||||||
below for how to go further than unimplemented) which is the exact perl from the
|
below for how to go further than unimplemented) which is the exact perl from the
|
||||||
C program except that it has the <code>#!/usr/bin/env perl</code> and <code>use warnings;</code> as
|
C program except that it has the <code>#!/usr/bin/env perl</code> and <code>use warnings;</code> as
|
||||||
@@ -1834,18 +1826,17 @@ For instance inputting <code>D</code> followed by <code>XX</code>:</p>
|
|||||||
<p>That means then that in linux despite the subroutines seemingly not existing it
|
<p>That means then that in linux despite the subroutines seemingly not existing it
|
||||||
works in the code, at least in some cases.</p>
|
works in the code, at least in some cases.</p>
|
||||||
<p>As far as the unimplemented error goes: the author stated that it means there is
|
<p>As far as the unimplemented error goes: the author stated that it means there is
|
||||||
invalid input. But as can be seen by the input I (Cody) gave the input is not
|
invalid input. But as can be seen by the input given, the input is not
|
||||||
actually incorrect. It is also curious to note that it ends up printing what’s
|
actually incorrect. It is also curious to note that it ends up printing what’s
|
||||||
on the stack at that point:</p>
|
on the stack at that point:</p>
|
||||||
<pre><code> $ echo 5 5 + p | ./dlowe.pl
|
<pre><code> $ echo 5 5 + p | ./dlowe.pl
|
||||||
unimplemented
|
unimplemented
|
||||||
5</code></pre>
|
5</code></pre>
|
||||||
<p>which might (?) suggest that the <code>+</code> operator is unimplemented. Unfortunately it
|
<p>which might (?) suggest that the <code>+</code> operator is unimplemented.</p>
|
||||||
has been many years since I have used perl and I was never a guru either.</p>
|
|
||||||
<h3 id="status-inabiaf---please-do-not-fix-32">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-32">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<p>The author states that in perl < 5.6.0 there is a bug with a core dump in what
|
<p>The author states that in perl < 5.6.0 there is a bug with a core dump in what
|
||||||
they said is in <code>Perl_sv_upgrade</code>. As this is documented it is not considered a
|
they said is in <code>Perl_sv_upgrade</code>. 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
|
bug to be fixed. For the curious this will crash in macOS. It was noted that the
|
||||||
code that crashes is:</p>
|
code that crashes is:</p>
|
||||||
<pre><code> perl_eval_sv
|
<pre><code> perl_eval_sv
|
||||||
(newSVpv("_:$_= <> ; defined or exit; @ARGV"
|
(newSVpv("_:$_= <> ; defined or exit; @ARGV"
|
||||||
@@ -1919,16 +1910,17 @@ fire</a>! :-) ).</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-35">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-35">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-2001anonymousanonymous.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.c">2001/anonymous/anonymous.c</a></h3>
|
<h3 id="source-code-2001anonymousanonymous.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.c">2001/anonymous/anonymous.c</a></h3>
|
||||||
<h3 id="information-2001anonymousindex.html">Information: <a href="2001/anonymous/index.html">2001/anonymous/index.html</a></h3>
|
<h3 id="information-2001anonymousindex.html">Information: <a href="2001/anonymous/index.html">2001/anonymous/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed this so that it
|
<p>This was fixed so that it doesn’t segfault and then also fixed the functionality
|
||||||
doesn’t segfault and then also fixed the functionality of it (but see below).</p>
|
of it (but see below).</p>
|
||||||
<p>Cody also fixed the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.ten.c">anonymous.ten.c</a> program
|
<p>The <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.ten.c">anonymous.ten.c</a> program was
|
||||||
(it also segfaulted) but notes that it <strong>MUST</strong> be compiled as a <strong>32-bit ELF
|
also fixed (it also segfaulted) but note that it <strong>MUST</strong> be compiled as a <strong>32-bit ELF
|
||||||
binary</strong> so it will NOT work in macOS (for example); if you cannot use <code>-m32</code> or
|
binary</strong> so it will NOT work in macOS (for example); if you cannot use <code>-m32</code> or
|
||||||
even if you can but it cannot compile as an ELF binary (not elf binary :-) )
|
even if you can but it cannot compile as an ELF binary (not elf binary :-) )
|
||||||
(but see below) then the <code>anonymous</code> program itself will very likely crash if
|
(but see below) then the <code>anonymous</code> program itself will very likely crash if
|
||||||
you run it on the compiled <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.ten.c">anonymous.ten.c</a> but
|
you run it on the compiled
|
||||||
if nothing else it will not modify the target executable (this part of the fix
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/anonymous/anonymous.ten.c">anonymous.ten.c</a>; if nothing else
|
||||||
at least should be correct).</p>
|
it will not modify the target executable (this part of the fix at least should
|
||||||
|
be correct).</p>
|
||||||
<p>Note also that if you don’t specify a file or you specify a non-32-bit ELF file
|
<p>Note also that if you don’t specify a file or you specify a non-32-bit ELF file
|
||||||
this program will very likely crash or do something strange like slaughter the
|
this program will very likely crash or do something strange like slaughter the
|
||||||
elves of Imladris :-(</p>
|
elves of Imladris :-(</p>
|
||||||
@@ -1940,36 +1932,35 @@ elves of Imladris :-(</p>
|
|||||||
<h3 id="information-2001bellardindex.html">Information: <a href="2001/bellard/index.html">2001/bellard/index.html</a></h3>
|
<h3 id="information-2001bellardindex.html">Information: <a href="2001/bellard/index.html">2001/bellard/index.html</a></h3>
|
||||||
<p>The author stated that it only works with i386 linux so the fact it doesn’t work
|
<p>The author stated that it only works with i386 linux so the fact it doesn’t work
|
||||||
in modern systems is considered a feature and not a bug.</p>
|
in modern systems is considered a feature and not a bug.</p>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed an initial
|
<p>An initial segfault was fixed (trying to open the file) and the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/bellard.otccex.c">supplementary
|
||||||
segfault (trying to open the file) and he also fixed the <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/bellard.otccex.c">supplementary program
|
program bellard.otccex.c</a> was also
|
||||||
bellard.otccex.c</a> but this still crashes in
|
fixed but this still crashes in systems not i386 linux which is what the author
|
||||||
systems not i386 linux which is what the author stated.</p>
|
stated.</p>
|
||||||
<p>The author said that they compiled it with <a href="https://ftp.gnu.org/gnu/gcc/gcc-2.95.2/gcc-everything-2.95.2.tar.gz">gcc version
|
<p>The author said that they compiled it with <a href="https://ftp.gnu.org/gnu/gcc/gcc-2.95.2/gcc-everything-2.95.2.tar.gz">gcc version
|
||||||
2.95.2</a>. We
|
2.95.2</a>. We
|
||||||
don’t know if a certain gcc version is necessary but it might be helpful to
|
don’t know if a certain gcc version is necessary but it might be helpful to
|
||||||
download and compile that version to test it - or it might not.</p>
|
download and compile that version to test it - or it might not.</p>
|
||||||
<p>I (Cody) have no i386 system to test this but perhaps this is why I can’t get it
|
<p>Yusuke was able to get this to work with <code>-m32</code> but only in an emulator. As
|
||||||
to work. Yusuke was able to get this to work with <code>-m32</code> but only in an
|
such, it might be that the changes made should be rolled back but at least now
|
||||||
emulator.</p>
|
the supplementary program will work in modern systems.</p>
|
||||||
<p>On the author’s <a href="https://bellard.org/otcc/">web page for this program</a> it is
|
<p>On the author’s <a href="https://bellard.org/otcc/">web page for this program</a> it is
|
||||||
explicitly stated that it requires i386 linux.</p>
|
explicitly stated that it requires i386 linux.</p>
|
||||||
<p>There I found what should be a more portable version which is included as
|
<p>There it was found what should be a more portable version which is included as
|
||||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/otccelf.c">otccelf.c</a> (after adding some <code>#include</code>s and the
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/bellard/otccelf.c">otccelf.c</a> (after adding some <code>#include</code>s
|
||||||
modification by Yusuke noted in the <a href="thanks-for-help.html">thanks</a>
|
and the modification but it appears this <em>also</em> requires i386 linux; indeed
|
||||||
file) but it appears this <em>also</em> requires i386 linux; indeed looking at the code
|
looking at the code it hard codes paths that are i386 specific to linux.</p>
|
||||||
it hard codes paths that are i386 specific to linux.</p>
|
|
||||||
<p>Another point of interest is that the author provided unobfuscated versions
|
<p>Another point of interest is that the author provided unobfuscated versions
|
||||||
which might be of value to look at.</p>
|
which might be of value to look at.</p>
|
||||||
<h4 id="aside-why-were-there-changes-made-if-inabiaf">Aside: why were there changes made if INABIAF ?</h4>
|
<h4 id="aside-why-were-there-changes-made-if-inabiaf">Aside: why were there changes made if INABIAF ?</h4>
|
||||||
<p>This is a good question. The reason is we believe it better to fix some obvious
|
<p>This is a good question. The reason is we believe it better to fix some obvious
|
||||||
problems: there were some bugs that would very possibly prevent it from working
|
problems: there were some bugs that would very possibly prevent it from working
|
||||||
even if it was in i386 linux though Yusuke seemed to get it to work in an
|
even if it was in i386 linux though it did seem to work in an emulator, so
|
||||||
emulator so perhaps not. Still it’s better to have the type of the file pointer
|
perhaps not. Still it’s better to have the type of the file pointer correct and
|
||||||
correct and so that the file can at least be opened in modern systems even if
|
so that the file can at least be opened in modern systems even if the compiler
|
||||||
the compiler won’t work there.</p>
|
won’t work there.</p>
|
||||||
<p>Also the supplementary program, which did not work at all, was fixed (by Cody)
|
<p>Also the supplementary program, which did not work at all, was fixed and it can
|
||||||
and it can be run by itself for fun in modern systems, which was not possible
|
be run by itself for fun in modern systems, which was not possible before the
|
||||||
before the fixes there.</p>
|
fixes there.</p>
|
||||||
<div id="2001_cheong">
|
<div id="2001_cheong">
|
||||||
<h2 id="cheong">2001/cheong</h2>
|
<h2 id="cheong">2001/cheong</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -2051,9 +2042,7 @@ details and a workaround.</p>
|
|||||||
<h3 id="source-code-2001westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.c">2001/westley/westley.c</a></h3>
|
<h3 id="source-code-2001westleywestley.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2001/westley/westley.c">2001/westley/westley.c</a></h3>
|
||||||
<h3 id="information-2001westleyindex.html">Information: <a href="2001/westley/index.html">2001/westley/index.html</a></h3>
|
<h3 id="information-2001westleyindex.html">Information: <a href="2001/westley/index.html">2001/westley/index.html</a></h3>
|
||||||
<p>This function uses <code>gets(3)</code> but it would be ideal if it used <code>fgets(3)</code>. This
|
<p>This function uses <code>gets(3)</code> but it would be ideal if it used <code>fgets(3)</code>. This
|
||||||
one is rather complicated and will be looked at later (some progress was made by
|
one is rather complicated but you are welcome to try and fix this if you wish.</p>
|
||||||
Cody but it is less important than other work) but you are welcome to try
|
|
||||||
and fix this if you wish.</p>
|
|
||||||
<h3 id="status-main-has-only-one-arg---try-and-make-it-have-2-or-3">STATUS: main() has only one arg - try and make it have 2 or 3</h3>
|
<h3 id="status-main-has-only-one-arg---try-and-make-it-have-2-or-3">STATUS: main() has only one arg - try and make it have 2 or 3</h3>
|
||||||
<p>This program only has one arg to <code>main()</code>. However changing it to have 2 is not
|
<p>This program only has one arg to <code>main()</code>. However changing it to have 2 is not
|
||||||
as simple as it might seem. Doing this breaks things. If memory serves changing
|
as simple as it might seem. Doing this breaks things. If memory serves changing
|
||||||
@@ -2321,14 +2310,14 @@ for running itself.</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-50">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-50">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-2005mynxmynx.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.c">2005/mynx/mynx.c</a></h3>
|
<h3 id="source-code-2005mynxmynx.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2005/mynx/mynx.c">2005/mynx/mynx.c</a></h3>
|
||||||
<h3 id="information-2005mynxindex.html">Information: <a href="2005/mynx/index.html">2005/mynx/index.html</a></h3>
|
<h3 id="information-2005mynxindex.html">Information: <a href="2005/mynx/index.html">2005/mynx/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> notes that, though
|
<p>Probably this is obvious, but this entry will not work with https. An
|
||||||
probably obvious, this entry will not work with https. He added an alt version
|
alt version exists that <em>SCANS</em> for https in case someone wants to set up a pipeline or
|
||||||
that scans for https in case someone wants to set up a pipeline or other
|
other workaround (perhaps with <code>stunnel</code>) or even add additional code to it to
|
||||||
workaround (perhaps with stunnel) or even add additional code to it to make it
|
make it work with https but the problem otherwise is a secure connection has to
|
||||||
work with https but the problem otherwise is a secure connection has to first be
|
first be set up in order to give http commands. This is not a bug but it’s worth
|
||||||
set up in order to give http commands. This is not a bug but it’s worth pointing
|
pointing out as it won’t work on as many websites as it used to including the
|
||||||
out as it won’t work on as many websites as it used to including the <a href="https://www.ioccc.org">IOCCC
|
<a href="https://www.ioccc.org">IOCCC website</a> itself. The author noted that someone did
|
||||||
website</a> itself.</p>
|
make a version that supports <code>https</code> but it is not known where this might be.</p>
|
||||||
<div id="2005_sykes">
|
<div id="2005_sykes">
|
||||||
<h2 id="sykes">2005/sykes</h2>
|
<h2 id="sykes">2005/sykes</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -2434,13 +2423,12 @@ without outputting a solution. If you can wait that long.</p>
|
|||||||
<h3 id="status-inabiaf---please-do-not-fix-57">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
<h3 id="status-inabiaf---please-do-not-fix-57">STATUS: INABIAF - please <strong>DO NOT</strong> fix</h3>
|
||||||
<h3 id="source-code-2006toledo2toledo2.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2006/toledo2/toledo2.c">2006/toledo2/toledo2.c</a></h3>
|
<h3 id="source-code-2006toledo2toledo2.c">Source code: <a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2006/toledo2/toledo2.c">2006/toledo2/toledo2.c</a></h3>
|
||||||
<h3 id="information-2006toledo2index.html">Information: <a href="2006/toledo2/index.html">2006/toledo2/index.html</a></h3>
|
<h3 id="information-2006toledo2index.html">Information: <a href="2006/toledo2/index.html">2006/toledo2/index.html</a></h3>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> fixed this program to
|
<p>This was fixed to
|
||||||
not crash in macOS (it appeared to work fine in fedora linux on an <code>x86_64</code>
|
not crash in macOS (it appeared to work fine in fedora linux on an <code>x86_64</code>
|
||||||
architecture but he does not know if it crashed in macOS Ventura due to the fact
|
architecture but it is not known if it crashed in macOS Ventura due to the fact
|
||||||
it is an <code>arm64</code> CPU - the Apple silicon chip, but given that the author later
|
it is an <code>arm64</code> CPU - the Apple silicon chip, but given that the author later
|
||||||
made some slight changes to make it not crash in <code>x86_64</code> macOS that might be
|
made some slight changes to make it not crash in <code>x86_64</code> macOS that might be
|
||||||
the case). This fix, BTW, is a mix of a fix by <a href="authors.html#Yusuke_Endoh">Yusuke
|
the case).</p>
|
||||||
Endoh</a> and Cody’s.</p>
|
|
||||||
<p>Nevertheless there are two features that are not bugs.</p>
|
<p>Nevertheless there are two features that are not bugs.</p>
|
||||||
<p>By design this program is supposed to crash on termination. This actually no
|
<p>By design this program is supposed to crash on termination. This actually no
|
||||||
longer seems to happen but we don’t need this to be added even if it might
|
longer seems to happen but we don’t need this to be added even if it might
|
||||||
@@ -2544,11 +2532,10 @@ a bus error).</p>
|
|||||||
like it <em>might</em> (see Apple resources below) be but it could also be a wider
|
like it <em>might</em> (see Apple resources below) be but it could also be a wider
|
||||||
problem with macOS. It appears that Apple does not allow certain combinations of
|
problem with macOS. It appears that Apple does not allow certain combinations of
|
||||||
memory protections with the arm64 processor.</p>
|
memory protections with the arm64 processor.</p>
|
||||||
<p><a href="authors.html#Cody_Boone_Ferguson">Cody Boone Ferguson</a> tried some of the
|
<p>Some of the workarounds have been tried but at this time it did not seem to
|
||||||
workarounds but at this time he could not get it to work. He offers some earlier
|
work. Some earlier debugging sessions are below as well as a resource from the
|
||||||
debugging sessions below as well as a resource from the author as well as some
|
author as well as some resources on Apple’s website should anyone wish to take a
|
||||||
resources on Apple’s website should anyone wish to take a crack at it. He might
|
crack at it. A starting point might be in
|
||||||
address it later but a starting point might be in
|
|
||||||
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/richards.alt.c">richards.alt.c</a>.</p>
|
<a href="https://github.com/ioccc-src/temp-test-ioccc/blob/master/2011/richards/richards.alt.c">richards.alt.c</a>.</p>
|
||||||
<h3 id="debugging">Debugging</h3>
|
<h3 id="debugging">Debugging</h3>
|
||||||
<p>At first glance it appeared to be that it might be the function pointers or the
|
<p>At first glance it appeared to be that it might be the function pointers or the
|
||||||
@@ -2689,7 +2676,7 @@ Silicon</a></p>
|
|||||||
Entitlement</a></p>
|
Entitlement</a></p>
|
||||||
<p>Looking at
|
<p>Looking at
|
||||||
<a href="https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c" class="uri">https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c</a>
|
<a href="https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c" class="uri">https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c</a>
|
||||||
Cody noticed a curious thing in the <code>mprotect()</code> function: <code>#if CONFIG_DYNAMIC_CODE_SIGNING</code> and the protection variable has the
|
A curious thing is in the <code>mprotect()</code> function: <code>#if CONFIG_DYNAMIC_CODE_SIGNING</code> and the protection variable has the
|
||||||
<code>VM_PROT_TRUSTED</code> set it might allow overriding the problem but this is
|
<code>VM_PROT_TRUSTED</code> set it might allow overriding the problem but this is
|
||||||
unconfirmed and it’s not known when <code>CONFIG_DYNAMIC_CODE_SIGNING</code> would be
|
unconfirmed and it’s not known when <code>CONFIG_DYNAMIC_CODE_SIGNING</code> would be
|
||||||
defined.</p>
|
defined.</p>
|
||||||
@@ -2945,7 +2932,7 @@ is not. Again see his index.html for details. However it is also possible to not
|
|||||||
rely on the entry as the below shows. One should be able to do:</p>
|
rely on the entry as the below shows. One should be able to do:</p>
|
||||||
<pre><code> echo 'No. I want chocolate!' | ./prog > chocolate.raw
|
<pre><code> echo 'No. I want chocolate!' | ./prog > chocolate.raw
|
||||||
|
|
||||||
./prog e < chocolate.raw</code></pre>
|
./prog e < chocolate.raw</code></pre>
|
||||||
<p>and get:</p>
|
<p>and get:</p>
|
||||||
<pre><code> No. I want some chocolate!</code></pre>
|
<pre><code> No. I want some chocolate!</code></pre>
|
||||||
<p>but instead we get:</p>
|
<p>but instead we get:</p>
|
||||||
|
|||||||
@@ -69,15 +69,14 @@ might seem to be fine but is actually not! We will note some where this is known
|
|||||||
to happen (if it's not yet fixed). This has actually already happened to us.
|
to happen (if it's not yet fixed). This has actually already happened to us.
|
||||||
Sometimes it is okay: some entries are known to not work but they can still have
|
Sometimes it is okay: some entries are known to not work but they can still have
|
||||||
improvements (rarer situation but it's happened). Some might have slightly
|
improvements (rarer situation but it's happened). Some might have slightly
|
||||||
different output but which is not a problem for instance a newline after output
|
different output but which is not a problem for instance a newline after output.
|
||||||
in [Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson)'s changing it to
|
This is not the most ideal but it is okay.
|
||||||
[1994/ldb](%%REPO_URL%%/1994/ldb/ldb.c) use `fgets()` from `gets()`.
|
|
||||||
|
|
||||||
Make **ABSOLUTE CERTAIN** that you read the index.html file _BEFORE_ your changes
|
Make **ABSOLUTE CERTAIN** that you read the index.html file _BEFORE_ your changes
|
||||||
as it's important to see that the code is doing what it is supposed to. In the
|
as it's important to see that the code is doing what it is supposed to. In the
|
||||||
case that it's not obvious (some index.html files do not even have commands to
|
case that it's not obvious (some index.html files do not even have commands to
|
||||||
try or even explain how to use it!) then you should either skip the entry OR ask
|
try or even explain how to use it!) then you should either skip the entry OR ask
|
||||||
someone who will know e.g. us.
|
someone who will know for instance the Judges.
|
||||||
|
|
||||||
Make **ABSOLUTE CERTAIN** that you read the next section, the list of statuses
|
Make **ABSOLUTE CERTAIN** that you read the next section, the list of statuses
|
||||||
and the related information, BEFORE you submit a pull request!
|
and the related information, BEFORE you submit a pull request!
|
||||||
@@ -124,14 +123,14 @@ Another type of warning that would be hard to keep track of is different data
|
|||||||
sizes on different platforms. These tend to be required at the risk that
|
sizes on different platforms. These tend to be required at the risk that
|
||||||
sometimes the entry will not work for certain platforms, some of which might or
|
sometimes the entry will not work for certain platforms, some of which might or
|
||||||
might not be fixable; a good example where it was required to change and is okay
|
might not be fixable; a good example where it was required to change and is okay
|
||||||
is when [Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed the
|
is the fix of the segfault in macOS of
|
||||||
segfault in macOS of [1989/paul](%%REPO_URL%%/1989/paul/paul.c): changing the `int *` to a
|
[1989/paul](%%REPO_URL%%/1989/paul/paul.c): changing the `int *` to a `long *`
|
||||||
`long *` was required and it works just as well with linux.
|
was required and it works just as well with linux.
|
||||||
|
|
||||||
But even if they are fixable (which will likely be hard to do) it's almost
|
But even if they are fixable (which will likely be hard to do) it's almost
|
||||||
certain that such code would be just as non-portable (importable ? :-) ).
|
certain that such code would be just as non-portable (importable ? :-) ).
|
||||||
|
|
||||||
In rare cases they are valid. For instance Cody noticed in linux the following
|
In rare cases they are valid. For instance in linux the following
|
||||||
warning in [1985/applin](%%REPO_URL%%/1985/applin/applin.c) with gcc:
|
warning in [1985/applin](%%REPO_URL%%/1985/applin/applin.c) with gcc:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -140,7 +139,7 @@ warning in [1985/applin](%%REPO_URL%%/1985/applin/applin.c) with gcc:
|
|||||||
| ^~~~~~
|
| ^~~~~~
|
||||||
```
|
```
|
||||||
|
|
||||||
and this reminded him of his fix to
|
and this is is kind of like the fix to
|
||||||
[1984/anonymous](%%REPO_URL%%/1984/anonymous/anonymous.c). In the case of `1984/anonymous` it
|
[1984/anonymous](%%REPO_URL%%/1984/anonymous/anonymous.c). In the case of `1984/anonymous` it
|
||||||
was a bit more involved but with `1985/applin` one need only add to the Makefile
|
was a bit more involved but with `1985/applin` one need only add to the Makefile
|
||||||
`-include unistd.h`. So there are some cases where fixing warnings can fix a
|
`-include unistd.h`. So there are some cases where fixing warnings can fix a
|
||||||
@@ -164,7 +163,7 @@ include you can update the Makefile `CINCLUDE` variable. For instance if it
|
|||||||
needs `stdio.h` you could do `-include stdio.h`. Please leave a space after the
|
needs `stdio.h` you could do `-include stdio.h`. Please leave a space after the
|
||||||
`=` in the Makefile. You may also have extra long lines if this seems useful to
|
`=` in the Makefile. You may also have extra long lines if this seems useful to
|
||||||
make it a one-liner even if it kind of makes it longer than what the judges
|
make it a one-liner even if it kind of makes it longer than what the judges
|
||||||
consider a one-liner. Thank you!
|
consider a one-liner, at least within reason. Thank you!
|
||||||
|
|
||||||
|
|
||||||
### On layout of program source:
|
### On layout of program source:
|
||||||
@@ -172,9 +171,9 @@ consider a one-liner. Thank you!
|
|||||||
If you make changes _PLEASE TRY AND KEEP THE SOURCE CODE LAYOUT AS CLOSE TO THE
|
If you make changes _PLEASE TRY AND KEEP THE SOURCE CODE LAYOUT AS CLOSE TO THE
|
||||||
ORIGINAL AS POSSIBLE_. This might not always be possible and if you have an
|
ORIGINAL AS POSSIBLE_. This might not always be possible and if you have an
|
||||||
editor that does formatting it can cause problems. Sometimes formatters can even
|
editor that does formatting it can cause problems. Sometimes formatters can even
|
||||||
break code! [Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) has
|
break code! Some have experienced this many times with vim so he tends to
|
||||||
experienced this many times with vim so he tends to disable all format options
|
disable all format options when formatting code. In vim you should be able to do
|
||||||
when formatting code. In vim you should be able to do that with:
|
that with:
|
||||||
|
|
||||||
```
|
```
|
||||||
:set formatoptions=
|
:set formatoptions=
|
||||||
@@ -261,7 +260,7 @@ compiles but two versions of code it generates does not work with clang.
|
|||||||
|
|
||||||
However some still might have problems of some kind or another and some might
|
However some still might have problems of some kind or another and some might
|
||||||
not yet be located as an additional defect of clang was noticed where `main()`
|
not yet be located as an additional defect of clang was noticed where `main()`
|
||||||
is not allowed four args or one arg.
|
is not allowed four args or one arg (see below).
|
||||||
|
|
||||||
This is what the status means, however.
|
This is what the status means, however.
|
||||||
|
|
||||||
@@ -272,26 +271,26 @@ versions have an additional defect where they only allow 0, 2 or 3 args, the
|
|||||||
latter of which affected `1989/westley`, so these entries do not work with
|
latter of which affected `1989/westley`, so these entries do not work with
|
||||||
clang.
|
clang.
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) looked at the source
|
Looking at the source
|
||||||
code of clang and reported that there is no way to override the requirement of
|
code of clang, it appears that there is no way to override the requirement of
|
||||||
arg types so these entries will fail to compile with clang. That's why in some
|
arg types so these entries will fail to compile with clang. That's why in some
|
||||||
entries he fixed he did it by adding a function called `pain()`. :-) He did not
|
entries the fix was done with a new function, often called `pain()` :-)
|
||||||
check for the number of args as that was discovered later but he suspects it's
|
|
||||||
the same issue.
|
|
||||||
|
|
||||||
**NOTE for macOS users**: please be aware that _gcc_ under macOS **is actually
|
**NOTE for macOS users**: please be aware that _gcc_ under macOS **is actually
|
||||||
clang** despite the fact it might appear to be gcc: no symlink and both gcc and
|
clang** despite the fact it might appear to be gcc: no symlink and both gcc and
|
||||||
clang exist but the gcc is clang which you'll see if you run `gcc --version`.
|
clang exist but the gcc is clang which you'll see if you run `gcc --version`.
|
||||||
|
|
||||||
A tip and some fix methods from Cody: in the older days args to main() not given
|
A tip and some fix methods from [Cody Boone
|
||||||
a type were implicit ints but when they're required to be `char **` this can
|
Ferguson](authors.html#Cody_Boone_Ferguson): in the older days args to main()
|
||||||
cause a problem. In some cases Cody was able to use a `char *` inside `main()`
|
not given a type were implicit ints but when they're required to be `char **`
|
||||||
(see [1989/tromp/tromp.c](%%REPO_URL%%/1989/tromp/tromp.c) and
|
this can cause a problem. In some cases it was possible to use a `char *` inside
|
||||||
[1986/holloway/holloway.c](1986/holloway/index.html) for two examples though done slightly
|
`main()` (see [1989/tromp/tromp.c](%%REPO_URL%%/1989/tromp/tromp.c) and
|
||||||
differently). In other cases he was able to dereference the pointers to be used
|
[1986/holloway/holloway.c](1986/holloway/index.html) for two examples though
|
||||||
like an int and other times a cast was necessary. He used other various
|
done slightly differently). In other cases it was possible to dereference the
|
||||||
techniques to get them to compile. In some cases this introduced a problem but
|
pointers to be used like an int and other times a cast was necessary. There are
|
||||||
typically if not always that problem exists with compilers that are less strict.
|
various techniques to get these to compile. In some cases this introduced a
|
||||||
|
problem but typically if not always that problem exists with compilers that are
|
||||||
|
less strict.
|
||||||
|
|
||||||
|
|
||||||
## STATUS: main() has only one arg
|
## STATUS: main() has only one arg
|
||||||
@@ -327,11 +326,9 @@ or if you can `-ggdb3` when compiling as that will help with debugging symbols.
|
|||||||
**Please help us change use of gets() to fgets()**, if possible.
|
**Please help us change use of gets() to fgets()**, if possible.
|
||||||
|
|
||||||
Entries with this status use `gets()` which is unsafe because it has no limit on
|
Entries with this status use `gets()` which is unsafe because it has no limit on
|
||||||
the length of the string. [Cody Boone
|
the length of the string. Many were fixed but not all.
|
||||||
Ferguson](authors.html#Cody_Boone_Ferguson) has fixed several of these and he's
|
|
||||||
working on others in between fixing other things.
|
|
||||||
|
|
||||||
There's a very good reason for this even though it is bordering on tampering
|
There's a very good reason for this change even though it is bordering on tampering
|
||||||
entries: in modern systems one will get possibly alarming and certainly annoying
|
entries: in modern systems one will get possibly alarming and certainly annoying
|
||||||
warnings during at least one of compiling, linking and execution. In macOS it's
|
warnings during at least one of compiling, linking and execution. In macOS it's
|
||||||
most annoying as it happens during execution (also compilation) with the warning
|
most annoying as it happens during execution (also compilation) with the warning
|
||||||
@@ -339,30 +336,30 @@ being interspersed with the output of the program, often causing confusing
|
|||||||
output with the entry. A good example that was fixed is
|
output with the entry. A good example that was fixed is
|
||||||
[1990/tbr](%%REPO_URL%%/1990/tbr/tbr.c).
|
[1990/tbr](%%REPO_URL%%/1990/tbr/tbr.c).
|
||||||
|
|
||||||
Cody provided some important notes on this status with respect to fixing /
|
Some important notes on this status with respect to fixing / changing the
|
||||||
changing entries:
|
entries:
|
||||||
|
|
||||||
0. In some cases changing the entry to use `fgets()` will break the entry and in
|
0. In some cases changing the entry to use `fgets()` will break the entry and in
|
||||||
some cases cause it to crash. Where this is known we will document it. Some of
|
some cases cause it to crash. Where this is known we will document it.
|
||||||
these Cody is also off and on working on.
|
|
||||||
|
|
||||||
1. You **MUST** check the output before and after to make sure that it remains
|
1. You **MUST** check the output before and after to make sure that it remains
|
||||||
the same. Sometimes the output might not be immediately obviously wrong but is.
|
the same. Sometimes the output might not be immediately obviously wrong but is.
|
||||||
We will document known examples as we come across them.
|
We will document known examples as we come across them.
|
||||||
|
|
||||||
2. `gets()` does NOT STORE the `'\n'` but `fgets()` DOES! This is one of the
|
2. `gets()` does NOT STORE the `'\n'` but `fgets()` DOES! This is one of the
|
||||||
reasons some of the entries break when changed to `fgets()`. Cody has fixed some
|
reasons some of the entries break when changed to `fgets()`. Some of those have
|
||||||
of these but there are others he hasn't had time to address or even discover
|
been fixed but there are others that have not been.
|
||||||
yet.
|
|
||||||
|
|
||||||
3. Just because you don't see the string `gets` in the code does not mean it's
|
3. Just because you don't see the string `gets` in the code does not mean it's
|
||||||
not used. It is after all the International _Obfuscated C Code_ Contest! :-)
|
not used. It is after all the International _Obfuscated C Code_ Contest! :-)
|
||||||
Sometimes it will be in the Makefile and other times it will be obfuscated in
|
Sometimes it will be in the Makefile and other times it will be obfuscated in
|
||||||
other ways. Compilers and linkers tend to warn about its use (and as noted in
|
other ways; a good example of that that was fixed is
|
||||||
macOS it also happens at execution) and this is a good way to find entries that
|
[1991/dds](1991/dds/index.html): in this case the string was encrypted.
|
||||||
use it even if it's not visible in the code.
|
Compilers and linkers tend to warn about its use (and as noted in macOS it also
|
||||||
|
happens at execution) and this is a good way to find entries that use it even if
|
||||||
|
it's not visible in the code.
|
||||||
|
|
||||||
_NOTE_: this status is _NOT necessarily mutually exclusive_ with the _INABIAF_
|
**NOTE**: this status is _NOT necessarily mutually exclusive_ with the _INABIAF_
|
||||||
(it's not a bug it's a feature) status. The reason for this is due to warnings
|
(it's not a bug it's a feature) status. The reason for this is due to warnings
|
||||||
during compiling, linking and/or runtime, sometimes causing confusing output (as
|
during compiling, linking and/or runtime, sometimes causing confusing output (as
|
||||||
noted above).
|
noted above).
|
||||||
@@ -421,7 +418,7 @@ system specific winning entries were discouraged. This is an all time personal
|
|||||||
favourite of Landon Curt Noll. Run the alternate code to understand why this
|
favourite of Landon Curt Noll. Run the alternate code to understand why this
|
||||||
might be (along with how strange the source code is :-) ).
|
might be (along with how strange the source code is :-) ).
|
||||||
|
|
||||||
An example where a crash is not a bug: [2019/endoh](%%REPO_URL%%/2019/endoh/prog.c) is
|
An example where a crash is not a bug: [2019/endoh](2019/endoh/index.html) is
|
||||||
supposed to crash. There are others that are also supposed to crash or that are
|
supposed to crash. There are others that are also supposed to crash or that are
|
||||||
known to segfault but are considered features.
|
known to segfault but are considered features.
|
||||||
|
|
||||||
@@ -437,7 +434,7 @@ felt that the fix was tampering with the entry).
|
|||||||
|
|
||||||
**NOTE**: in the case of `gets()` we've fixed some to avoid the warning of the
|
**NOTE**: in the case of `gets()` we've fixed some to avoid the warning of the
|
||||||
compiler, linker or even during runtime, depending on the system. In [some cases
|
compiler, linker or even during runtime, depending on the system. In [some cases
|
||||||
like 1990/tbr](%%REPO_URL%%/1990/tbr/tbr.c) the fix actually prevents confusing output (though that
|
like 1990/tbr](1990/tbr/index.html) the fix actually prevents confusing output (though that
|
||||||
was not the only fix made in that entry).
|
was not the only fix made in that entry).
|
||||||
|
|
||||||
|
|
||||||
@@ -499,17 +496,18 @@ This program will very likely crash or do something funny without an arg.
|
|||||||
### Source code: [1984/mullender/mullender.c](%%REPO_URL%%/1984/mullender/mullender.c)
|
### Source code: [1984/mullender/mullender.c](%%REPO_URL%%/1984/mullender/mullender.c)
|
||||||
### Information: [1984/mullender/index.html](1984/mullender/index.html)
|
### Information: [1984/mullender/index.html](1984/mullender/index.html)
|
||||||
|
|
||||||
Although there is an alt version and supplementary program added by Cody that
|
Although there is an alt version and supplementary program added, that
|
||||||
will work in modern systems, if you do not have a
|
will work in modern systems, if you do not have a
|
||||||
[VAX-11](https://en.wikipedia.org/wiki/VAX-11) or
|
[VAX-11](https://en.wikipedia.org/wiki/VAX-11) or
|
||||||
[PDP-11](https://en.wikipedia.org/wiki/PDP-11) to run the original entry on it
|
[PDP-11](https://en.wikipedia.org/wiki/PDP-11) to run the original entry on it
|
||||||
will not work. See the index.html for details on the alternate versions.
|
will not work. See the index.html for details on the alternate versions.
|
||||||
|
|
||||||
Cody added and fixed the [gentab.c](%%REPO_URL%%/1984/mullender/gentab.c) which is from the
|
The file [gentab.c](%%REPO_URL%%/1984/mullender/gentab.c) which is from the
|
||||||
author's (or one of them, Mullender) remarks found by Cody. Cody fixed this to
|
author's (or one of them, Mullender) remarks, was fixed for modern systems, at
|
||||||
compile and work (as best as he can determine: he has no VAX-11 or PDP-11 or
|
least as best as can be determined: running the code on the binary itself does
|
||||||
emulator to test it) but running the code on the binary itself produces a
|
produce a `short[]` that can compile in modern systems but it will not work.
|
||||||
`short[]` that can compile in modern systems though it'll not work.
|
Before the fix it would fail in some cases and it is possible that in some cases
|
||||||
|
it might still fail.
|
||||||
|
|
||||||
|
|
||||||
<hr style="width:10%;text-align:left;margin-left:0">
|
<hr style="width:10%;text-align:left;margin-left:0">
|
||||||
@@ -630,9 +628,11 @@ reverse of other code (also wrt names). See the source file and the index.html
|
|||||||
|
|
||||||
Fixing the (mis)feature is likely to be a very difficult challenge especially
|
Fixing the (mis)feature is likely to be a very difficult challenge especially
|
||||||
without breaking something else which is far more likely (see below in tips from
|
without breaking something else which is far more likely (see below in tips from
|
||||||
Cody). You are welcome to try and fix it if you can!
|
Cody, who fixed it so the original would compile with `clang` and at least one
|
||||||
|
generated version would compile with `clang` too, not compromising the other
|
||||||
|
versions with `gcc`). You are welcome to try and fix it if you can!
|
||||||
|
|
||||||
### Tips from Cody:
|
### Tips:
|
||||||
|
|
||||||
The reason this is crashing is that the array `irk` is being accessed way out of
|
The reason this is crashing is that the array `irk` is being accessed way out of
|
||||||
bounds by the int `gnat`. For instance:
|
bounds by the int `gnat`. For instance:
|
||||||
@@ -651,12 +651,11 @@ bounds by the int `gnat`. For instance:
|
|||||||
The real trouble is that the code is generated and in a complex way or rather
|
The real trouble is that the code is generated and in a complex way or rather
|
||||||
ways.
|
ways.
|
||||||
|
|
||||||
I will explain this a little bit (though it might be more than a bit according
|
Trying to explain this might be tricky but here is an attempt. The program, when
|
||||||
to many :-) ) but that is all I can do for now. The program, when used without
|
used without any args, will print out what it reads. If one arg is specified it
|
||||||
any args, will print out what it reads. If one arg is specified it will do a
|
will do a ROT13 of it. If two args are specified it will print out the text
|
||||||
ROT13 of it. If two args are specified it will print out the text backwards
|
backwards (_WITHOUT ROT13!_). If three args are specified it will do both
|
||||||
(_WITHOUT ROT13!_). If three args are specified it will do both **_reversal AND
|
**_reversal AND ROT13_**.
|
||||||
ROT13_**.
|
|
||||||
|
|
||||||
So `ver0` is the same as the main program; `ver1` is the ROT13 of the code (but
|
So `ver0` is the same as the main program; `ver1` is the ROT13 of the code (but
|
||||||
see below); `ver2` will reverse the code and `ver3` will both reverse and ROT13
|
see below); `ver2` will reverse the code and `ver3` will both reverse and ROT13
|
||||||
@@ -714,20 +713,18 @@ and then another version that has the reversal _and_ ROT13 then you can see it's
|
|||||||
nigh impossible to fix if not impossible.
|
nigh impossible to fix if not impossible.
|
||||||
|
|
||||||
The fix to get it to even compile with clang and then get the first two
|
The fix to get it to even compile with clang and then get the first two
|
||||||
(counting the original, `ver0`) to work was the hardest fix I made due to how
|
(counting the original, `ver0`) to work was quite hard due to how the comments
|
||||||
the comments in reverse and ROT13 of it all works together, especially allowing
|
in reverse and ROT13 of it all works together, especially allowing all versions
|
||||||
all versions to compile with gcc. The only reason that it doesn't work
|
to compile with gcc. The only reason that it doesn't work completely with clang
|
||||||
completely with clang is the arg types of main() (see if you can figure out how
|
is the arg types of main() (see if you can figure out how the change of `main()`
|
||||||
the change of `main()` in `westley.c` is not carried over to versions 2 and 3!);
|
in `westley.c` is not carried over to versions 2 and 3!); originally none of
|
||||||
originally none of them compiled with clang.
|
them compiled with clang.
|
||||||
|
|
||||||
But it was possible to get the ROT13 code to compile with clang but the other
|
But it was possible to get the ROT13 code to compile with clang but the other
|
||||||
versions, reversed as well as ROT13 and reversed code, proved much more
|
versions, reversed as well as ROT13 and reversed code, proved much more
|
||||||
problematic. I got it to compile (or maybe mostly compile) all versions with
|
problematic. It is now possible to compile (or maybe mostly compile) all versions with
|
||||||
clang but I then carried it over to gcc in another system and it had syntax
|
clang but on another system and it had syntax errors.
|
||||||
errors.
|
|
||||||
|
|
||||||
That's about all I can say for how it works as other things have to be done too.
|
|
||||||
Enjoy! :-)
|
Enjoy! :-)
|
||||||
|
|
||||||
|
|
||||||
@@ -819,11 +816,10 @@ This is not considered a bug, however.
|
|||||||
### Source code: [1990/jaw/jaw.c](%%REPO_URL%%/1990/jaw/jaw.c)
|
### Source code: [1990/jaw/jaw.c](%%REPO_URL%%/1990/jaw/jaw.c)
|
||||||
### Information: [1990/jaw/index.html](1990/jaw/index.html)
|
### Information: [1990/jaw/index.html](1990/jaw/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson)
|
Some issues in this program were fixed and [Yusuke
|
||||||
fixed some issues in this program and [Yusuke
|
Endoh](authors.html#Yusuke_Endoh) then provided the `btoa` script but it appears
|
||||||
Endoh](authors.html#Yusuke_Endoh) provided the `btoa`
|
there is a bug in this entry. The judges wrote that to test the entry one can
|
||||||
script but it appears there is a bug in this entry. The judges wrote that to
|
do:
|
||||||
test the entry one can do:
|
|
||||||
|
|
||||||
``` <!---sh-->
|
``` <!---sh-->
|
||||||
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
|
||||||
@@ -889,11 +885,11 @@ The authors provided a list of features in the
|
|||||||
### Source code: [1990/theorem/theorem.c](%%REPO_URL%%/1990/theorem/theorem.c)
|
### Source code: [1990/theorem/theorem.c](%%REPO_URL%%/1990/theorem/theorem.c)
|
||||||
### Information: [1990/theorem/index.html](1990/theorem/index.html)
|
### Information: [1990/theorem/index.html](1990/theorem/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed many bugs that
|
Many bugs that prevented this from working properly (including segfaults) were
|
||||||
prevented this from working properly (including segfaults) but one thing to note
|
fixed but one thing to note is that if you pass two zeroes to `theorem_bkp` or
|
||||||
is that if you pass two zeroes to `theorem_bkp` or `fibonacci` the program
|
`fibonacci` the program will enter an infinite loop, printing 0 over and over
|
||||||
will enter an infinite loop, printing 0 over and over again; another condition
|
again; another condition where this occurred was fixed but this one should not
|
||||||
where this occurred was fixed but this one should not be fixed. Thank you.
|
be fixed.
|
||||||
|
|
||||||
|
|
||||||
<div id="1990_westley">
|
<div id="1990_westley">
|
||||||
@@ -904,7 +900,7 @@ where this occurred was fixed but this one should not be fixed. Thank you.
|
|||||||
### Source code: [1990/westley/westley.c](%%REPO_URL%%/1990/westley/westley.c)
|
### Source code: [1990/westley/westley.c](%%REPO_URL%%/1990/westley/westley.c)
|
||||||
### Information: [1990/westley/index.html](1990/westley/index.html)
|
### Information: [1990/westley/index.html](1990/westley/index.html)
|
||||||
|
|
||||||
Although Cody fixed this to not enter an infinite loop if the arg (converted to
|
Although this was fixed to not enter an infinite loop if the arg (converted to
|
||||||
a number) is < 0 the lack of an arg check at all was kept in to make it like the
|
a number) is < 0 the lack of an arg check at all was kept in to make it like the
|
||||||
original. The reason for the < 0 check is it floods the screen (yes this is
|
original. The reason for the < 0 check is it floods the screen (yes this is
|
||||||
indeed inconsistent with some other entries but it is not worth the time spent,
|
indeed inconsistent with some other entries but it is not worth the time spent,
|
||||||
@@ -969,9 +965,8 @@ when you're cheating it ends up winning! Can you figure that out as well?
|
|||||||
### Information: [1992/adrian/index.html](1992/adrian/index.html)
|
### Information: [1992/adrian/index.html](1992/adrian/index.html)
|
||||||
|
|
||||||
The author stated that if the file cannot be opened then it will print a system
|
The author stated that if the file cannot be opened then it will print a system
|
||||||
error but this is not the case unless it's showing a fault. However this was
|
error but this is not the case unless it's showing a fault. This was fixed as
|
||||||
instead fixed by Cody as part of another problem that was detected so that the
|
part of another problem that was detected.
|
||||||
program just exits 1 if the file cannot be opened.
|
|
||||||
|
|
||||||
Also, if _some_ of the programs are not given an arg they will very likely crash
|
Also, if _some_ of the programs are not given an arg they will very likely crash
|
||||||
or do something funny. For instance `adsleep` and `adbasename`. This is very
|
or do something funny. For instance `adsleep` and `adbasename`. This is very
|
||||||
@@ -1022,7 +1017,7 @@ Leo Broukhis, before he was an IOCCC judge, sent the IOCCC judges an email:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
A quick debugging session from Cody suggests that the problem with this value
|
A quick debugging session suggests that the problem with this value
|
||||||
is that:
|
is that:
|
||||||
|
|
||||||
``` <!---c-->
|
``` <!---c-->
|
||||||
@@ -1105,7 +1100,7 @@ debate.
|
|||||||
### Information: [1992/kivinen/index.html](1992/kivinen/index.html)
|
### Information: [1992/kivinen/index.html](1992/kivinen/index.html)
|
||||||
|
|
||||||
When you start the program everything starts to move over to the right side and
|
When you start the program everything starts to move over to the right side and
|
||||||
then ends. [Yusuke Endoh](authors.html#Yusuke_Endoh) pointed out that if you
|
then ends. [Yusuke Endoh](authors.html#Yusuke_Endoh) pointed out that if you
|
||||||
click the mouse it takes it back towards the centre.
|
click the mouse it takes it back towards the centre.
|
||||||
|
|
||||||
If you want to try and fix this, you are welcome to try.
|
If you want to try and fix this, you are welcome to try.
|
||||||
@@ -1119,15 +1114,15 @@ If you want to try and fix this, you are welcome to try.
|
|||||||
### Source code: [1992/lush/lush.c](%%REPO_URL%%/1992/lush/lush.c)
|
### Source code: [1992/lush/lush.c](%%REPO_URL%%/1992/lush/lush.c)
|
||||||
### Information: [1992/lush/index.html](1992/lush/index.html)
|
### Information: [1992/lush/index.html](1992/lush/index.html)
|
||||||
|
|
||||||
We used a patch from [Yusuke Endoh](authors.html#Yusuke_Endoh) to get this to
|
This was fixed but it only properly works with gcc; it was also changed to use
|
||||||
work but it only works with gcc. Cody removed the warnings of `gets()` and
|
`fgets()` instead of `gets()` and a script was provided to run the entry
|
||||||
provided a script to run the entry properly.
|
properly. Nonetheless it will only work with gcc.
|
||||||
|
|
||||||
Unfortunately due to the way the entry works and the fact that other compilers
|
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
|
like clang have different warnings and errors this simply does not work with
|
||||||
them.
|
them.
|
||||||
|
|
||||||
Some tips from Cody:
|
Some tips:
|
||||||
|
|
||||||
This entry relies on specific compiler warnings. With gcc it will look something
|
This entry relies on specific compiler warnings. With gcc it will look something
|
||||||
like:
|
like:
|
||||||
@@ -1217,7 +1212,7 @@ it yourself through ctrl-c or killing it in some other fashion.
|
|||||||
### Source code: [1992/westley/westley.c](%%REPO_URL%%/1992/westley/westley.c)
|
### Source code: [1992/westley/westley.c](%%REPO_URL%%/1992/westley/westley.c)
|
||||||
### Information: [1992/westley/index.html](1992/westley/index.html)
|
### Information: [1992/westley/index.html](1992/westley/index.html)
|
||||||
|
|
||||||
Cody improved the usability of this program by making it so that as long as the
|
The usability of this program was improved by making it so that as long as the
|
||||||
terminal columns is >= 80 it will display properly, rather than having to wrap
|
terminal columns is >= 80 it will display properly, rather than having to wrap
|
||||||
at 80 columns. However due to the nature of the program if the terminal is < 80
|
at 80 columns. However due to the nature of the program if the terminal is < 80
|
||||||
in column width it will not display right. To see the number of columns in your
|
in column width it will not display right. To see the number of columns in your
|
||||||
@@ -1392,13 +1387,13 @@ there.
|
|||||||
### Source code: [1994/ldb/ldb.c](%%REPO_URL%%/1994/ldb/ldb.c)
|
### Source code: [1994/ldb/ldb.c](%%REPO_URL%%/1994/ldb/ldb.c)
|
||||||
### Information: [1994/ldb/index.html](1994/ldb/index.html)
|
### Information: [1994/ldb/index.html](1994/ldb/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed this to compile
|
This was fixed to compile with modern systems but the entry also used `gets(3)`
|
||||||
with modern systems but the entry also used `gets(3)` which in some systems would
|
which in some systems would print out a warning along with the output of the
|
||||||
print out a warning along with the output of the program. Naturally it could
|
program. Naturally it could also overflow long lines, of which there are many,
|
||||||
also overflow long lines, of which there are many, though that is more
|
though that is more considered a feature, not a bug, as it was documented by the
|
||||||
considered a feature, not a bug, as it was documented by the author.
|
author.
|
||||||
|
|
||||||
Cody changed it to `fgets(3)` to prevent the display problem but this introduces
|
It was changed to use `fgets(3)` to prevent the display problem but this introduces
|
||||||
another problem namely that newlines can be printed if the line length < 231.
|
another problem namely that newlines can be printed if the line length < 231.
|
||||||
|
|
||||||
This seems like a worthy compromise to not have messed up output and although it
|
This seems like a worthy compromise to not have messed up output and although it
|
||||||
@@ -1423,7 +1418,7 @@ for more information on the change to `fgets(3)`.
|
|||||||
even when it works. See the author's remarks in the index.html for details.
|
even when it works. See the author's remarks in the index.html for details.
|
||||||
Increasing the buffer size and having it, when fed its own source code,
|
Increasing the buffer size and having it, when fed its own source code,
|
||||||
generate code that will compile with the same buffer size is difficult: it just
|
generate code that will compile with the same buffer size is difficult: it just
|
||||||
uses the original size. Cody explains this further down.
|
uses the original size. This is explained later down.
|
||||||
|
|
||||||
Getting it to use `fgets()` is even harder as when fed its own code it will
|
Getting it to use `fgets()` is even harder as when fed its own code it will
|
||||||
generate code that cannot even compile let alone use `fgets(3)`.
|
generate code that cannot even compile let alone use `fgets(3)`.
|
||||||
@@ -1432,37 +1427,31 @@ In both cases, changing the buffer size and changing it to use `fgets(3)`, will
|
|||||||
cause compilation errors without other adjustments.
|
cause compilation errors without other adjustments.
|
||||||
|
|
||||||
See the below magic for details. Along with the author's remarks in the
|
See the below magic for details. Along with the author's remarks in the
|
||||||
index.html file it might prove possible to get it to use `fgets(3)`. Cody,
|
index.html file it might prove possible to get it to use `fgets(3)`.
|
||||||
writing this on 02 November 2023, only just noticed the author's remarks and
|
|
||||||
will later on look at this if nobody takes up the challenge. More important work
|
|
||||||
like getting to a place that the next contest can run must be done first.
|
|
||||||
|
|
||||||
Cody explains the magic of how this entry works, which will be necessary if this
|
Here is the magic of how this entry works, to help anyone who wishes to work on
|
||||||
entry is to be fixed, below.
|
this.
|
||||||
|
|
||||||
You might wish to run the command:
|
|
||||||
|
|
||||||
``` <!---sh-->
|
|
||||||
make diff_orig_prog
|
|
||||||
```
|
|
||||||
|
|
||||||
to see what had to change for the buffer size, when looking at the below.
|
|
||||||
Furthermore you will want to look at:
|
|
||||||
|
|
||||||
|
You might wish to run the commands:
|
||||||
|
|
||||||
``` <!---sh-->
|
``` <!---sh-->
|
||||||
diff schnitzi.alt.c schnitzi.alt2.c
|
diff schnitzi.alt.c schnitzi.alt2.c
|
||||||
|
|
||||||
|
diff schnitzi.alt2.c schnitzi.alt.c
|
||||||
```
|
```
|
||||||
|
|
||||||
as the `fgets(3)` version can compile it just can't generate compilable code (let
|
to see how the buffer size and how the `gets(3)` was changed to use `fgets()`,
|
||||||
alone using `fgets(3)`) when fed itself (to reiterate, just changing the call to
|
in the two alternate versions. Notice that the `fgets(3)` version can compile it
|
||||||
`fgets(3)` does not mean it can compile and there's a further problem in that
|
just can't **generate** compilable code (let alone using `fgets(3)`) when fed
|
||||||
`fgets(3)` retains the newline whereas `gets(3)` does not). Nevertheless looking
|
itself (to reiterate, just changing the call to `fgets(3)` does not mean it can
|
||||||
at these commands will be of help to understand how it works.
|
compile and there's a further problem in that `fgets(3)` retains the newline
|
||||||
|
whereas `gets(3)` does not). Nevertheless looking at these commands will be of
|
||||||
|
help to understand how it works, in case one wishes to try and fix it.
|
||||||
|
|
||||||
For the alternate versions the other functionality is unaffected.
|
For the alternate versions the other functionality is unaffected.
|
||||||
|
|
||||||
### The magic of [1994/schnitzi](%%REPO_URL%%/1994/schnitzi/schnitzi.c) and how it flips text
|
|
||||||
|
### The magic of [1994/schnitzi](1994/schnitzi/index.html) and how it flips text
|
||||||
|
|
||||||
The problem is getting the generated code to use `fgets()` (once it even
|
The problem is getting the generated code to use `fgets()` (once it even
|
||||||
compiles which was easy to do) and also have the updated buffer size be the
|
compiles which was easy to do) and also have the updated buffer size be the
|
||||||
@@ -1524,9 +1513,9 @@ changing the buffer size, see below).
|
|||||||
Getting this entry to use `fgets(3)` is easy but the problem is you're supposed
|
Getting this entry to use `fgets(3)` is easy but the problem is you're supposed
|
||||||
to be able to feed the source to the program and the output of that will be
|
to be able to feed the source to the program and the output of that will be
|
||||||
compilable. It however will create compiler errors. So it's not just changing
|
compilable. It however will create compiler errors. So it's not just changing
|
||||||
the code to get it to use `fgets(3)`! I (Cody) already did this before I noticed
|
the code to get it to use `fgets(3)`! This was done but
|
||||||
the other part which is why I rolled that part back. I did increase the buffer
|
the other part is why that part was rolled back. The buffer size was increased
|
||||||
size but that only works on the original source.
|
but that only works on the original source.
|
||||||
|
|
||||||
To say just how sensitive this entry is: even a space, lack of space or a
|
To say just how sensitive this entry is: even a space, lack of space or a
|
||||||
character, wrong character, lack of character or character in the wrong place
|
character, wrong character, lack of character or character in the wrong place
|
||||||
@@ -1553,7 +1542,7 @@ that's compiled) cannot be opened in the directory it is run from.
|
|||||||
|
|
||||||
### Important reminder and a note about the `-1` value check for `getc()`:
|
### Important reminder and a note about the `-1` value check for `getc()`:
|
||||||
|
|
||||||
Cody fixed the code to not use `-1` for the return value of `getc()`; this is
|
This code was fixed 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
|
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
|
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
|
until the program crashed, by chance reads a `-1` or was killed (it is for this
|
||||||
@@ -1619,8 +1608,7 @@ as documented, are considered features.
|
|||||||
### Information: [1995/cdua/index.html](1995/cdua/index.html)
|
### Information: [1995/cdua/index.html](1995/cdua/index.html)
|
||||||
|
|
||||||
This did not originally compile under macOS and after it did compile under
|
This did not originally compile under macOS and after it did compile under
|
||||||
macOS, it crashed. [Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson)
|
macOS, it crashed. These problems were fixed.
|
||||||
fixed these problems.
|
|
||||||
|
|
||||||
It should be noted however that there is a condition where the program will
|
It should be noted however that there is a condition where the program will
|
||||||
prompt you to press return again. This was thought to be a bug but looking at
|
prompt you to press return again. This was thought to be a bug but looking at
|
||||||
@@ -1988,7 +1976,7 @@ Another feature that does work in linux is:
|
|||||||
|
|
||||||
Can you help fix these problems?
|
Can you help fix these problems?
|
||||||
|
|
||||||
Cody provided the C code that creates an unformatted perl script that will just
|
Here is some C code that creates an unformatted perl script that will just
|
||||||
print 'unimplemented' for operators but it seems to work in some other ways (see
|
print 'unimplemented' for operators but it seems to work in some other ways (see
|
||||||
below for how to go further than unimplemented) which is the exact perl from the
|
below for how to go further than unimplemented) which is the exact perl from the
|
||||||
C program except that it has the `#!/usr/bin/env perl` and `use warnings;` as
|
C program except that it has the `#!/usr/bin/env perl` and `use warnings;` as
|
||||||
@@ -2097,7 +2085,7 @@ That means then that in linux despite the subroutines seemingly not existing it
|
|||||||
works in the code, at least in some cases.
|
works in the code, at least in some cases.
|
||||||
|
|
||||||
As far as the unimplemented error goes: the author stated that it means there is
|
As far as the unimplemented error goes: the author stated that it means there is
|
||||||
invalid input. But as can be seen by the input I (Cody) gave the input is not
|
invalid input. But as can be seen by the input given, the input is not
|
||||||
actually incorrect. It is also curious to note that it ends up printing what's
|
actually incorrect. It is also curious to note that it ends up printing what's
|
||||||
on the stack at that point:
|
on the stack at that point:
|
||||||
|
|
||||||
@@ -2107,15 +2095,14 @@ on the stack at that point:
|
|||||||
5
|
5
|
||||||
```
|
```
|
||||||
|
|
||||||
which might (?) suggest that the `+` operator is unimplemented. Unfortunately it
|
which might (?) suggest that the `+` operator is unimplemented.
|
||||||
has been many years since I have used perl and I was never a guru either.
|
|
||||||
|
|
||||||
|
|
||||||
### STATUS: INABIAF - please **DO NOT** fix
|
### STATUS: INABIAF - please **DO NOT** fix
|
||||||
|
|
||||||
The author states that in perl < 5.6.0 there is a bug with a core dump in what
|
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
|
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
|
bug to be fixed. For the curious this will crash in macOS. It was noted that the
|
||||||
code that crashes is:
|
code that crashes is:
|
||||||
|
|
||||||
``` <!---c-->
|
``` <!---c-->
|
||||||
@@ -2224,17 +2211,18 @@ fire](https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing))!
|
|||||||
### Source code: [2001/anonymous/anonymous.c](%%REPO_URL%%/2001/anonymous/anonymous.c)
|
### Source code: [2001/anonymous/anonymous.c](%%REPO_URL%%/2001/anonymous/anonymous.c)
|
||||||
### Information: [2001/anonymous/index.html](2001/anonymous/index.html)
|
### Information: [2001/anonymous/index.html](2001/anonymous/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed this so that it
|
This was fixed so that it doesn't segfault and then also fixed the functionality
|
||||||
doesn't segfault and then also fixed the functionality of it (but see below).
|
of it (but see below).
|
||||||
|
|
||||||
Cody also fixed the [anonymous.ten.c](%%REPO_URL%%/2001/anonymous/anonymous.ten.c) program
|
The [anonymous.ten.c](%%REPO_URL%%/2001/anonymous/anonymous.ten.c) program was
|
||||||
(it also segfaulted) but notes that it **MUST** be compiled as a **32-bit ELF
|
also fixed (it also segfaulted) but note that it **MUST** be compiled as a **32-bit ELF
|
||||||
binary** so it will NOT work in macOS (for example); if you cannot use `-m32` or
|
binary** so it will NOT work in macOS (for example); if you cannot use `-m32` or
|
||||||
even if you can but it cannot compile as an ELF binary (not elf binary :-) )
|
even if you can but it cannot compile as an ELF binary (not elf binary :-) )
|
||||||
(but see below) then the `anonymous` program itself will very likely crash if
|
(but see below) then the `anonymous` program itself will very likely crash if
|
||||||
you run it on the compiled [anonymous.ten.c](%%REPO_URL%%/2001/anonymous/anonymous.ten.c) but
|
you run it on the compiled
|
||||||
if nothing else it will not modify the target executable (this part of the fix
|
[anonymous.ten.c](%%REPO_URL%%/2001/anonymous/anonymous.ten.c); if nothing else
|
||||||
at least should be correct).
|
it will not modify the target executable (this part of the fix at least should
|
||||||
|
be correct).
|
||||||
|
|
||||||
Note also that if you don't specify a file or you specify a non-32-bit ELF file
|
Note also that if you don't specify a file or you specify a non-32-bit ELF file
|
||||||
this program will very likely crash or do something strange like slaughter the
|
this program will very likely crash or do something strange like slaughter the
|
||||||
@@ -2252,28 +2240,27 @@ elves of Imladris :-(
|
|||||||
The author stated that it only works with i386 linux so the fact it doesn't work
|
The author stated that it only works with i386 linux so the fact it doesn't work
|
||||||
in modern systems is considered a feature and not a bug.
|
in modern systems is considered a feature and not a bug.
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed an initial
|
An initial segfault was fixed (trying to open the file) and the [supplementary
|
||||||
segfault (trying to open the file) and he also fixed the [supplementary program
|
program bellard.otccex.c](%%REPO_URL%%/2001/bellard/bellard.otccex.c) was also
|
||||||
bellard.otccex.c](%%REPO_URL%%/2001/bellard/bellard.otccex.c) but this still crashes in
|
fixed but this still crashes in systems not i386 linux which is what the author
|
||||||
systems not i386 linux which is what the author stated.
|
stated.
|
||||||
|
|
||||||
The author said that they compiled it with [gcc version
|
The author said that they compiled it with [gcc version
|
||||||
2.95.2](https://ftp.gnu.org/gnu/gcc/gcc-2.95.2/gcc-everything-2.95.2.tar.gz). We
|
2.95.2](https://ftp.gnu.org/gnu/gcc/gcc-2.95.2/gcc-everything-2.95.2.tar.gz). We
|
||||||
don't know if a certain gcc version is necessary but it might be helpful to
|
don't know if a certain gcc version is necessary but it might be helpful to
|
||||||
download and compile that version to test it - or it might not.
|
download and compile that version to test it - or it might not.
|
||||||
|
|
||||||
I (Cody) have no i386 system to test this but perhaps this is why I can't get it
|
Yusuke was able to get this to work with `-m32` but only in an emulator. As
|
||||||
to work. Yusuke was able to get this to work with `-m32` but only in an
|
such, it might be that the changes made should be rolled back but at least now
|
||||||
emulator.
|
the supplementary program will work in modern systems.
|
||||||
|
|
||||||
On the author's [web page for this program](https://bellard.org/otcc/) it is
|
On the author's [web page for this program](https://bellard.org/otcc/) it is
|
||||||
explicitly stated that it requires i386 linux.
|
explicitly stated that it requires i386 linux.
|
||||||
|
|
||||||
There I found what should be a more portable version which is included as
|
There it was found what should be a more portable version which is included as
|
||||||
[otccelf.c](%%REPO_URL%%/2001/bellard/otccelf.c) (after adding some `#include`s and the
|
[otccelf.c](%%REPO_URL%%/2001/bellard/otccelf.c) (after adding some `#include`s
|
||||||
modification by Yusuke noted in the [thanks](thanks-for-help.html)
|
and the modification but it appears this *also* requires i386 linux; indeed
|
||||||
file) but it appears this *also* requires i386 linux; indeed looking at the code
|
looking at the code it hard codes paths that are i386 specific to linux.
|
||||||
it hard codes paths that are i386 specific to linux.
|
|
||||||
|
|
||||||
Another point of interest is that the author provided unobfuscated versions
|
Another point of interest is that the author provided unobfuscated versions
|
||||||
which might be of value to look at.
|
which might be of value to look at.
|
||||||
@@ -2283,14 +2270,14 @@ which might be of value to look at.
|
|||||||
|
|
||||||
This is a good question. The reason is we believe it better to fix some obvious
|
This is a good question. The reason is we believe it better to fix some obvious
|
||||||
problems: there were some bugs that would very possibly prevent it from working
|
problems: there were some bugs that would very possibly prevent it from working
|
||||||
even if it was in i386 linux though Yusuke seemed to get it to work in an
|
even if it was in i386 linux though it did seem to work in an emulator, so
|
||||||
emulator so perhaps not. Still it's better to have the type of the file pointer
|
perhaps not. Still it's better to have the type of the file pointer correct and
|
||||||
correct and so that the file can at least be opened in modern systems even if
|
so that the file can at least be opened in modern systems even if the compiler
|
||||||
the compiler won't work there.
|
won't work there.
|
||||||
|
|
||||||
Also the supplementary program, which did not work at all, was fixed (by Cody)
|
Also the supplementary program, which did not work at all, was fixed and it can
|
||||||
and it can be run by itself for fun in modern systems, which was not possible
|
be run by itself for fun in modern systems, which was not possible before the
|
||||||
before the fixes there.
|
fixes there.
|
||||||
|
|
||||||
|
|
||||||
<div id="2001_cheong">
|
<div id="2001_cheong">
|
||||||
@@ -2421,9 +2408,7 @@ See also the author's list of bugs [here](2001/schweikh/index.html#bugs).
|
|||||||
### Information: [2001/westley/index.html](2001/westley/index.html)
|
### Information: [2001/westley/index.html](2001/westley/index.html)
|
||||||
|
|
||||||
This function uses `gets(3)` but it would be ideal if it used `fgets(3)`. This
|
This function uses `gets(3)` but it would be ideal if it used `fgets(3)`. This
|
||||||
one is rather complicated and will be looked at later (some progress was made by
|
one is rather complicated but you are welcome to try and fix this if you wish.
|
||||||
Cody but it is less important than other work) but you are welcome to try
|
|
||||||
and fix this if you wish.
|
|
||||||
|
|
||||||
|
|
||||||
### STATUS: main() has only one arg - try and make it have 2 or 3
|
### STATUS: main() has only one arg - try and make it have 2 or 3
|
||||||
@@ -2804,14 +2789,14 @@ for running itself.
|
|||||||
### Source code: [2005/mynx/mynx.c](%%REPO_URL%%/2005/mynx/mynx.c)
|
### Source code: [2005/mynx/mynx.c](%%REPO_URL%%/2005/mynx/mynx.c)
|
||||||
### Information: [2005/mynx/index.html](2005/mynx/index.html)
|
### Information: [2005/mynx/index.html](2005/mynx/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) notes that, though
|
Probably this is obvious, but this entry will not work with https. An
|
||||||
probably obvious, this entry will not work with https. He added an alt version
|
alt version exists that _SCANS_ for https in case someone wants to set up a pipeline or
|
||||||
that scans for https in case someone wants to set up a pipeline or other
|
other workaround (perhaps with `stunnel`) or even add additional code to it to
|
||||||
workaround (perhaps with stunnel) or even add additional code to it to make it
|
make it work with https but the problem otherwise is a secure connection has to
|
||||||
work with https but the problem otherwise is a secure connection has to first be
|
first be set up in order to give http commands. This is not a bug but it's worth
|
||||||
set up in order to give http commands. This is not a bug but it's worth pointing
|
pointing out as it won't work on as many websites as it used to including the
|
||||||
out as it won't work on as many websites as it used to including the [IOCCC
|
[IOCCC website](https://www.ioccc.org) itself. The author noted that someone did
|
||||||
website](https://www.ioccc.org) itself.
|
make a version that supports `https` but it is not known where this might be.
|
||||||
|
|
||||||
|
|
||||||
<div id="2005_sykes">
|
<div id="2005_sykes">
|
||||||
@@ -2968,13 +2953,12 @@ without outputting a solution. If you can wait that long.
|
|||||||
### Source code: [2006/toledo2/toledo2.c](%%REPO_URL%%/2006/toledo2/toledo2.c)
|
### Source code: [2006/toledo2/toledo2.c](%%REPO_URL%%/2006/toledo2/toledo2.c)
|
||||||
### Information: [2006/toledo2/index.html](2006/toledo2/index.html)
|
### Information: [2006/toledo2/index.html](2006/toledo2/index.html)
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) fixed this program to
|
This was fixed to
|
||||||
not crash in macOS (it appeared to work fine in fedora linux on an `x86_64`
|
not crash in macOS (it appeared to work fine in fedora linux on an `x86_64`
|
||||||
architecture but he does not know if it crashed in macOS Ventura due to the fact
|
architecture but it is not known if it crashed in macOS Ventura due to the fact
|
||||||
it is an `arm64` CPU - the Apple silicon chip, but given that the author later
|
it is an `arm64` CPU - the Apple silicon chip, but given that the author later
|
||||||
made some slight changes to make it not crash in `x86_64` macOS that might be
|
made some slight changes to make it not crash in `x86_64` macOS that might be
|
||||||
the case). This fix, BTW, is a mix of a fix by [Yusuke
|
the case).
|
||||||
Endoh](authors.html#Yusuke_Endoh) and Cody's.
|
|
||||||
|
|
||||||
Nevertheless there are two features that are not bugs.
|
Nevertheless there are two features that are not bugs.
|
||||||
|
|
||||||
@@ -3130,11 +3114,10 @@ like it _might_ (see Apple resources below) be but it could also be a wider
|
|||||||
problem with macOS. It appears that Apple does not allow certain combinations of
|
problem with macOS. It appears that Apple does not allow certain combinations of
|
||||||
memory protections with the arm64 processor.
|
memory protections with the arm64 processor.
|
||||||
|
|
||||||
[Cody Boone Ferguson](authors.html#Cody_Boone_Ferguson) tried some of the
|
Some of the workarounds have been tried but at this time it did not seem to
|
||||||
workarounds but at this time he could not get it to work. He offers some earlier
|
work. Some earlier debugging sessions are below as well as a resource from the
|
||||||
debugging sessions below as well as a resource from the author as well as some
|
author as well as some resources on Apple's website should anyone wish to take a
|
||||||
resources on Apple's website should anyone wish to take a crack at it. He might
|
crack at it. A starting point might be in
|
||||||
address it later but a starting point might be in
|
|
||||||
[richards.alt.c](%%REPO_URL%%/2011/richards/richards.alt.c).
|
[richards.alt.c](%%REPO_URL%%/2011/richards/richards.alt.c).
|
||||||
|
|
||||||
|
|
||||||
@@ -3326,7 +3309,7 @@ Entitlement](https://developer.apple.com/documentation/bundleresources/entitleme
|
|||||||
|
|
||||||
Looking at
|
Looking at
|
||||||
<https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c>
|
<https://github.com/apple/darwin-xnu/blob/5394bb038891708cd4ba748da79b90a33b19f82e/bsd/kern/kern_mman.c>
|
||||||
Cody noticed a curious thing in the `mprotect()` function: `#if
|
A curious thing is in the `mprotect()` function: `#if
|
||||||
CONFIG_DYNAMIC_CODE_SIGNING` and the protection variable has the
|
CONFIG_DYNAMIC_CODE_SIGNING` and the protection variable has the
|
||||||
`VM_PROT_TRUSTED` set it might allow overriding the problem but this is
|
`VM_PROT_TRUSTED` set it might allow overriding the problem but this is
|
||||||
unconfirmed and it's not known when `CONFIG_DYNAMIC_CODE_SIGNING` would be
|
unconfirmed and it's not known when `CONFIG_DYNAMIC_CODE_SIGNING` would be
|
||||||
@@ -3667,7 +3650,7 @@ rely on the entry as the below shows. One should be able to do:
|
|||||||
``` <!---sh-->
|
``` <!---sh-->
|
||||||
echo 'No. I want chocolate!' | ./prog > chocolate.raw
|
echo 'No. I want chocolate!' | ./prog > chocolate.raw
|
||||||
|
|
||||||
./prog e < chocolate.raw
|
./prog e < chocolate.raw
|
||||||
```
|
```
|
||||||
|
|
||||||
and get:
|
and get:
|
||||||
|
|||||||
Reference in new issue
Block a user