Updates to 1994/shapiro including possible bug

Rename shapiro.info shapiro.md and make markdown format.

Format fixes in README.md.

Add try section in README.md.

Add this entry to bugs.md for some systems. Specifically the entry
assumes that EOF is -1 but this is not required by the standard; all
that is required is that it is some negative number (see 7.21
Input/output<stdio.h> subsection 1 in the standard).

That's fine and well but changing the code to check for EOF breaks it
terribly. I have added to bugs.md the problems and some tips in solving
it (assuming it's at all feasible which is not entirely certain at this
point and perhaps is not even worth it).
This commit is contained in:
Cody Boone Ferguson committed 2023-04-02 07:15:57 -07:00
1 parent d636652337
commit 113c95702a
4 files changed
+197 -154

No files matched your search

+78 -44
View File
@@ -1,62 +1,96 @@
# Most Well Rounded Obfuscation:
Andrew T. Shapiro
CSES/CIRES University of Colorado
Campus Box 216
Boulder, CO 80309-0216
USA
Andrew T. Shapiro
CSES/CIRES University of Colorado
Campus Box 216
Boulder, CO 80309-0216
USA
## To build:
make all
## To run
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) pointed out a potential
bug on systems where `EOF != -1`. The problem is that `getc()` and the related
functions do not return `-1` on EOF or error but rather `EOF` but the program
assumes `-1` (conversely when using the `getopt()` functions one should not
check for EOF but -1 as the functions return -1 not EOF but the standard does
not require `EOF` to be -1, just a negative number. However changing it to check
for `!=EOF` caused a problem due to the clever encoding of the code. See
[bugs.md](/bugs.md) for more details if you wish to try and fix this (Cody is
here and there working on it along with other things and will change this
message when it's fixed assuming it's feasible).
## To run:
./shapiro &
## Judges' comments
## Try:
This entry has many different levels of obfuscation, and yet the
source file is self documenting. :-)
```sh
./shapiro
^Z
bg
ps x
^C
From time to time, run ps and look at the new processes.
./shapiro_t1
```
See shapiro.info for more information in the internals of this program.
The file shapiro.alt contains a non-obfuscated version of this program.
Notice what you see in the output of `ps`!
## Author's comments
The basic theme (pun) of this program is:
"This time (everything) is not where it should be."
~~~~
My entry (shapiro.c) is mostly comment, formatted in the shape of a
clock. If you strip out the comments and look at the code you will
quickly realize that the comments were the important part and that
the code does very little (see pun above). It writes (to stdout)
another C program (shapiro_t2.c). This is the first level of
obfuscation.
The second program (shapiro_t2.c if you use the build/make file)
prints a clock in the upper right hand corner of your VTxxx/ANSI
display.
Most of the surface obfuscation in the second program (shapiro_t2.c)
was an attempt to make it as small as possible. You should be able to
see around this with cb(1) and some more intelligent variable names.
Once you get past this you will realize that the third level of
obfuscation is a six member client/server hierarchy.
(See the second info file for a detailed description of the algorithm.)
Lint complains about: precedence confusion, K may be used before set,
main() returns random value to invocation environment, value type used
inconsistently, value type declared inconsistently, function argument
( number ) used inconsistently, function returns value which is always
ignored, function returns value which is sometimes ignored
All of which are harmless (famous last words).
This may or may not work on non ASCII systems (I could not find one to
test it on.)
## Judges' comments:
This entry has many different levels of obfuscation, and yet the
source file is self documenting. :-)
From time to time, run ps and look at the new processes.
See [shapiro.md](shapiro.md) for more information in the internals of this program.
The file [shapiro.alt.c](shapiro.alt.c) contains a non-obfuscated version of
this program. Note that this alt file is currently missing. See
[bugs.md](/bugs.md) for details.
## Author's comments:
The basic theme (pun) of this program is:
> "This time (everything) is not where it should be."
> ~~~~
My entry ([shapiro.c](shapiro.c)) is mostly comment, formatted in the shape of a
clock. If you strip out the comments and look at the code you will
quickly realize that the comments were the important part and that
the code does very little (see pun above). It writes (to stdout)
another C program ([shapiro_t2.c](shapiro_t2.c)). This is the first level of
obfuscation.
The second program ([shapiro_t2.c](shapiro_t2.c) if you use the Makefile
prints a clock in the upper right hand corner of your VTxxx/ANSI display.
Most of the surface obfuscation in the second program
([shapiro_t2.c](shapiro_t2.c))
was an attempt to make it as small as possible. You should be able to
see around this with cb(1) and some more intelligent variable names.
Once you get past this you will realize that the third level of
obfuscation is a six member client/server hierarchy.
(See the [shapiro.md](shapiro.md) file for a detailed description of the
algorithm.)
Lint complains about: precedence confusion, `K` may be used before set,
main() returns random value to invocation environment, value type used
inconsistently, value type declared inconsistently, function argument
(number) used inconsistently, function returns value which is always
ignored, function returns value which is sometimes ignored.
All of which are harmless (famous last words).
This may or may not work on non ASCII systems (I could not find one to
test it on.)
## Copyright and CC BY-SA 4.0 License: