diff --git a/1984/laman/README.md b/1984/laman/README.md index 6c138c1d6..93382da10 100644 --- a/1984/laman/README.md +++ b/1984/laman/README.md @@ -10,17 +10,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1984 laman in bugs.md](/bugs.md#1984-laman). - - ## To use: ```sh diff --git a/1984/laman/laman.c b/1984/laman/laman.c index 758e4480c..eba619be4 100644 --- a/1984/laman/laman.c +++ b/1984/laman/laman.c @@ -1,5 +1,5 @@ a[900]; b;c;d=1 ;e=1;f; g;h;O; main(k, -l)char* *l;{g= atoi(* ++l); for(k= +l)char* *l;{if(k>1) {g=atoi(* ++l); for(k= 0;k*k< g;b=k ++>>1) ;for(h= 0;h*h<= g;++h); --h;c=( (h+=g>h *(h+1)) -1)>>1; while(d <=g){ ++O;for (f=0;f< O&&d<=g @@ -9,4 +9,4 @@ while(d <=g){ ++O;for (f=0;f< O&&d<=g b){if(b 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/1990/westley/README.md b/1990/westley/README.md index c783b3654..fa3733e6b 100644 --- a/1990/westley/README.md +++ b/1990/westley/README.md @@ -15,30 +15,13 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1990 westley in bugs.md](/bugs.md#1990-westley). - - ## To use: ```sh -./westley number +./westley 0. - +The number should be greater than 0. ## Try: diff --git a/1990/westley/westley.c b/1990/westley/westley.c index 70f787618..5362c1eb8 100644 --- a/1990/westley/westley.c +++ b/1990/westley/westley.c @@ -11,6 +11,7 @@ char*lie; dear; (char)lotte--; + if (ly < 2 || atoi(die[1])<1) exit(1); for(get= !me;; not){ 1 - out & out ;lie;{ diff --git a/1991/dds/README.md b/1991/dds/README.md index 311e8ba5f..78c7623aa 100644 --- a/1991/dds/README.md +++ b/1991/dds/README.md @@ -13,17 +13,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: INABIAF - please **DO NOT** fix -STATUS: uses gets() - change to fgets() if possible -``` - -For more detailed information see [1991 dds in bugs.md](/bugs.md#1991-dds). - ## To use: diff --git a/1991/dds/dds.c b/1991/dds/dds.c index f9e5dce46..b313abf71 100644 --- a/1991/dds/dds.c +++ b/1991/dds/dds.c @@ -7,12 +7,13 @@ o)*|gps)<<*txjudi)m*|aQdbtf!::::;sfuvsom,2aP4HC%SD12N1\nJNQm>s\\..q^aHC%NHb%GN1!D32P3%RN1UP1D12JPQUaP1H\ R%PN4\nQaP2Q,2aP4Hb%OD12D12N2!N3\nJVP3Q,,n\ \\(aP3Q(^*m>g\\(aP3Q(^::::aHC%VP3Q>bupj)hfut)c**aHb%JD12JON1!Qjg)a%LN1UP1D12JIQUa\ -P1HL%IQ*m>aN2!N2\nP2QP2Q>aN2\nP2Hbdd!.Xop.fssps!.Xop.sfu\ -vso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d";int k;char R[4][99] -;main(c,v)char**v;{char*p,*r,*q;for(q=s;*q;q++)*q>' '&&(*q)--;{FILE*i=fopen(v -[1],"r"),*o=fopen(q-3,"w");for(p=s;;p++)switch(*p++){B'M':Q(k=fgetc(i))!=EOF -&&k!=*p)*r++=k;if(k==EOF){fputs("}}\n",o);fclose(o);return system(q-69);}*r=0 -B'P':while(*p!='`')fputc(*p++,o)B'O':Q*r)fputc(*r++,o);p--B'C':k=0;Q k<*p-'0' -)(*r++=fgetc(i),k++);*r=0 B'I':k= *p;if(**R==k)goto G B'G':k= *p;G:p=s;while( -*p!='$'||p[1]!= k)p++;p++B'N':R[*p-'0'][0]++;}}} +aP1Q*aHb%FN1\nQm>::::aHC%VP3Q>bupj)ghfut)c-::-tuejo**aHb%JD12JON1!Qjg)a%LN1U\ +P1D12JIQUaP1HL%IQ*m>aN2!N2\nP2QP2Q>aN2\nP2Hbdd!.Xop.fssp\ +s!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!.jodmvef!tuejp/i!b/d"; +int k;char R[4][99];main(c,v)char**v;{char*p,*r,*q;for(q=s;*q;q++)*q>' '&&(* +q)--;{FILE*i=fopen(v[1],"r"),*o=fopen(q-3,"w");if(!i||!o)return 1;for(p=s;;p +++)switch(*p++){B'M':Q(k=fgetc(i))!=EOF&&k!=*p)*r++=k;if(k==EOF){fputs("}}\n" +,o);fclose(o);return system(q-86);}*r=0 B'P':while(*p!='`')fputc(*p++,o)B'O': +Q*r)fputc(*r++,o);p--B'C':k=0;Q k<*p-'0')(*r++=fgetc(i),k++);*r=0 B'I':k= *p; +if(**R==k)goto G B'G':k= *p;G:p=s;while(*p!='$'||p[1]!= k)p++;p++B'N':R[*p-'0' +][0]++;}}} diff --git a/1992/buzzard.1/README.md b/1992/buzzard.1/README.md index 8abd65c2b..5f8ae55d2 100644 --- a/1992/buzzard.1/README.md +++ b/1992/buzzard.1/README.md @@ -1,9 +1,6 @@ # Most Obfuscated Algorithm Sean Barrett\ -Software Construction Company\ -430 Southwest Parkway, #1906\ -College Station, TX 77840\ US @@ -14,17 +11,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1992 buzzard.1 in bugs.md](/bugs.md#1992-buzzard.1). - - ## To use: ```sh diff --git a/1992/buzzard.1/buzzard.1.c b/1992/buzzard.1/buzzard.1.c index 9dfcbf146..bdf9574a6 100644 --- a/1992/buzzard.1/buzzard.1.c +++ b/1992/buzzard.1/buzzard.1.c @@ -1,7 +1,7 @@ #define A(c,a,b) t=b;t+=a;_(c) #define B(b,a) P(u,a)t=0;t-=a;R t+=u;t+=1;t/=2;_(b) #define b(x) x(g) -#define C ;main(argc,argv)char**argv;{for(;!w;){q=0;l +#define C ;main(argc,argv)char**argv;{if(argc<3)exit(1);for(;!w;){q=0;l #define c(y) x #define D(c,a,b) t=a;t/=b;_(c) #define d(x) S(x,x,1) diff --git a/1992/gson/README.md b/1992/gson/README.md index f0445fcc7..571a9ad66 100644 --- a/1992/gson/README.md +++ b/1992/gson/README.md @@ -1,9 +1,6 @@ # Most Humorous Output Andreas Gustafsson\ -Helsinki University of Technology\ -Arentikuja 1 D 305\ -00410 Helsinki\ Finland @@ -69,16 +66,16 @@ The name of the game: AG is short for either Anagram Generator or simply AnaGram. It might also be construed to mean Alphabet Game, and by pure coincidence it happens to be the author's initials. -\ -\ + + ### What it does -\ + AG takes one or more words as arguments, and tries to find anagrams of those words, i.e. words or sentences containing exactly the same letters. ### How to use it -\ + To run AG, you need a dictionary file consisting of distinct words in the natural language of your choice, one word on each line. If your machine doesn't have one already, you can make your own dictionary by concatenating a few @@ -102,7 +99,7 @@ limit can be changed using a numeric command line option, as in `./ag -4 international obfuscated c code contest 64;)putchar(!D+++33^l&1);} +main(l,a)char**a;{pain(l,a,0,0);} diff --git a/1992/westley/westley.c b/1992/westley/westley.c index d9a352b4c..f669a8457 100644 --- a/1992/westley/westley.c +++ b/1992/westley/westley.c @@ -1,7 +1,7 @@ main(l - ,a)char**a;{int n;int - d;for(d=atoi(a[1])/10*80- - atoi(a[2])/5-596;n="@NKA\ + ,a)char**a;{int n;int d; +if (l>2)for(d=atoi(a[1])/10 +*80-atoi(a[2])/5-596;n="@NKA\ CLCCGZAAQBEAADAFaISADJABBA^\ SNLGAQABDAXIMBAACTBATAHDBAN\ ZcEMMCCCCAAhEIJFAEAAABAfHJE\ diff --git a/1993/plummer/README.md b/1993/plummer/README.md index c0a9f3ff0..2ea47e606 100644 --- a/1993/plummer/README.md +++ b/1993/plummer/README.md @@ -13,17 +13,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1993 plummer in bugs.md](/bugs.md#1993-plummer). - - ## To use: ```sh @@ -69,11 +58,6 @@ make clobber CDEFINE="-DZ=50" alt ./plummer.alt xyzzyzzyx 5555 ``` -### INABIAF - it's not a bug it's a feature :-) - -This entry will very likely crash or do something else if you run it without -enough args. - ## Judges' remarks: diff --git a/1993/plummer/plummer.alt.c b/1993/plummer/plummer.alt.c index 6bb7da8ac..e978e9efc 100644 --- a/1993/plummer/plummer.alt.c +++ b/1993/plummer/plummer.alt.c @@ -1 +1 @@ -char*_,*O;main(S,l)char**l;{*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1,usleep(Z);_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);} +char*_,*O;main(S,l)char**l;{if(S<3)exit(1);*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1,usleep(Z);_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);} diff --git a/1993/plummer/plummer.c b/1993/plummer/plummer.c index d0c61daa2..392b62bbb 100644 --- a/1993/plummer/plummer.c +++ b/1993/plummer/plummer.c @@ -1 +1 @@ -char*_,*O;main(S,l)char**l;{*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);} +char*_,*O;main(S,l)char**l;{if(S<3)exit(1);*(O=*(l+++S-1)-1)=13,*l[1]=0;for(;;)for(printf(*l),_=O-1;_>=*l&&++*_>(S+*O+S)*S;*_--=(S+*O)*S);} diff --git a/1994/horton/Makefile b/1994/horton/Makefile index 277c6ef4d..1ec5f9a7b 100644 --- a/1994/horton/Makefile +++ b/1994/horton/Makefile @@ -59,11 +59,11 @@ ARCH= # Defines that are needed to compile # -CDEFINE= +CDEFINE= -DE='exit(1)' -DA=argc # Include files that are needed to compile # -CINCLUDE= +CINCLUDE= -include stdlib.h # Optimization # diff --git a/1994/horton/README.md b/1994/horton/README.md index 9a8b4ef04..d4e7ba0ed 100644 --- a/1994/horton/README.md +++ b/1994/horton/README.md @@ -11,17 +11,6 @@ make all ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [1994 horton in bugs.md](/bugs.md#1994-horton). - - ## To use: ```sh @@ -30,12 +19,6 @@ For more detailed information see [1994 horton in bugs.md](/bugs.md#1994-horton) `A`, `B`, `C` and `D` are numeric arguments. -### INABIAF - it's not a bug it's a feature! :-) - -Running this program without enough args will very likely crash or do something -else. - -## Try: ```sh ./horton 3 2 1 0 diff --git a/1994/horton/horton.c b/1994/horton/horton.c index 5e243facc..7ffae0aad 100644 --- a/1994/horton/horton.c +++ b/1994/horton/horton.c @@ -1,6 +1,6 @@ #define S(r, c) f[r][c] = 1; -char f[96][160]; main(argc, argv) char **argv; { double x, y, atof(); int +char f[96][160]; main(argc, argv) char **argv; {if(A<5)E;double x, y; int r , c , bi , diff --git a/2001/cheong/README.md b/2001/cheong/README.md index 48b019dc1..d2512f4f7 100644 --- a/2001/cheong/README.md +++ b/2001/cheong/README.md @@ -11,28 +11,12 @@ US\ make ``` - -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [2001 cheong in bugs.md](/bugs.md#2001-cheong). - - ## To use: ```sh ./cheong digits ``` -### INABIAF - it's not a bug it's a feature! :-) - -This program will very likely crash or do something different without an arg. - ## Try: diff --git a/2001/cheong/cheong.c b/2001/cheong/cheong.c index 97fef5f18..e229488ba 100644 --- a/2001/cheong/cheong.c +++ b/2001/cheong/cheong.c @@ -11,4 +11,4 @@ c=o+ (D[I]+82)%10-(I>l/2)* :!(o=pain(c/10,O,I-1))*((c+999 )%10-(D[I]+92)%10);}return o;} int main(int o,char **O) { -return pain(o, O, l); } +return o>1?pain(o, O, l):1; } diff --git a/2001/ollinger/ollinger.c b/2001/ollinger/ollinger.c index 318773a22..29d45a4d0 100644 --- a/2001/ollinger/ollinger.c +++ b/2001/ollinger/ollinger.c @@ -11,6 +11,7 @@ char e[]="**3H[`mr25\ int main(int j,char *k[]) { int a,b,c,d,g,h,i=19; + if (j<2)exit(1); printf(" "); for(g=0[f=(char *)calloc(80+(h=atoi(1[k])),1)]=1; g<=h; g++) { if ((g>30)&&(f[i-2]+f[i-1]!=0)) i++; diff --git a/2001/schweikh/README.md b/2001/schweikh/README.md index dbd19f061..af487a8fd 100644 --- a/2001/schweikh/README.md +++ b/2001/schweikh/README.md @@ -16,7 +16,7 @@ make The current status of this entry is: ``` -STATUS: known bug - please help us fix +STATUS: INABIAF - please **DO NOT** fix ``` For more detailed information see [2001 schweikh in bugs.md](/bugs.md#2001-schweikh). diff --git a/2001/schweikh/schweikh.c b/2001/schweikh/schweikh.c index b24af7599..e0dd12282 100644 --- a/2001/schweikh/schweikh.c +++ b/2001/schweikh/schweikh.c @@ -1 +1 @@ -main(int c,char**v){return!m(v[1],v[2]);}m(char*s,char*t){return*t-42?*s?63==*t|*s==*t&&m(s+1,t+1):!*t:m(s,t+1)||*s&&m(s+1,t);} +main(int c,char**v){return c<3?1:!m(v[1],v[2]);}m(char*s,char*t){return*t-42?*s?63==*t|*s==*t&&m(s+1,t+1):!*t:m(s,t+1)||*s&&m(s+1,t);} diff --git a/2006/stewart/README.md b/2006/stewart/README.md index 8154aa3f1..e1a46c56e 100644 --- a/2006/stewart/README.md +++ b/2006/stewart/README.md @@ -10,17 +10,6 @@ make ``` -### Bugs and (Mis)features - -The current status of this entry is: - -``` -STATUS: known bug - please help us fix -``` - -For more detailed information see [2006 stewart in bugs.md](/bugs.md#2006-stewart). - - ## To use: ```sh @@ -48,11 +37,6 @@ where `FILE` is one of: spirals4 squares stars stars2 tree tree2 tree3 tree4 triangle -### INABIAF - it's not a bug it's a feature! :-) - -This program will very likely crash or do something funny if the file does not -exist or cannot be opened. - ## Judges' remarks: Note the interesting choice of using a `#define` in the output. diff --git a/2006/stewart/stewart.c b/2006/stewart/stewart.c index 02103ec9e..8b27aec4b 100644 --- a/2006/stewart/stewart.c +++ b/2006/stewart/stewart.c @@ -20,6 +20,7 @@ int main(int c,char**o) Z(v,6)=(long)malloc(Z(v,0)); memset((void*)Z(v,6),0,Z(v,0)); Z(v,13)=(long)fopen(o[3],"r"); + if(F(v,13)==NULL)P("file doesn't exist\n"), exit(1); fscanf(F(v,13),"%ld",(long*)Y(v,3)); Z(v,8)=(long)malloc(050+Z(v,3)*070); Z(Z(v,8),0)=Z(v,3); diff --git a/bugs.md b/bugs.md index 88adbd033..a8f02e767 100644 --- a/bugs.md +++ b/bugs.md @@ -394,19 +394,15 @@ An example where a crash is not a bug: [2019/endoh](2019/endoh/endoh.c) is supposed to crash. There are others that are also supposed to crash or that are known to segfault but are considered features. -As of 10 April 2023 the definition changed for a second time (the first time was -07 April 2023). If something is noted by the author as a known bug or limitation -it need not be fixed **unless it impacts the usability** of the program or **it removes -instructional value**. An example where a crash undocumented needn't be fixed is -[1984/laman](1984/laman/laman.c). On the other hand the fixes made by [Cody -Boone Ferguson](/winners.html#Cody_Boone_Ferguson) in -[1990/theorem](1990/theorem/theorem.c) were useful. +An important note is that if the README.md of the entry has a bug status that +says it can be fixed it can be. Otherwise it should not be. Nonetheless we challenge you to fix these entries for educational/instructional value and/or enjoyment but we kindly request that you **DO NOT** submit a pull -request! If you can't 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 felt that the fix was tampering with the entry). +request unless it's a bug or (mis)feature we would like you to fix! If you can't +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 +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 compiler, linker or even during runtime, depending on the system. In [some cases @@ -466,24 +462,15 @@ $ ./decot without a newline after the `\`. This is not a bug. -## 1984 laman - -### STATUS: INABIAF - please **DO NOT** fix -### Source code: [1984/laman/laman.c](1984/laman/laman.c) -### Information: [1984/laman/README.md](1984/laman/README.md) - -This entry will very likely crash or do something else if you run it without an -arg. It likely won't do anything at all if the arg is not a positive number. - - ## 1984 mullender ### STATUS: INABIAF - please **DO NOT** fix ### Source code: [1984/mullender/mullender.c](1984/mullender/mullender.c) ### Information: [1984/mullender/README.md](1984/mullender/README.md) -Although there are two alt versions added by Cody that will work in modern -systems, if you do not have a [VAX-11](https://en.wikipedia.org/wiki/VAX-11) or +Although there is an alt version and supplementary program added by Cody that +will work in modern systems, if you do not have a +[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 will not work. See the README.md for details on the alternate versions. @@ -579,9 +566,24 @@ It should be noted that in additional to rot13 names there is code that is the reverse of other code (also wrt names). See the source file and the README.md (in the author's remarks) for more details. -Fixing the (Mis)feature is likely to be a difficult challenge. -You are welcome to try and fix it if you can! +Fixing the (Mis)feature is likely to be a very difficult challenge. You are +welcome to try and fix it if you can! +### A tip from Cody: + +The reason this is crashing is that the array `irk` is being accessed way out of +bounds by the int `gnat`. For instance: + +``` +Program terminated with signal SIGSEGV, Segmentation fault. +#0 0x0000000000401335 in main (ABBA@entry=, tang@entry=, gnat@entry=, Near@entry=) + at ver2.c:23 +23 &&gnat!({)Near,noon,/*krelc*/)<0&&(Near= - irk[-gnat--]-2)))&&main(ABBA, +(gdb) p gnat +$1 = -518733305 +``` + +The real trouble is that the code is generated and in a complex way. # 1990 @@ -592,46 +594,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 @@ -647,43 +614,11 @@ will enter an infinite loop, printing 0 over and over again; another condition where this occurred was fixed but this one should not be fixed. Thank you. -## 1990 westley - -### STATUS: known bug - please help us fix -### Source code: [1990/westley/westley.c](1990/westley/westley.c) -### Information: [1990/westley/README.md](1990/westley/README.md) - -This entry will very likely crash or do something strange without an arg. - -This entry will also enter an infinite loop if input is not a number > 0. - -If you want to try and fix this (mis)feature, you are welcome to try. - - # 1991 ## 1991 dds -### STATUS: INABIAF - please **DO NOT** fix -### Source code: [1991/dds/dds.c](1991/dds/dds.c) -### Information: [1991/dds/README.md](1991/dds/README.md) - -If the BASIC file cannot be opened for reading or the output file cannot be -opened for writing the program will very likely crash or do something funny. -This is not a bug but a feature. Please do not fix this except for the -challenge to yourself. - -### STATUS: uses gets() - change to fgets() if possible - -That being said the compiled code uses `gets()` not `fgets()`. Can you fix this? -It's quite complicated to do: the `s` array is certainly relevant and you can -see a bit of the magic in the [thanks](/thanks-for-fixes.md) and the README.md -file for how it works. It's easy enough to get the code to refer to `fgets()` -and call it correctly but it might take more work to get the generated code -sorted. This will be looked at later. - - ## 1991 westley ### STATUS: INABIAF - please **DO NOT** fix @@ -695,22 +630,12 @@ someone called Cody's late grandmother said to him: 'it's not cheating unless you're caught'. :-) Please don't try and fix it as it's not a bug and was actually documented as a -possibility. Can you find out how? - +possibility. Can you find out how? There's also a way to make it so that even +when you're cheating it ends up winning! Can you figure that out as well? # 1992 -## 1992 buzzard.1 - -### STATUS: known bug - please help us fix -### Source code: [1992/buzzard.1/buzzard.1.c](1992/buzzard.1/buzzard.1.c) -### Information: [1992/buzzard.1/README.md](1992/buzzard.1/README.md) - -This entry will crash without enough args (2). - -If you want to try and fix this (mis)feature, you are welcome to try. - ## 1992 kivinen @@ -798,38 +723,19 @@ lush.c:40:9: note: previous definition is here As you might see the part under the `warning:` line is different. +The entry is supposed to show warnings and then print: + +``` +Hello World. +``` + Can you help us? -## 1992 westley - -### STATUS: INABIAF - please **DO NOT** fix -### Source code: [1992/westley/westley.c](1992/westley/westley.c) -### Information: [1992/westley/README.md](1992/westley/README.md) - -This program and the alternate version will very likely crash or -[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire -world](https://en.wikipedia.org/wiki/Earth) or just the -[USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough -args. And not that we need any help with this or anything :-) but we do -encourage you to test it. This should not be fixed. - # 1993 -## 1993 plummber - -### STATUS: known bug - please help us fix -### Source code: [1993/plummer/plummer.c](1993/plummer/plummer.c) -### Information: [1993/plummer/README.md](1993/plummer/README.md) - -If not enough args are specified this program will likely crash or do something -else. - -If you want to try and fix this (mis)feature, you are welcome to try. - - ## 1993 lmfjyh ### STATUS: INABIAF - please **DO NOT** fix @@ -845,18 +751,6 @@ An alternate version, however, does exist. See the README.md file for details. # 1994 -## 1994 horton - -### STATUS: known bug - please help us fix -### Source code: [1994/horton/horton.c](1994/horton/horton.c) -### Information: [1994/horton/README.md](1994/horton/README.md) - -If not enough args are specified this program will likely crash or do something -else. - -If you want to try and fix this (mis)feature, you are welcome to try. - - ## 1994 ldb ### STATUS: INABIAF - please **DO NOT** fix @@ -1275,17 +1169,6 @@ and it can be run by itself for fun in modern systems, which was not possible before the fixes there. -## 2001 cheong - -### STATUS: known bug - please help us fix -### Source code: [2001/cheong/cheong.c](2001/cheong/cheong.c) -### Information: [2001/cheong/README.md](2001/cheong/README.md) - -This program will very likely crash or do something different without an arg. - -If you want to try and fix this (mis)feature, you are welcome to try. - - ## 2001 dgbeards ### STATUS: INABIAF - please **DO NOT** fix @@ -1346,31 +1229,16 @@ set. In other words both have to be ASCII or EBCDIC - not one of each. ## 2001 ollinger -### STATUS: known bug - please help us fix -### Source code: [2001/ollinger/ollinger.c](2001/ollinger/ollinger.c) -### Information: [2001/ollinger/README.md](2001/ollinger/README.md0 -This program will very likely crash or do something else without an arg. - -If you want to try and fix this (mis)feature, you are welcome to try. - - -## 2001 schweikh - -### STATUS: known bug - please help us fix +### STATUS: INABIAF - please **DO NOT** fix ### Source code: [2001/schweikh/schweikh.c](2001/schweikh/schweikh.c) ### Information: [2001/schweikh/README.md](2001/schweikh/README.md) -This program will very likely crash or do something else if you do not give it -two args. - -Note also that the glob pattern must match the whole string. See the author's -comments for details and a workaround. +The glob pattern must match the whole string. See the author's comments for +details and a workaround. There's also no way to escape meta characters. -If you want to try and fix this (mis)feature, you are welcome to try. - # 2002 @@ -1582,18 +1450,6 @@ Fixing the (Mis)feature is likely to be a difficult challenge. You are welcome to try and fix it if you can! -## 2006 stewart - -### STATUS: known bug - please help us fix -### Source code: [2006/stewart/stewart.c](2006/stewart/stewart.c) -### Information: [2006/stewart/README.md](2006/stewart/README.md) - -This program will very likely crash or do something funny if the file does not -exist or cannot be opened. - -If you want to try and fix this (mis)feature, you are welcome to try. - - ## 2006 toledo2 ### STATUS: INABIAF - please **DO NOT** fix diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index dcbea0674..814fbedbb 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -21,9 +21,9 @@ CHALLENGING bug fixes** like (all **EXTREMELY CHALLENGING**), fixing entries to work with clang (some being **EXTREMELY CHALLENGING** like [1991/dds](/thanks-for-fixes.md#1991dds-readmemd)) or as much as possible (like -[1989/westley](/thanks-for-fixes.md#1989westley-readmemd) which is **INCREDIBLY -HARD, _MUCH, MUCH MORE SO_ than any other fix!**), porting entries to macOS (some being -**EXTREMELY CHALLENGING** like +[1989/westley](/thanks-for-fixes.md#1989westley-readmemd), a true masterpiece +that is **INCREDIBLY HARD, _MUCH, MUCH MORE SO_ than any other fix!**), porting +entries to macOS (some being **EXTREMELY CHALLENGING** like [1998/schweikh1](/thanks-for-fixes.md#1998schweikh1-readmemd)), fixing code like [2001/herrmann2](/thanks-for-fixes.md#2001herrmann2-readmemd) to work in both 32-bit/64-bit which *can be* **EXTREMELY CHALLENGING**, providing alternate code @@ -180,6 +180,15 @@ To see the difference from start to fixed: cd 1984/decot ; make diff_orig_prog ``` +## [1984/laman](1984/laman/laman.c) ([README.md](1984/laman/README.md])) + +Cody fixed this to not crash when no arg is specified. Note that if the arg is +not a positive number it will not do anything useful or anything at all. + +This was fixed on 30 October 2023 after the bug status was changed from INABIAF +(it's not a bug it's a feature) to bug. + + ## [1984/mullender](1984/mullender/mullender.c) ([README.md](1984/mullender/README.md])) Cody provided an [alternate version](1984/mullender/mullender.alt.c), an @@ -924,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. @@ -1006,6 +1021,11 @@ was changed to just `1`. Since it's instructional to see the differences he has provided an alternate version, [westley.alt.c](1990/westley/westley.alt.c), which is the original code. +He also fixed the code to not enter an infinite loop if arg is a number not > 0 +and to not crash if no arg is specified. + +The alt code did NOT have arg checks added as it is actually a copy of the +original code. ## [1991/brnstnd](1991/brnstnd/brnstnd.c) ([README.md](1991/brnstnd/README.md])) @@ -1023,10 +1043,17 @@ slightly more like the original, even though it's unused. ## [1991/dds](1991/dds/dds.c) ([README.md](1991/dds/README.md])) Cody fixed a segfault that prevented this entry from working in any condition -and he also made it work for clang. Clang (at least in some systems?) defaults -to having `-Werror` and the code that the entry generates had some warnings -that were causing compilation to fail as it just ran `cc a.c`. It ran it by what -was once `system(q-6);` but with clang this was not enough.. +and he also made it work for clang. He also added checks for NULL `FILE *`s. +Furthermore he changed it so that the C from the BASIC uses `fgets()`, not +`gets()`. For the magic of clang and `fgets()` see below. + +Clang (at least in some systems?) defaults to having `-Werror` and the code that +the entry generates had some warnings that were causing compilation to fail as +it just ran `cc a.c`. It ran it by what was once `system(q-6);` but with clang +this was not enough. + +(Cody stupidly did the below manually until he thought to write a simple program +to do the conversions which he used for `gets()` to `fgets()`.) The following had to be added to the string `s` (which to fix the segfault was changed from `char*s` to `char s[]`): @@ -1054,10 +1081,58 @@ string. Thus the end of the string actually looks like: !.Xop.fssps!.Xop.sfuvso.uzqf!.Xop.jnqmjdju.gvodujpo.efdmbsbujpo!b/d ``` -With these changes in place it will compile and work with both gcc and clang. +But then there is the matter of getting the C to use `fgets()`. As can be seen +above it's not as simple as changing `gets()` to `fgets()`. This was more magic +characters that had to be updated and some added. The C code: + +```c +atoi(gets(b)) +``` + +is in the string: + +``` +bupj)hfut)c** +``` + +which was changed to be (in C): + +```c +atoi(fgets(b,99,stdin)) +``` + +which in the program is: + +``` +bupj)ghfut)c-::-tuejo** +``` + +That's fine and well but since the code does not include `stdio.h` there +obviously would be a compilation error. Thus the compiler line had to updated to +have `-include stdio.h` which in this rotated string is: + +``` +.jodmvef!tuejp/i +``` + +which had to be added after: + +``` +efdmbsbujpo! +``` + +which is the end of the warning disabled for clang as described above. + +But now the `system(q-69);` had to be changed to `system(q-86);`. + +With these changes in place it will compile and work with both gcc and clang and +the C code generated will use `fgets()`, not `gets()`, therefore removing the +annoying warnings. Note that the array passed to `fgets()` is an int but that +was the same for `gets()` and is not necessary to update to a `char[]`. + The key to the string is that it rotates the character by `+1`. This was not immediately clear until reading the author's remarks so there was an alt version -that was something of a kludge, running `make a` instead. +that was something of a kludge, running `make a` instead but that was removed. Cody also fixed a typo in LANDER.BAS. @@ -1122,6 +1197,10 @@ one must keep the `Y[strlen(Y)-1]='\0';` part and keep it there. This is a complex change due to the way the program and Makefile generate additional tools. +## [1992/buzzard.1](1992/buzzard.1/buzzard.1.c) ([README.md](1992/buzzard.1/README.md)) + +Cody added a check for the right number of args, exiting 1 if not enough (2) +used. ## [1992/gson](1992/gson/gson.c) ([README.md](1992/gson/README.md])) @@ -1131,7 +1210,7 @@ from stdin after starting the program). Ideally `fgets()` would be used but this is a more problematic. Previously it had a buffer size of 256 which could easily overflow. In this entry `gets()` is used in a more complicated way: first `m` is set to `*++p` in a for loop where `p` is argv. Later `m` is set to -point to `h` which was of size \256. `gets()` is called as `m = gets(m)`) but +point to `h` which was of size 256. `gets()` is called as `m = gets(m)`) but trying to change it to use `fgets()` proved more a problem. Since the input must come from the command line Cody changed the buffer size to `ARG_MAX+1` which should be enough (again theoretically) especially since the command expects @@ -1139,6 +1218,9 @@ redirecting a dictionary file as part of the command line. This also makes it possible for longer strings to be read (in case the `gets()` was not used in a loop). +Cody also added the [mkdict.sh](1992/gson/mkdict.sh) script that the author +included in their remarks. See the README.md for its purpose. It was NOT fixed +for ShellCheck because the author deliberately obfuscated it. ## [1992/kivinen](1992/kivinen/kivinen.c) ([README.md](1992/kivinen/README.md])) @@ -1197,15 +1279,18 @@ Cody fixed this to work for clang by changing the third and fourth arg of **` and some versions do not even allow a fourth arg. He also added the alternate version that the author gave in the remarks that is -specifically for the USA rather than the world. +specifically for the USA rather than the world. This had to be fixed for clang +as well to make the args of `main()` be the correct type and by moving the body +of main() to another function, `pain()`, which does the work since not all +versions of clang support four args to `main()`. -NOTE: as noted in the README.md file and the [bugs.md](/bugs.md), this program and the -[alternate version](1992/westley/westley.alt.c) will very likely crash or -[nuke](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire +Cody also added an arg check because the program and the +[alternate version](1992/westley/westley.alt.c) might have crashed or +[nuked](https://en.wikipedia.org/wiki/Nuclear_weapon) the [entire world](https://en.wikipedia.org/wiki/Earth) or just the [USA](https://en.wikipedia.org/wiki/United_States), respectively, without enough -args (2). And not that we need the help or anything for this :-) but we do -encourage you to test this :-) This should NOT be fixed. +args (2). And not that we need the help or anything for this :-) but we +encourage you to try the original :-) ## [1993/jonth](1993/jonth/jonth.c) ([README.md](1993/jonth/README.md])) @@ -1239,9 +1324,11 @@ this was made the alternate version, not the actual entry. ## [1993/plummer](1993/plummer/plummer.c) ([README.md](1993/plummer/README.md])) -Cody added an [alternate version](1993/plummer/plummer.alt.c) which uses -`usleep()` so you can see what is happening with faster systems. See the -README.md files for details. +Cody added check for two args. + +Cody also added an [alternate version](1993/plummer/plummer.alt.c) which uses +`usleep()` so you can see what is happening with faster systems. This version +also checks for two args. See the README.md files for details. ## [1993/rince](1993/rince/rince.c) ([README.md](1993/rince/README.md])) @@ -1277,6 +1364,12 @@ arg (as it was 0 at file scope already this is perfectly fine and it means there's no need to cast it to an int in the function call though that would also work). +## [1994/horton](1994/horton/horton.c) ([README.md](1994/horton/README.md)) + +Cody fixed this to check that four args were specified. With the use of the C +pre-processor macro and inclusion of stdlib.h in the Makefile the layout of the +source is exactly the same column width and no additional lines were added. + ## [1994/ldb](1994/ldb/ldb.c) ([README.md](1994/ldb/README.md])) @@ -1739,6 +1832,7 @@ letter word that would match the format and because it's pain that clang forces this. :-) This fix makes a point of the author's notes on portability no longer valid, btw. +He also fixed it to check the number of args. ## [2001/coupard](2001/coupard/coupard.c) ([README.md](2001/coupard/README.md])) @@ -1818,6 +1912,16 @@ the paddles move even when holding down the movement keys. Cody also provided an alternate version which lets you use the arrow keys on your keyboard instead of the more awkward '`,`' and '`.`'. +## [2001/ollinger](2001/ollinger/ollinger.c) ([README.md](2001/ollinger/README.md)) + +Cody fixed to not crash if not enough args, exiting 1 instead. + +## [2001/schweikh](2001/schweikh/schweikh.c) ([README.md](2001/schweikh/README.md])) + +Cody fixed this to not crash if not enough args as this was not documented by +the author. The other problems are documented so were not fixed. See +README.md for details. + ## [2001/westley](2001/westley/westley.c) ([README.md](2001/westley/README.md])) @@ -2142,6 +2246,11 @@ Since the author suggested that the lack of certain `#include`s might break the program in some systems he added `-include ...` to the Makefile as well. +## [2006/stewart](2006/stewart/stewart.c) ([README.md](2006/stewart/README.md])) + +Cody fixed it so that if the file cannot be opened it exits rather than trying +to read from the file. + ## [2006/toledo2](2006/toledo2/toledo2.c) ([README.md](2006/toledo2/README.md])) Cody fixed a segfault in this program which was making it fail to work under