diff --git a/1990/jaw/Makefile b/1990/jaw/Makefile index ee5a5042c..ae9b0c149 100644 --- a/1990/jaw/Makefile +++ b/1990/jaw/Makefile @@ -67,7 +67,7 @@ CINCLUDE= # Optimization # -OPT= -O3 +OPT= # Default flags for ANSI C compilation # diff --git a/1990/jaw/README.md b/1990/jaw/README.md index 0f3590854..89f0192df 100644 --- a/1990/jaw/README.md +++ b/1990/jaw/README.md @@ -67,7 +67,7 @@ shark.sh, contains a 'jaw.c' embedded within it! The sender must have `compress` and `btoa`. To send, try: ```sh -sh shark.sh jaw.* README.md > receive +./shark.sh jaw.* README.md > receive ``` The resulting file, `receive`, unpacks the input files @@ -86,7 +86,7 @@ cmp ../README.md README.md ### ABSTRACT #### Minimal, Universal File Bundling (or, Functional Obfuscation in a Self-Decoding Unix Shell Archive) -\ + James A. Woods\ Universities Space Research Association\ NASA Ames Research Center @@ -94,7 +94,7 @@ NASA Ames Research Center --- > "Use an algorithm, go to jail." ->\ +> > -- anon., circa 1988, pre-Morris worm era ---- @@ -134,7 +134,7 @@ environment. > And he shows them pearly white > Just a jackknife has Macheath, dear-- > And he keeps it out of sight. ->\ +> > -- Bertolt Brecht, Threepenny Opera ---------------------------------------------- diff --git a/1990/jaw/jaw.c b/1990/jaw/jaw.c index 6ab37e147..6bc92e1c4 100644 --- a/1990/jaw/jaw.c +++ b/1990/jaw/jaw.c @@ -1,5 +1,5 @@ #define C char -#define F X,perror("oops"),1 +#define F X,fprintf(stderr,"oops\n"),1 #define G getchar() #define I ;if( #define P putchar diff --git a/1990/jaw/shark.sh b/1990/jaw/shark.sh index 72190b1c3..bd0e8b675 100755 --- a/1990/jaw/shark.sh +++ b/1990/jaw/shark.sh @@ -11,16 +11,16 @@ for i in "${@?${usage?$0 file...}}";do<"$i"||exit;done # PATH=$PATH:. a=atob m=unshark z=zcat r="rm -f $a $m* $z" v="cc -Wno-implicit-function-declaration -o $z $m.c" -trap "$r;exit 1" 1 2 13 15 +trap '$r;exit 1' 1 2 13 15 echo decoding... -(:|compress|./btoa|$a|$z)2>$m>&2||(sed '1,9s/./#define & / +(:|compress|./btoa|./$a|./$z)2>$m>&2||(sed '1,9s/./#define & / s/@/[w]/g s/C/char /g s/I/;if(/g s/W/;while(/g s/Y/%lx /g s/}/;}/g'>$m.c<<_&& -FX,perror("$m bite: resend"),1; +FX,fprintf(stderr,"$m bite: resend\n"),1; GgetC() H(w=g()) K[69001] @@ -43,5 +43,5 @@ Z,h@=w;n=8;f=Q+e;i=o=HIo<0)X,1;P(i)WH+1){Iw==Q&e){Z;m=n=8;f=QIH<0)X} c=wIw>=f)U++=i,w=oWw>=Q)U++=h@,w=t@;P(i=h@)Wp>D+Q)P(*--p) I(w=f)<1l<$m-&&$z<$m->$m&&tar xvf $m&&$r +($v)&&ln -f $z $a)&&./$a<<\w>./$m-&&./$z<./$m->./$m&&tar xvf ./$m&&$r Z diff --git a/1990/jaw/try.sh b/1990/jaw/try.sh new file mode 100755 index 000000000..a4c337b57 --- /dev/null +++ b/1990/jaw/try.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +echo "Running shark.sh:" +sh shark.sh README.md jaw.c README.md > receive || exit 1 +echo "Done." + +echo "Attempting to extract files:" + +mkdir -p test +cd test +sh ../receive diff --git a/bugs.md b/bugs.md index 487c9a485..39ac43dfe 100644 --- a/bugs.md +++ b/bugs.md @@ -579,46 +579,11 @@ You are welcome to try and fix it if you can! ### Source code: [1990/jaw/jaw.c](1990/jaw/jaw.c) ### Information: [1990/jaw/README.md](1990/jaw/README.md) -[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed the scripts to -work in modern systems. He notes however that the command in the try section, -the one to test the official C entry, **appears** (the keyword!) to not work -with macOS, giving: - - -```sh -$ echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw -oops: Undefined error: 0 -oops: Undefined error: 0 -``` - -However this is because the entry uses `perror()` and it just so happens that -the default `errno` of 0 gives that result. For instance if you run the -following C program under macOS you will get undefined error but if you do it -under Linux you'll likely get success. - - -```c -#include -#include -#include -int main() -{ - errno = 0; - printf("%d, %s\n", errno, strerror(errno)); -} -``` - -In fact the condition which is in the `a()` function on line 18 of the entry -namely: - - I k>16) - -is true on both linux and macOS, with `k` being equal to 22! - -Should the entry use `perror()`? Perhaps not but we're not sure of its purpose -so it should stay with this note. - -If you want to try and fix this (mis)feature, you are welcome to try. +It seems like the scripts do not work correctly, where not all files are +extracted. Some work was done to get them to work some but it does not appear +that all files can be extracted. For instance in the [try.sh](1990/jaw/try.sh) +script which Cody added it is supposed to add the README.md file to the archive +and it did at one point (or so he recalls) but now it doesn't seem to happen. ## 1990 theorem diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 75dc48cd4..6a3fbed22 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -933,9 +933,15 @@ With these improvements the entry looks much more like the original! ## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md])) Cody fixed the script to work properly in modern environments (to do with `$PATH` -not having `.` in it). He notes that with an invocation in the try section will -with macOS show what appears to be an error message but is actually okay. He -gives more information in the [bugs.md](/bugs.md) file. +not having `.` in it). Other adjustments were made as well. + +He also changed the `perror(3)` call to `fprintf(3)` because in macOS when errno +is 0 it shows what looks like an error. + +He added the [try.sh](1990/jaw/try.sh) to run the commands that we suggested at +the time. However, there is a known bug still, see [bugs.md](bugs.md) for +details. + NOTE: as `btoa` is not common we used a ruby script from Yusuke.