processed John Dalbec's fix of 2000/dlowe
Updated `bugs.html` to reflect the fix of all known bugs in `2000/dlowe`. Added thank you to John Dalbec in `thanks-for-help.md`. Added processing of "%%REPO_TOP_URL%%" tokens to `bin/subst.default.sh`. Updated `find-missing-links.sh` to not falsely report missing links when a "%%REPO_TOP_URL%%" token is used. Changed `bin/subst.default.sh` VERSION from "1.3.2 2024-08-05" to "1.4.0 2025-04-16". Changed `bin/find-missing-links.sh` VERSION from "1.1.1 2024-04-28" to "1.2.0 2025-04-16". Due to a `pandoc(1)` bug fix, `2011/fredriksson/index.html` and `2012/kang/index.html` were modified. The bug fix removed extraneous whitespace that was previously introduced into HTML under certain situations. These 2 changes do **NOT** impact the way web browsers render these pages, however. Updated sitemap. Tested the above via `make www gen_status gen_sitemap timestamp` on macOS.
This commit is contained in:
1 parent
d644602053
commit
54fdd0f39c
11 files changed
+478
-834
No files matched your search
@@ -2066,212 +2066,6 @@ Jump to: [top](#)
|
||||
|
||||
Jump to: [top](#)
|
||||
|
||||
### STATUS: known bug - please help us fix
|
||||
### Source code: [2000/dlowe/dlowe.c](%%REPO_URL%%/2000/dlowe/dlowe.c)
|
||||
### Information: [2000/dlowe/index.html](2000/dlowe/index.html)
|
||||
|
||||
The author gives an example command:
|
||||
|
||||
``` <!---sh-->
|
||||
echo "7 P 6 d P P 8 p" | ./dlowe | tr 876 tpo
|
||||
```
|
||||
|
||||
which should print out `poot` but it doesn't, not in linux and not in macOS.
|
||||
|
||||
In linux it doesn't crash but it doesn't print anything out either.
|
||||
|
||||
In macOS it crashes; it might appear to not crash in macOS but this is because
|
||||
of the pipeline. If you remove the `| tr 876 tpo` part of the command you will
|
||||
see that it does indeed crash!
|
||||
|
||||
The reason for this not working is really strange.
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo "7 P 6 d P P 8 p" | ./dlowe
|
||||
7668
|
||||
$ echo "7 P 6 d P P 8 p" | ./dlowe | grep 7
|
||||
$
|
||||
```
|
||||
|
||||
Why? Is it writing to stdout? Let's try some other things:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo 7668 | tr 876 tpo
|
||||
poot
|
||||
```
|
||||
|
||||
Okay so we know that it SHOULD work. But we also know something funny is going on with stdout and the entry. Another experiment:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo "7 P 6 d P P 8 p" | ./dlowe 1>&2 | grep 7
|
||||
7668
|
||||
```
|
||||
|
||||
Okay so now it sees it, `grep`. But watch!
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo "7 P 6 d P P 8 p" | ./dlowe 2>foo 1>&1
|
||||
7668
|
||||
$ cat foo
|
||||
```
|
||||
|
||||
.. so it does appear to be writing to stdout but yet somehow it doesn't? But watch:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo "7 P 6 d P P 8 p" | ./dlowe 1>foo 1>&1
|
||||
$ cat foo
|
||||
$
|
||||
```
|
||||
|
||||
Well this explains why the `tr` does not transliterate it to `poot` but why is
|
||||
this happening? Why can't it be redirected to another file even?
|
||||
|
||||
If it could be figured out why it's not writing to stdout and yet at the same
|
||||
time is writing to stdout one bug could be fixed. Maybe it's the perl messing
|
||||
with things but we don't know.
|
||||
|
||||
|
||||
Other commands do work, however, and give the appropriate output, such as:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo 1 2 + p | ./dlowe
|
||||
3
|
||||
```
|
||||
|
||||
so something is wrong with some commands/operators.
|
||||
|
||||
Another feature that does work in linux is:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo poot | ./dlowe
|
||||
poot was here!
|
||||
```
|
||||
|
||||
Can you help fix these problems?
|
||||
|
||||
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
|
||||
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
|
||||
well. A note below might suggest that doing this creates incomplete perl.
|
||||
Anyway:
|
||||
|
||||
``` <!---c-->
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
printf("#!/usr/bin/env perl\nuse warnings;_:$_= <> ; defined or exit; @ARGV"
|
||||
"=split; __:$_= shift;defined or goto _; chomp "
|
||||
";(m*^\\x70oO" "\\x74$*i)?(pri" "nt \"$_ w\\x"
|
||||
"61s h\\145r\\x" "65!\\n\"):((m*" "^\\s\\*(-?\\d+"
|
||||
"(\\.\\d+)?)\\s" "\\*$*)?(push@SS ,$1):(&{chr(((o"
|
||||
"rd)%%39)+3**4)x2 } )); goto __; sub ff { @SS= ("
|
||||
")} sub __{print \"stack empty\\" "n\"} sub ss{$#"
|
||||
"SS<0 and goto & __; print $SS[$" "#SS].\"\\n\"} "
|
||||
"sub SS{ $#SS<0 and goto &__ ; print pop @SS}"
|
||||
"sub _ { print \"divide by zer" "o\\n\"}sub ii{"
|
||||
"map{ print\"$_" "\\n\" } reverse @SS} sub AUTOLO"
|
||||
"AD { print\"un" "implemented\\n" "\"} sub gg{ $#"
|
||||
"SS<0 and goto &__;push@SS,$SS[ $#SS]} sub uu{ "
|
||||
"$#SS<1 and goto &__;$SS[ $#SS]+= $SS[$#SS-1];$SS"
|
||||
"[$#SS-1]=$SS[$" "#SS]-$SS[$#SS-" "1]; $SS[$#SS]-"
|
||||
"=$SS[$#SS-1]}");
|
||||
}
|
||||
```
|
||||
|
||||
Compiling this you can generate:
|
||||
|
||||
|
||||
``` <!---perl-->
|
||||
#!/usr/bin/env perl
|
||||
use warnings;_:$_= <> ; defined or exit; @ARGV=split; __:$_= shift;defined or goto _; chomp ;(m*^\x70oO\x74$*i)?(print "$_ w\x61s h\145r\x65!\n"):((m*^\s\*(-?\d+(\.\d+)?)\s\*$*)?(push@SS ,$1):(&{chr(((ord)%39)+3**4)x2 } )); goto __; sub ff { @SS= ()} sub __{print "stack empty\n"} sub ss{$#SS<0 and goto & __; print $SS[$#SS]."\n"} sub SS{ $#SS<0 and goto &__ ; print pop @SS}sub _ { print "divide by zero\n"}sub ii{map{ print"$_\n" } reverse @SS} sub AUTOLOAD { print"unimplemented\n"} sub gg{ $#SS<0 and goto &__;push@SS,$SS[ $#SS]} sub uu{ $#SS<1 and goto &__;$SS[ $#SS]+= $SS[$#SS-1];$SS[$#SS-1]=$SS[$#SS]-$SS[$#SS-1]; $SS[$#SS]-=$SS[$#SS-1]}
|
||||
```
|
||||
|
||||
Here is example input/output:
|
||||
|
||||
```
|
||||
p
|
||||
stack empty
|
||||
5 p
|
||||
5
|
||||
5 + 5 p
|
||||
unimplemented
|
||||
5
|
||||
P
|
||||
5
|
||||
p
|
||||
5
|
||||
```
|
||||
|
||||
So you can see that if one uses operators it just shows 'unimplemented' (observe
|
||||
how this does not happen in the C program in linux!) but if one uses 'p' by
|
||||
itself it will print what's on the stack (for example).
|
||||
|
||||
To not get 'unimplemented' you can remove from the perl:
|
||||
|
||||
|
||||
``` <!---perl-->
|
||||
sub AUTOLOAD { print"unimplemented\n"}
|
||||
```
|
||||
|
||||
(Note that the author stated this was used for exception handling so another
|
||||
possibility is that the C code doesn't generate the correct perl and indeed even
|
||||
spaces is known to break the perl in at least one way, syntax errors, but maybe
|
||||
others too.)
|
||||
|
||||
Here is an example run of several operations in the perl script after removing
|
||||
that subroutine:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo 5 5 p | ./dlowe.pl
|
||||
5
|
||||
$ echo 5 5 + p | ./dlowe.pl
|
||||
5
|
||||
Undefined subroutine &main::UU called at ./pl.pl line 2, <> line 1.
|
||||
$ echo 5 5 * p | ./dlowe.pl
|
||||
5
|
||||
Undefined subroutine &main::ww called at ./pl.pl line 2, <> line 1.
|
||||
$ echo 5 5 - p | ./dlowe.pl
|
||||
5
|
||||
Undefined subroutine &main::WW called at ./pl.pl line 2, <> line 1.
|
||||
$ echo 5 5 / p | ./dlowe.pl
|
||||
5
|
||||
Undefined subroutine &main::YY called at ./pl.pl line 2, <> line 1.
|
||||
$ echo 5 P | ./dlowe.pl
|
||||
5$ echo p | ./dlowe.pl
|
||||
stack empty
|
||||
$ echo P | ./dlowe.pl
|
||||
stack empty
|
||||
```
|
||||
|
||||
Note the undefined subroutine error: that happens with commands that are not
|
||||
even in the program. Again the author used `AUTOLOAD` for exception handling so
|
||||
it seems likely that there is something missing (which the below shows as well).
|
||||
For instance inputting `D` followed by `XX`:
|
||||
|
||||
```
|
||||
Undefined subroutine &main::nn called at ./pl.pl line 2, <> line 6.
|
||||
Undefined subroutine &main::[[ called at ./pl.pl line 2, <> line 1.
|
||||
```
|
||||
|
||||
That means then that in linux despite the subroutines seemingly not existing it
|
||||
works in the code, at least in some cases.
|
||||
|
||||
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 given, the input is not
|
||||
actually incorrect. It is also curious to note that it ends up printing what's
|
||||
on the stack at that point:
|
||||
|
||||
``` <!---sh-->
|
||||
$ echo 5 5 + p | ./dlowe.pl
|
||||
unimplemented
|
||||
5
|
||||
```
|
||||
|
||||
which might (?) suggest that the `+` operator is unimplemented.
|
||||
|
||||
Jump to: [top](#)
|
||||
|
||||
### 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
|
||||
|
||||
Reference in new issue
Block a user