Threads for pcg

    1. 2

      I know this is only for historical reference, but I really like when developers are able to recognize themselves as humans, I like how this line has some humor on it:

      1983 was also the year AT&T released UNIX System V R1, and BSD 4.2 was released, introducing the pseudoterminal for the first time (the progenitor to Windows’ ConPTY we introduced to Windows in 2018 😁).

    2. 45

      Let’s see. I’ve:

      • brought down credit card processing for a national retailer
      • cut off all Internet access to a major United States military installation (twice!)
      • helped bring down an entire automobile manufacturing facility
      • helped break all internet access via cell phone for one of the major US cell networks
      • shipped incorrectly optimized code that caused the (important, air-gapped) system to become accidentally quadratic

      So, you know. Be careful.

      1. 21

        I can relate to this, though I wouldn’t say I’m on the same level as you, there’s for me a long way to go. Two of my most significant achievements:

        • Brought down the debit card processing for a multinational bank issuer (only on one country sadly, and just for 2 hours).
        • Deleted the entire payment records database for a local private university on a semester, nobody noticed it, and I managed to restore it using the only backup in existence: an Excel sheet I was using to verify data.
        1. 9

          I managed to restore it using the only backup in existence: an Excel sheet I was using to verify data.

          Deeply in awe right now.

          1. 7

            To make things more exciting, that Excel file was just in memory, so a complete computer crash would have left me helpless. I learnt my lesson and do double checks on data edition, it is funny now how I make sure about doing things right even when I’m just changing a value for parameter on a file.

      2. 14

        Sounds like you’ve had a productive and interesting career, then!

        1. 15
      3. 5
        1. 15

          brought down credit card processing for a national retailer

          No. I fixed it before it became a problem and explained to the rest of my team what had happened.

          cut off all Internet access to a major United States military installation (twice!)

          First time: no, because they installed the update without testing it in their environment first. Resulted in a lot of paperwork on their end, though.

          Second time: whoo boy. I had written the compiler that turned network intrusion signatures into code that could run on our devices. I messed up the code generator for one part, so that in certain rare circumstances, an and would be an or…which meant that certain signatures would suddenly start matching just about everything. Some customers had it set up that certain signature matches would result in blocked traffic. You can see where this is headed.

          The compiler had actually been pretty extensively tested, but the problem manifested on an older configuration that didn’t have a device still in our testing pool (I know, I know).

          I had to spend a couple of days doing non-stop calls with my boss to various impacted customers, apologizing, answering their questions, and basically (and deservedly) eating crow.

          helped bring down an entire automobile manufacturing facility

          helped break all internet access via cell phone for one of the major US cell networks

          These two ended up being a lot of noise and phone calls but, ultimately, the customer had deployed stuff into their environment without testing it first. The issues on our side were from being too aggressive with what we defined as “malicious network traffic”.

          shipped incorrectly optimized code that caused the (important, air-gapped) system to become accidentally quadratic

          Not from the customer or my company, no, but from myself, very much so. I just about had a nervous breakdown, seriously. It got bad enough that I had resolved to quit as soon as I figured out what the problem was (I certainly wasn’t going to quit and leave the problem for someone else), and had convinced myself that I was just terrible at my job and had been faking it all these years. I was miserable, working long hours every night for weeks trying to figure out the problem, constantly preoccupied, not enjoying time with my family.

          Finally figured out the problem, got the fix in, and ended up staying and being reassured that I didn’t suck, which was nice.

          (Moral of this last story, database query optimizers can sometimes make the wrong decision so don’t assume that the solutions they pick in your test environment are the ones they’re going to pick in the field…)

          I actually got a job offer during that time from what might have been my dream job. I turned it down because I didn’t want to leave my current company in a bad state. I don’t know if I made the right decision, but I’m happy, so I suppose that all worked out…

    3. 2

      virtualedit is a nice trick! I wish I’d known about that a long time ago. It makes ASCII art and tables much easier.

      1. 1

        Sorry if I step out of the main topic here, but I’m just curious: did you made ASCII art by hand? If that’s so then I must say I’m really impressed, it requires lots of patience and determination to achieve; if you have them close to you I would like to see it.

        1. 1

          Nothing I’ve done has ever been impressive enough to share outside of their original context as most of it was for practical purposes.

    4. 6

      It could be fun to ask the same thing about NetBSD, I’m installing it today on a UEFI machine. My plan is to have fun with C, Zig (maybe), Haskell and other languages I have a genuine interest pushed mainly by curiosity.

      1. 1

        Nice. I haven’t used NetBSD in a very long time, but it’s much like FreeBSD in that it’s tough to setup but folks who use it say it’s totally worth it.

    5. 3

      I’m really excited enthusiasm for Plan 9 is still going strong. Sadly, I will not be able to make it, but certainly will wait for the recordings.

    6. 1

      Personally, whenever I visit Bellard’s site, I feel both: inspired and overwhelmed, because I work constantly to be better than I previously was, and certainly I have progressed a lot, but I can’t confirm if one day I will be as prolific as Bellard is. His work is remarkable, to say the least, and I’m glad people as him do this kind of neat things that help me keep going.

    7. 3

      On a side note from the project’s page:

      It does not use any stdio functions and compiles to a static executable of 29K bytes using SubC, 13K bytes using Turbo C, and 512K bytes using GCC (LOL).

      It’s impressive how much stuff gcc adds to a final executable, and I don’t mean it for good. Back on track, Kilo LISP looks very interesting, and I might give it an enthusiastic go at some point.

      1. 5

        It’s mostly glibc, not gcc itself. Building it with musl-gcc gets a 41kb static executable.

        1. 2

          You are right, thanks for correcting me. Nevertheless, it is indeed a big fat binary, considering what it does and how tiny Kilo LISP is when compiled against other libraries, as you already pointed out.

        2. 1

          That could make an interesting docker container.

          1. 1

            Alpine Linux uses musl, and it’s the base distro in many containers because the base install of Alpine is (relatively) very small.

    8. 13

      If anyone’s looking for anything that’s like this but isn’t, vis is similar and what I’ve been using.

      1. 4

        I second this comment. vis is lightweight, uses lua as its extension language, supports multiple cursors and implements sam’s structured regular expressions.

      2. 3

        vis looks nice too. So now I want vis’s Sam style regular expressions and command language together with Kakoune’s noun-verb command mode.

      3. 2

        Interesting! It says that there’s support for syntax highlighting, but I didn’t find whether it has some built-in highlighting for some core set of languages (C, Javascript, etc). Do you have to provide your own grammars for anything you want highlighted?

        1. 2
      4. 2

        Wow, all these years (well, not that many, but enough) of using the crude :%s to select and subsequently replace selected stuff in vim, when it seems like vis makes this sooo much easier and more powerful. I’m going to have to give this a try. Thanks for sharing!

        1. 1

          The crude :%s is part of a language that you could build upon. You can specify ranges, regex, and things other than search with % and s. Sure if all you want is search then it may be overkill, but at some point one can expect to outgrow the simple features, otherwise we would all just code in tiny.

      5. 1

        Vis is pretty cool. The codebase is approachable and is well documented. Even though I use Emacs for my day to day I use vis as my $EDITOR as its better suited for for bash’s C-x C-e as well as occasionally taking advantage of its use as an interactive filter.

      6. 1

        Lack of a functional theme with a light background is a bit of a showstopper for this. Need to write my own theme before I can see if I like it.

        1. 1

          Well, you can also disable syntax highlighting.

          1. 3

            Well, you can also just not take any right turns if your right indicator is broken.

            Either way, it would still leave me with a black background and various UI elements, which I don’t like.

            1. 2

              I don’t think the two are comparable, I prefer editing without syntax highlighting. There are various community provided themes:

    9. 5

      Really not cool how casually we’re throwing around white supremacist language these days.

      1. 2

        I suspect it’s a nod/reference to the (in)famous subreddit.

        Doesn’t make it better, but hey that’s hackers for you.

        1. 1

          Until today, I’ve always thought of the term ‘master race’ as a synonim and analogy for: “a heavy competition”, thus being some sort of metaphor, but I’m a non-native english speaker, with no specialization on philology whatsoever, so I hadn’t thought about its use in supremacy ideologies.

        2. 6

          “Master race” as a term is very much in the white supremacist tradition.

          Nazism held racial theories based upon a belief in the existence of an Aryan master race that was superior to all other races.

    10. 2

      casual reminder than x86 != PC compatible

      1. 1

        Thanks for commenting. I’m curious now, what can be considered PC compatible? what is considered a compliant PC?

        1. 3

          Well, you have to consider that the statement basically means a system with an x86 processor is not necessarily compatible with an IBM PC and its operating systems or even applications. The biggest platform in Japan, for instance, was the NEC PC-98 - it ran MS-DOS, but it was incompatible with western systems hardware and firmware wise. Likewise, systems like the Sun386i or Nokia Communicator lack hardware and firmware interfaces that appeared on the IBM PC and its descendants in favour of its own.

          Even though the world has significantly changed and what we consder “PCs” have UEFI et al, the point stands. You can’t really use a normal “PC” operating system on a PS4 even if the system was wide open - you’d have to create a custom kernel aware of its differences.

          1. 1

            Thank you very much for your explanation.

    11. 1

      I wonder if long shebangs have MAX_SIZE of 128 bytes, why those Nix scripts have more than that, doesn’t it always be truncated assuming linux-version < 5.0-rc1? What’s the point on having those big lines on them? if they will never be used to whatever purpose was intended for them in the first place.

      1. 3

        perl reads/parses the shebang itself again when executed and doesn’t use the command line passed by the kernel if it sees that its truncated.

        1. 1

          Thanks for answering. I assume such behaviour is only in place inside of the perl interpreter, is it different from other versions of perl (say version 1 for example)? are there other dynamic language interpreter that do it? It seems a little weird as a hack and thus non-standard and incorrect, but I may be the one incorrect, because I don’t know much else. By the way, thanks for your work on void.

    12. 3

      I feel stupid right now. I’ve been using voidlinux for about two years, hassle-free and never noticed the founder’s abscence. I think it’s great to be part of a small community where situations like this do not evolved in big dramas worth of their own soap operas. I’m glad he is back, and I’m also glad the team has made great efforts on keeping things simple with the system.

      1. 5

        Don’t feel stupid. The core team is still in control, has always been in control, and will continue to be in control. There was no reason for end users to notice any time that someone stops contributing.

    13. 5

      I must admit I didn’t know about Citus before reading this article, nevertheless I’m surprised by Microsoft’s moves towards libre software friendliness in the last couple of years; the acquisition of Github, support for SQL Server over Linux (which I remember thinking as unnecessary since Postgres improves upon it by a big margin) and now Citus Data acquisition, strategic moves that look (at least on the surface) as steps on the right direction for a company that big, considering how hostile they were to the GNU/Linux community back at the beginning of 2001.

      1. 7

        Don’t forget about WSL, which was by far the biggest surprise to me.

        1. 4

          Thanks you. And I almost forgot when they joined LOT and OIN, to fight against patent trolls.

          1. 6

            We’d be wisd to remember Embrace, Extend, Extinguish as well…

            1. 4

              Plus, them extracting billions in patent royalties from Android. I don’t trust anything they say about patents. They have both lobbyists trying to change patent law to maintain/enable their lawsuits along with excellent lawyers who wield it profitably.

            2. 1

              I’m also thinking it might be another chapter of a practice MS is expert on, but I hope to be proven wrong. Time will tell eventually.

        2. 2

          Although it was a surprise, hindsight shows me we shouldn’t be surprised that they built something to run Linux’s apps on a paid product of theirs. They did it before with OS/2 subsystem for Windows NT. They were even also a UNIX shop at once with Xenix. SCO and OpenServer still exist despite IBM and Linux stomping them.

          If anything, we should assume they’ll do more if it results in users either staying on or going to Windows.

      2. 6

        All right, I’m going to raise my hand and say after dealing with Oracle and SQL Server professionally, they’re both terrible at making things easier for a normal developer. SQL Server can at least fit in the Visual Studio/.NET toolchain/ecosystem comfortably, but using it outside of that can be awkward. Oracle documentation is made for people that must be getting paid to read it and tries to make its error messages provide no understanding of problems.

        Yes, I’m probably biased because I’m working on ~20 yr old code and the DBA’s I work with don’t seem to know much besides moving archives around, but I shouldn’t have to create a single char column with a constraint of ‘Y’ or ‘N’ to fake a boolean column type (and that was according to the best practices that I’ve found thus far) - this makes me think that developer productivity isn’t relevant to Oracle. So Postgres is appealing to me as a pretty conventional Java/C# dev because they give me features (array types, json types/functions, and not requiring me to go to weeks of training) and let me forget about the database as much as possible.

        1. 3

          I’m probably biased because I’m working on ~20 yr old code

          We are facing that same issue at my current job, there we have databases running for production systems using Oracle 8i (last supported release is from 1998), which is not adequate for current data demands, but still Oracle 11g is not that different from 8i, at least for the most used features we make use of at work.

          1. 2

            Database upgrades aren’t too bad (we’ve done them once or twice at work) as long as the features you’re using were deprecated in favor of something Oracle can charge more for (CDC Goldengate I’m looking at you).

            1. 4

              This is maybe the only time I’ve ever seen people who actually use Oracle databases pop up in a thread. Even on HN, with it’s much bigger readership (though maybe all drawn from the same bubble) you’d swear it was 95% Postgres and a few people who think they ought to feel ashamed for using MySQL even though it’s working fine for them.

              So, if you don’t mind me asking, are there plus sides to an Oracle database? Does it do things that no other DB does, is it crazy reliable, or crazy fast, or is the on-call support so damn good that when there’s big money on the line you can’t go wrong with Oracle? Or is their revenue really due to legacy lock-in / switching costs, tech dinosaur inertia, and expert CTO shmoozing? Because Larry Ellison’s still a billionaire, so they’re presumably getting something right…

              1. 3

                There are many places that have Oracle but aren’t really Oracle shops per se, as Oracle is a big part of a lot of enterprise-y software packages that are sold to CTO types.

                Too, the contortions Oracle partisans wrap themselves into to justify the lack of a Boolean datatype are hilariously stupid.

              2. 2

                Upsides? Maybe corporate inertia? We don’t do anything special (mostly big CRUD, and reporting), but the database decision(s) got made over a decade ago and nobody seems to think evaluating the costs would be a worthwhile exercise (which is odd considering Oracle licensing costs…).

                I’m firmly convinced that lots (maybe even most) decisions about software on a executive level (especially outside of the valley) are based on shmoozing. The software that my company makes (SaaS) is mostly made on that level, but there’s a point in going after a customer where the salespeople give up and say “(CxO) is an SAP guy, so this has no chance.” Which has nothing to do with cost/features/support. So we use Oracle for the same sort of reason.

                C’est la vie

              3. 1

                This is maybe the only time I’ve ever seen people who actually use Oracle databases pop up in a thread.

                I really think this is just a subculture issue. MS SQL is a bit similar, but one of the advantages of that solution is that MS is relatively more open. My (conspiracy) theory is that Oracle consultants keep knowledge secret to increase revenues ;)

                But there’s always a cut-off point where the maintenance costs exceed the costs of moving to another solution. I think Oracle has a stable base of satisfied customers, but the growth potential is low - hence buying Sun etc.

      3. 5

        which I remember thinking as unnecessary since Postgres improves upon it by a big margin

        I keep seeing people say stuff like this and it drives me bonkers. Yes, PostgreSQL has lots of convenient features, data types, and functions. But SQL Server’s query execution engine is much faster than PostgreSQL’s, and it’s query optimizer blows PostgreSQL’s out of the water. Yes, PostgreSQL has improved performance a lot in 9.x, 10, and 11. No, it’s still not anywhere close to SQL Server, especially for hugely complicated queries.

        It’s like saying C++ is unnecessary since Python improves on it by a big margin. Good for you if Python meets your performance and scale requirements, but that doesn’t make C++ unnecessary.

        1. 6

          sophisticated query optimizer

          That’s nice and all, but have you heard about our lord and saviour, clustered indexes on schema-bound views!? They’re the one MSSQL feature that I can now barely imagine living without. (Tiny inconvenience: they very-often aren’t used without a WITH (NOEXPAND) hint but oh well no biggie.) All whole bunch of aggregations suddenly magically become possible to make O(1-ish) per row selected, at the cost of adding O(1-ish) cost to data modifications.

        2. 1

          Yeah, I mean, people who have used Postgres – people who understand how much better it is at the basic job of preserving data, when compared to MySQL – often have never used a serious commercial database.

          ETA: But that said, Postgres is a wonderful tool, and significantly more comfortable for developers.

        3. 1

          I must admit I spoke without being specific on which points postgres (which from my point of view are mainly richer features) improves upon, nevertheless I trust your experience on this topic (since mine hasn’t being enough with SQL Server to speak properly, much of what I know about RDBMS is from Postgres, Oracle and Sybase [poor me]) and thanks for pointing this out. Where is a good source of unbiased information I can learn more about what you’ve mentioned here?

          1. 4

            Unfortunately, there aren’t really any good sources of information, or any way to acquire this knowledge other than industry experience.

            Trouble is, database vendors have every incentive to avoid publishing benchmarks or other performance data. It’s difficult to get right, usually easy to see where they’ve biased the sample scenario in their favor, it almost always appears juvenile, and some salty web hipster will get a gajillion upvotes on HN for vilifying the publication regardless of whether said web hipster has the slightest clue what they’re talking about.

            The best you can do is read vendor documentation that explains how capitalize on certain optimizations, or avoid certain caveats. If you really know what you’re looking at and can read between the lines, you can figure out who does what well. Even then, lots of the juiciest details are undocumented and given to customers on a need-to-know basis.

            I’ve seen SQL Server generate incredible plans that I couldn’t even begin to explain how it knew to choose. And I’ve seen PostgreSQL throw it’s hands up in the air and hash join several full table scans when a simple lateral join obviously would work better. It just isn’t a competition.

            Good commercial databases cost buckets of money for a reason. When you need that kind of power, there usually isn’t any other way to get it.

            1. 1

              any other way to get it

              Pay someone to improve Postgres for you? :)

            2. 1

              acquire this knowledge other than industry experience

              It seems to me like an appropriate scientific and fair method to know the internals and the advantages of each engine. Thanks for your objectivity.

        4. 1

          Many of my database-related tasks have more to do with SQL ergonomics than with performance. I currently work using Oracle 11 and I miss so many things that are natural using Postgres. They include SELECT FROM VALUES (instead of silly SELECT FROM dual), array types, jsonb_agg, SELECT a>b and probably some other features (I’m also missing LIMIT OFFSET, but newer Oracle has FETCH FIRST, so it doesn’t really count as an advantage over Oracle). Sure Oracle has great features that Postgres lacks, but those are what I would use every day if I could.

        5. 1

          [MSSQL’s] query optimizer blows PostgreSQL’s out of the water

          Is this recent? I’ve DBA’d postgres, and have (distant past) MSSQL experience, but back then, postgres’ query optimizer seemed far more advanced. I seem to recall MSSQL’s bad query planning being one of the reasons the stored proc became such an important part of MSSQL culture.

      4. 3

        That surprising cuz we did get a lot of submissions, some authored by @craigkerstiens. I thought we were one of goto sources for Citus news and write-ups.

    14. 2

      I wrote purp because I wanted an Emacs theme that highlighted only a few, well-chosen elements instead of highlighting everything. Because there are only a few colors, it wasn’t hard to make a light variant. I don’t recommend using it, but it’s my daily driver.

      1. 2

        I still need to clean-up everything and push it to melpa, but I’ve been working an a collection of “mostly colorless themes” built upon this principle. It’s a total coincidence, but today I have defined a light theme.

        1. 1

          That one looks great and simple, do you happen to have a public repository for them? I’d love to dig some elegant colors.

          1. 1

            I have taken the time to clean-up the repo, so you can find my collection of mostly colorless themes on now.

            1. 2

              Thank you very much, I really appreaciate it.

      2. 1

        oh nice, I liked the idea of only highlight some selected elements. Also, I think it’s a good idea for a theme to set everything to plain and expose a function for user to match their own keywords (not sure if themes are able to expose functions or not)

    15. 1

      I think wmutils is also very good as an excercise on minimalism.

    16. 22

      I’m not a fan of systemd but don’t want to bash it here. However, I think even the systemd-supporters would agree that vast additional complexity opens up a big set of potential security holes. The question is if it’s worth it.

      The LibreSSL project dropped like 200k SLOC (read: attack surface) from OpenSSL after the fork. However, much of it was old baggage. In the case of systemd, every bit of complexity is by design, which is worrisome and implies that even a fork of it would probably not yield any positive results.

      1. 8

        I’m on the same boat as you. Systemd’s biggest problem is complexity, that many of us see as unnecessary, error prone and vulnerable.

    17. 10

      There is a new (disabled by default, undocumented) shell option to enable and disable sending history to syslog at runtime

      this sounds abusable…

      1. 3

        I agree, totally. Now, on the other hand, why the need to add another feature like this? And why undocumented? I know it is not hard to write about it on the man page (in the case of GNU, info pages too) a few lines mentioning how to use it and such shouldn’t take more than a couple of minutes to put together. When I switch completely to OpenBSD (which I hope to happen anytime soon), for things like this I won’t miss GNU/Linux.

        1. 3

          “Undocumented” is how GNU tends to say, “don’t use this” or “this is internal, don’t rely this, we might change it or get rid of it.”

          Not saying I agree, but that’s just how I understand they do things.

    18. 2

      This comes of big help, because it represents the set of standard utilities available on all Unix-like systems. Now, I wonder if there is something Unix-like that doesn’t support one of these.

      1. 1

        I think the problem is not so much the availability of the tools but the slight differences. The GNU version of some command is slightly different than the BSD one and Solaris is different again.

        1. 1

          I agree. Still, I’m excited to learn what the standard tools are and what flags should be supported at minimum.

      2. 1

        I guess Plan 9 would be a big example (notoriously lacks find), or am I misunderstanding you?

        1. 2

          I think I wasn’t clear enough with my previous comment, sorry if you misundertood me. What I tried to say, is that if someone knows a Unix (want-to-be) system not supporting some of these standard tools. Plan 9 is different, because it is not Unix-like per sé.

          1. 1

            When I worked with QNX (a real time, microkernel) it came with a userland that was very much like Unix. OS-9 (not the one from Apple but a different OS-9, originally for the 6809, versions then available for the 68000 and 80386) was also a Unix-like operating system.

    19. 2

      lua_tostring should return const char *, not int, and some of the function declarations don’t match. But I do value the straightforward description of the process. Lua is a great little embedding language.

      1. 1

        thank you, I did not compile the code, my mistake, there are some syntax errors as well I’ll fix them

        1. 2

          I thought the mismatch on function names was deliberate, as a good sense of humor, it made me laugh a little.

    20. 6

      This is one of the most fun, revealing, humble, down-to-earth and concise blog post about software development I’ve read. Lately I’ve been interested on understanding vis’ design and internals, because I’m fascinated with modal editing, I also like how lua is lightweight, fast, mature and portable, so this post comes of big help to me.

      1. 3

        I am happy that you found it useful