1,119 karma · joined January 8, 2014
If you put the pid in the high bits of every pointer you run into problems when you want to support fork(). The child gets a new pid but keeps all the same pointers as its parent.
And that only protects you against one process trying to read/write another process's memory. We already have good support for this type of protection on current hardware/OSes. What is desired is something that prevents a process from reading/writing its own memory, through an out of bounds pointer. This would prevent buffer overflows, stash smashing, etc. and be a good defense against RCE.
$ mkfifo myfifo
$ while true; do sed -rune 's/^Dev server started on port (.*)/\1/p' myfifo | xargs -n1 -I{} echo "Execute other command here with argument {}"; done
In the other terminal, run your server and tee the output to the fifo you just created: $ start_server | tee myfifo news.ycombinator.com##tr.athing:has(a[href*="medium.com"])
news.ycombinator.com##tr.athing:has(a[href*="medium.com"]) + tr
news.ycombinator.com##tr.athing:has(a[href*="medium.com"]) + tr + tr.spacer
If somebody can improve this, please share. $ host sayr.us
sayr.us is an alias for sinkhole.paloaltonetworks.com.
sinkhole.paloaltonetworks.com has address 72.5.65.111 testl %ebx, %ebx # Set zero flag if %ebx is zero
movl $0, %eax # Set %eax to zero
jz somewhere # Jump if %ebx was zero
then after optimization you get this: testl %ebx, %ebx # Set zero flag if %ebx is zero
xorl %eax, %eax # Set %eax to zero *and set zero flag*
jz somewhere # Jump always
Maybe this is OK because TCC doesn't (currently) generate any code like this. $ touch empty
$ chmod a+x empty
$ ./empty # Works
$ valgrind -q ./empty # Works
$ timeout 10s ./empty # Works
$ /usr/bin/time ./empty # Works
$ perl -e 'exec("./empty") or die' # Works
$ python -c 'import subprocess; subprocess.check_call("./empty", shell=True)' # Works
$ python -c 'import subprocess; subprocess.check_call("./empty")' # Fails
...
OSError: [Errno 8] Exec format error
$ ruby -e 'exec "./empty"' # Fails
-e:1:in `exec': Exec format error - ./empty (Errno::ENOEXEC)
from -e:1
$ strace ./empty # Fails
execve("./empty", ["./empty"], 0x7fff6639f3a0 /* 84 vars */) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++
It can be quite fun to track down why a program executes successfully and then later fails to execute, with no changes made to the program in between.The article says:
> Enabling this option changes the shell’s behavior so that, when any command in a pipeline series fails, the entire pipeline stops processing.
This is not true! The entire pipeline runs to completion just as it normally would. The only thing that is affected is the exit status of the pipeline as seen by the shell.
You can see this by running something like `(set -o pipefail; false | sleep 10)` and see that it still takes 10 seconds to complete even those the `false` command exits with an error immediately.
Even after turning on the pipefail option, running a command like `false | dosctl set template_vars -` will still set template_vars to the empty string.
As pointed out by minitech, this syntax was allowed in some versions of Python 3 but that was a bug which has since been fixed. I didn't run into this bug in the version of Python 3 that I used for testing so I had no idea of the bug's existence.
> I doubt the veracity of the other examples
Python 3.10: https://godbolt.org/z/Po7K7cvY8 Ruby 3.0.2: https://godbolt.org/z/Ke5oWzaW3 C++ (clang 13.0.0): https://godbolt.org/z/zd5MfM4Mo Go (amd64 gc 1.17): https://godbolt.org/z/KrEsKaTjq Lua (luac 5.3.3): https://ideone.com/irl89j Perl (perl 2018.12): https://ideone.com/YZcCAC
> Honest question, are you aware of the comma operator and how it works?
I am. The existence of the comma operator is the reason that `console.log((a, b))` parses (and means something different than `console.log(a, b)`). If we consider a hypothetical version of JavaScript which does not have the comma operator then `console.log((a, b))` wouldn't parse at all! The comma there can't be the comma operator because we've removed that. And it can't be part of the function call because then the first argument to the function call would have to be `(a` which is obviously not a valid expression. And it can't be part of an array literal or an object literal because it isn't inside of `[]` or `{}`. That leaves us with no valid ways for this to parse.
You can usually add extra parentheses around any expression without changing the meaning. But "all the arguments to a function" is *not* an expression (except in the case where there happens to be exactly one argument). This is why it doesn't make sense to change `console.log(a, b)` into `console.log((a, b))`, why it doesn't make sense to change `console.log()` into `console.log(())`, and why it doesn't make sense to change `console.log(...a)` into `console.log((...a))`.
Let's test that out.
Python 3 doesn't like extra parentheses:
a = ['hello', 'world']
print(*a) # OK
print((*a)) # ERROR
Ruby doesn't like extra parentheses: a = ['hello', 'world']
puts(*a) # OK
puts((*a)) # ERROR
C++ doesn't have a splat for C-style varargs functions but it does have one for template parameter packs and it doesn't like extra parentheses: template <typename ...Args>
void g(Args... x) {
f(x...); // OK
f((x...)); // ERROR
}
Go doesn't like extra parentheses: package main
import "fmt"
func main() {
a := []interface{}{"hello", "world"}
fmt.Println(a...) // OK
fmt.Println((a...)) // ERROR
}
Lua doesn't like extra parentheses: a = {"hello", "world"};
print(table.unpack(a)); -- OK
print((table.unpack(a))); -- Only prints "hello"
Perl does like extra parentheses (but then again it doesn't really have a special "splat" syntax and just flattens all lists everywhere): my @a = ("hello", "world");
print(@a); # OK
print((@a)); # OK
You seem to want `...` to behave as an operator, but it really can't since it doesn't produce a value. If you think it *should* produce a value you then have to decide what the type of that value should be and there doesn't seem to be a good answer for that. I mean, should this be allowed? let a = ['hello', 'world'];
let b = (...a); // What should the type of `b` be?
// Somehow equivalent to console.log('hello', 'world')?
console.log(b);
I suppose you could introduce some MagicFlattening type into the language and make `b` be of that type. Then every time any function is called the interpreter would have to check and see if the argument is a MagicFlattening object and, if so, change the call from having 1 argument to having N arguments. This would make things slower and make creating a JIT more difficult. It would have unfortunate ripple effects across the entire language. You've now got these magic objects floating around that can unexpectedly change the meaning of any function call in your program. This is probably why most languages have chosen not to go this route.Instead `...` is a different way of calling a function. You can call a function in the normal way with `(` and `)` and you call it in this alternate way with `(`, `...`, and `)`. Any given call site only uses one or the other of these ways and which one it uses is known at compile time so there's no need for runtime checks and no magic objects.
The `...` is part of the function call so wrapping it in extra parentheses doesn't really make sense. You wouldn't change `console.log(a, b)` to `console.log((a, b))` and expect it to work the same, would you?
- http://www.eyetap.org/papers/docs/mann94virtual.pdf - http://wearcam.org/orbits/index.html
I seem to recall that there used to be a video showing this approach in action. As input it took a video panning across a shelf full of books where the resolution was so low that the titles were illegible. And as output it produced a video with higher resolution and all the titles easily readable. Unfortunately I can't find that video any longer.
For example, take the command `./run echo "Don't"`. When using `time`, this will print `Don't`. If you use just `"${@}"`, it will also print `Don't`.
But if you use `eval "$@"`, this will crash with an error like
eval: line 10: unexpected EOF while looking for matching `''The author here is not saying that the message has no notes. They are saying that they have "no notes" to offer the creators of the message on ways to improve it
See, for example: https://forum.wordreference.com/threads/no-notes.3042292/ https://hinative.com/en-US/questions/15238431 https://www.youtube.com/watch?v=5NVQ8v1P4go
Edit: sorry, this was supposed to be a reply to https://news.ycombinator.com/item?id=27998754
There's a web-based player so you can hear this MOD without having to download anything.
The original TRS-80 ("Model I"), the TRS-80 Model III, and the TRS-80 Model 4 all used a Z80. https://en.wikipedia.org/wiki/TRS-80
The TRS-80 Color Computer ("CoCo") used the 6909. https://en.wikipedia.org/wiki/TRS-80_Color_Computer
The portable TRS-80 Model 100 used an 8085. https://en.wikipedia.org/wiki/TRS-80_Model_100