From 5e2d3e6bf14147838ad2f7e8e7529484b4d63ddf Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 5 Apr 2023 05:47:00 -0700 Subject: [PATCH] Fix 1988/dale to no longer need -traditional-cpp There were a couple problems to resolve. First #define a(x)get/***/x/***/id()) p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l); ... case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++; does not work to create getuid() and getgid(). The second is that for/*/(;;);/*/k()){O/*/*/c); cannot form 'fork())' in modern C compilers. What is quite fun is that the cpp can! Removed this entry from bugs.md. --- 1988/dale/Makefile | 2 +- 1988/dale/README.md | 57 ++++++++++++++++++++++++++++++++++----------- 1988/dale/dale.c | 6 ++--- bugs.md | 8 ------- 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/1988/dale/Makefile b/1988/dale/Makefile index d12900581..016c4f16f 100644 --- a/1988/dale/Makefile +++ b/1988/dale/Makefile @@ -117,7 +117,7 @@ ALT_TARGET= # FORCE use of -traditional-cpp # -CFLAGS+= -traditional-cpp +#CFLAGS+= -traditional-cpp ################# # build the entry diff --git a/1988/dale/README.md b/1988/dale/README.md index 0d2e55640..790d04bf9 100644 --- a/1988/dale/README.md +++ b/1988/dale/README.md @@ -1,28 +1,57 @@ ## Best abuse of system calls - Paul Dale - University of Queensland - Computer Science Dept - Dept of Computer Science - Uni of Qld, 4067 - Australia +Paul Dale +University of Queensland +Computer Science Dept +Dept of Computer Science +Uni of Qld, 4067 +Australia ## To build: - make all +```sh +make all +``` [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this for modern -systems. Modern compilers do not allow directives like: +compilers. There were two problems to address. One was that the entry required +`-traditional-cpp` which it no longer does. It needed this because of two things +it did: - #define _ define - -#_ foo bar +```c +#define a(x)get/***/x/***/id()) + +p Z=chroot("/");L(!a(u)execv((q(v="/ipu6ljov"),v),C);Z-=kill(l); + +... + +case_2:L(!--V){O/*/*/c*c+c);wait(A+c*c-c);L(!Z)f(A,"\n",c);return(A*getgid());};C++; +``` + +does not work to create `getuid()` and `getgid()`. The second is that + + for/*/(;;);/*/k()){O/*/*/c); + +cannot form 'fork())' in modern C compilers. What is quite fun is that the cpp +can! + +The other problem was that modern compilers do not allow directives like: + +```c +#define _ define ++#_ P char ++#_ p int ++#_ O close( +... +``` so Cody changed the lines to be in the form of: - #define foo bar +```c +#define foo bar +``` -Even so this entry requires a compiler that supports the `-traditional-cpp` -option. Thank you Cody for your assistance! +Thank you Cody for your assistance! ## Try: @@ -31,6 +60,8 @@ option. Thank you Cody for your assistance! ./dale hello world ./dale these files are in this directory: * +NOTE: in linux it might happen that core dumps are created when running this +entry even though it works fine. ## Judges' comments diff --git a/1988/dale/dale.c b/1988/dale/dale.c index 2931f7cad..ddbf54a02 100644 --- a/1988/dale/dale.c +++ b/1988/dale/dale.c @@ -14,12 +14,12 @@ #define a(x)get/***/x/***/id()) P z[l<<(1<