HNHacker News
TopNewBestAskShowJobs

stedolan

26 karma · joined September 23, 2012

submissionscomments
stedolan··on Stack size invisibility in C and the effects on "portability"
The way to handle stack overflow gracefully on Linux is to check in your signal handler whether the faulting address was between the beginning of the stack and the current stack pointer. You can read the stack pointer register from the signal handler's third parameter.

This is also how the kernel grows the stack. When there's a fault, it compares the faulting address to the stack pointer register. This way, big frames don't confuse the automatic growing. (On Windows, by contrast, stack growth is detected using a single 4k guard page, so compilers must be careful with big frames and insert strided accesses)

stedolan··on Jq - a lightweight and flexible command-line JSON processor
Thanks!

1. I think your example shows sed/awk's failings with JSON data :) I don't want to write a JSON parser by hand every time I want to pull a field out of an object, and parsing recursive structures with regexes is never a good plan.

2. It reads JSON items from stdin into memory, one at a time. So if the input is a single giant JSON value, it all goes into memory, but if it's a series of whitespace-separated values they'll be processed sequentially.

It's cat-friendly: if you do

    cat a | jq foo; cat b | jq foo
then it's the same as doing

    cat a b | jq foo
stedolan··on Jq - a lightweight and flexible command-line JSON processor
They exist now!
stedolan··on Jq - a lightweight and flexible command-line JSON processor
(author here) That bug was fixed a while ago, but I forgot to upload new binaries. Try again, they should be working now.
stedolan··on Jq - a lightweight and flexible command-line JSON processor
(author here) I haven't tried to build on a mac in a while, bison there seems to support fewer options (must be an older version).

For now, I've just checked in the autogenerated parser, so that bison won't have to run when you build master. git-pull and try again :)