1. 12

    Glossing over why sudo would mysteriously not work, this writes a bunch of noise out to the monitor:

    > sudo cat /dev/urandom > /dev/fb0
    -bash: /dev/fb0: Permission denied

    That command does not work because the redirection is performed by the shell which does not have the permission to write to /dev/fb0. The redirection of the output is not performed by sudo.

    How to do it here

    1. 7

      You can use tee as well:

      cat /dev/urandom | sudo tee /dev/fb0

      It’s quite funny that person who don’t know how shell and sudo (nb: use doas or su instead) tells us a lengthy story about writing to framebuffers in Linux

      1. 11

        The frame buffer is arguably a lot simpler than a *nix shell

        1. 7

          nb: use […] su instead

          You better don’t, it’s vulnerable to the ages-old TIOCSTI trick::

          #include <sys/ioctl.h>
          int main() {
              char* c = "exit\nid\n";
              for (; *c; ++c)
              return 0;

          (in .bashrc or so)

          This can be deterred by using su -P, but it’s marked as experimental (according to the manpage), and I haven’t seen anyone using it.

          1. 3


            more info here, as I haven’t heard of it previously https://ruderich.org/simon/notes/su-sudo-from-root-tty-hijacking

        2. 1

          This probably works for the author if they’re in the video group:

          $ ll /dev/fb0
          crw-rw---- 1 root video 29, 0  5 apr 15:37 /dev/fb0

          EDIT: I’m stupid, didn’t see that part of the article.

        1. 8

          Thank you for both the Oil project and this post. This is definitely the explanation I will point people to.

          I haven’t adopted Oil yet myself, and probably won’t until at least 1.0. I’ve tried zsh, fish, and xonsh, and have nice things to say about them all… but so far I always keep setting my login shell back to bash on linux, because there are just too many other people’s scripts for me to deal with. The net semantic complexity of $NEAT_NEW_SHELL plus that of $CRANKY_OLD_SHELL is always greater than the latter alone, so I find myself stuck with bash despite its irritations. It’s apparently just another one of these insoluble collective action problems.

          The embrace, extend, (eventually) extinguish approach that source translation enables is the only one I can endorse for having a hope of success in such an entrenched, messy, decentralized context as the Unix diaspora. There’s an important lesson here, and I hope similar projects take note.

          1. 8

            but so far I always keep setting my login shell back to bash on linux, because there are just too many other people’s scripts for me to deal with

            What does this have to do with the shell that you run? I run fish and that is no obstacle to running programs written in any other language, including bash.

            1. 6

              It’s not just the shell I run, it’s the shell “all the things” expect. I can easily avoid editing C++ or ruby source (to pick a couple of random examples) but, in my job at least, I can’t avoid working with bash. I can’t replace it, and I need to actually understand how it works.

              Of course, other people with other jobs, or those who have long since attained fluency in bash, may have better luck avoiding in their personal environment. I can’t, because I have to learn it, ugly corners and all. I’d be happy to stick with fish, it’s just not a realistic option for me right now. My observation is that, for my current needs, two shells are worse than one.

              1. 3

                I’ve used fish for years now. Whenever I need to run a bash script I just run bash script.sh. The smallest hurdle I have to deal with is the small mental effort I have to make translating bash commands to fish equivalents when copying bash one liners directly into the shell.

                1. 3

                  I don’t understand what working with bash scripts has to do with the shell that you run, though. Just because you run Python programs doesn’t mean your shell has to be a Python reple, these things are separate. In the case you’re referring to it sounds like bash is just a programming language like Ruby or Python.

              2. 2

                Thanks, yes I didn’t explicitly say “embrace and extend”, since that has a pretty negative Microsoft connotation :)

                But that’s the idea, and that’s how technology and software evolves. And that’s is how bash itself “won”! It implemented the features of every shell, including all the bells and whistles of the most popular shell at the time – AT&T ksh.

                Software and in particular programming languages have a heavy lock-in / network effects. I mean look at C and C++. There’s STILL probably 100x more C and C++ written every single day than Go and Rust combined, not even counting the 4 decades of legacy!

                It does seem to me that a lot of programmers don’t understand this. I suppose that this was imprinted on my consciousness soon after I got my first job, by reading Joel Spolsky’s blog:


                There are two opposing forces inside Microsoft, which I will refer to, somewhat tongue-in-cheek, as The Raymond Chen Camp and The MSDN Magazine Camp.

                The most impressive things to read on Raymond’s weblog are the stories of the incredible efforts the Windows team has made over the years to support backwards compatibility:

                This was not an unusual case. The Windows testing team is huge and one of their most important responsibilities is guaranteeing that everyone can safely upgrade their operating system, no matter what applications they have installed, and those applications will continue to run, even if those applications do bad things or use undocumented

                This is a good post, but there are others that talked about the importance of compatibility. Like the “never rewrite post” (although ironically I’m breaking that rule :) )


                Another example of this that people may not understand is that Clang implemented GCC’s flags bug-for-bug! GCC has an enormous number of flags! The Linux kernel uses every corner of GCC, and I think even now Clang is still catching up.

                Building the kernel with Clang : https://lwn.net/Articles/734071/

              1. 1

                Is “withdrawl” a different way of spelling “withdrawal”? Thought it was a typo, but the post consistently spells it that way.

                1. 2

                  Perhaps the author actually thinks that is how it is spelled.

                  1. 1

                    Spelling has never been my strong suit! I will get that fixed.

                  1. 10

                    I wish there was a game halfway between Dwarf Fortress and more limited in scope, better polished games like Prison Architect. Dwarf Fortress is the best game I’ve seen that has so much complexity that it’s emergent behavior is genuinely surprising and often entirely unique, while still residing within the realm of story possibility (it’s not realistic or anything like that, but makes sense in a story kind of way). That’s a special property, and not one that many other games capture. A project aimed at that (in the same genre), but with a larger focus on polish (I don’t need a fancy-schmancy sprite UI or anything, just less sharp edges) would have endless potential for me.

                    To preempt the response “once you get used to it, it’s fine”, I simply cannot agree. I’ve put a good amount of time into Dwarf Fortress, passing the first few common hurdles (farming, lack of beer rage, immigrant pressure), but didn’t buckle down enough to figure out why squads never seemed to train.

                    Learnability is rough in DF, but it isn’t the biggest reason I think the game is too rough around the edges: coming back to a medium to large fortress after more than a few days off is basically impossible. It’s like writing thousands of lines of assembly without using a procedure abstraction. To understand the system requires a ton of memory on the player’s part. The game does so little to convey the state of the fortress, and so many obscure details need to be tracked, that the best approach is to just memorize everything as you build the fortress and rely on that accumulated knowledge. If you lose it, good luck getting it back out of the game.

                    Anyway, DF’s pretty cool, not trying to hate on it, just some of the consequences of it’s design, both very very good and also not so great. Either way, nothing else quite like it.

                    1. 9

                      RimWorld might be what you are looking for, it’s even based on the Prison Architect look!

                      1. 3

                        Almost certainly going to pick this up, thanks.

                        1. 2

                          To follow up I did and i’m addicted and bought it for my dad and brother.

                      2. 3

                        tbh it’s not that complex. It’s sophisticated. In that it keeps track of each fingernail of every dwarf of your fort, but the interactions are only complex and meaningful if one pretends it is. Spotting patterns in the tea leaves, so to speak. As a simulation it has many moving parts, but as a whole it’s still quite plain.

                        And the interface is the biggest problem to the game. The learning curve wouldn’t be half as steep otherwise.

                        but didn’t buckle down enough to figure out why squads never seemed to train

                        Don’t worry, It’s been buggy for years.

                        1. 2

                          I appreciate your response, but I don’t know that I fully buy what you’re saying.

                          the interactions are only complex and meaningful if one pretends it is.

                          Regarding it being meaningful, certainly, like all games it requires participation and buy in, it’s not inherently meaningful. And I can see what you mean about the complexity in a statement like “combat is so complex because it models so many ways to take damage.” I agree that that complexity only matters if we care about it.

                          But fortresses tend to be kind of fragile, and keeping them running smoothly is the main draw of fortress mode, embodied by the idea of Fun (total fortress failure in spectacular ways). So if you’re trying to keep a fortress running smoothly, any of the following can seriously destabilize you:

                          If there’s a kink in your beer production, everybody is going to be pissed, and if there is a kink in your clothing production, everybody is going to be pissed, and if you forgot than a dwarf has a “strange mood” but doesn’t have the needed materials, then they’re going to be pissed. And in each of these, when I say “going to be pissed”, I mean “going to be pissed and starting hitting people”.

                          As a side note, this is a completely valid way for the game to be. It is realistic that projects get finished or lie incomplete then everyone forgets how it worked in the first place, or that big interconnected system, once in place, tend to have a life of their own. That’s totally valid, and being unnecessarily complicated actually helps achieve this effect.

                          And the interface is the biggest problem to the game

                          That’s what people say, but I don’t believe it. I had the keybindings down without any special effort, it just happened, to the point I didn’t realize how much of the menus I had memorized.

                          My belief is that the biggest problems lie in the vast amount of information you have to ‘just know’, that the game doesn’t really let you in on. Like in the most recent update, that you can send your military commander on mission and you’ll be unable to manage your military much at all because nobody can take his place. Or that certain kinds of missions (artifacts known to be held by a person) don’t actually work. The ritual to get soldiers to train (like I said, never actually got the steps down for that one no matter how much of the wiki I read), and numerous other bugs and sharp edges you just have to know to play around.

                          The core of the argument is: the game will teach you through failure that you need to grow food, make beer, make clothes, raise a militia, etc, but if something is buggy, you have no idea if you’re wrong or the game is, and there’s no way to learn within the game through that ambiguity.

                          Don’t worry, It’s been buggy for years.


                      1. 7

                        That was honestly not “unusually” well disguised.

                        1. 2

                          If you don’t work in security, anything that doesn’t end in .exe is a surprise. Hell, even “Payment Terms.exe” would still be a surprise to most, hence OS X + Windows popups to the effect of “Hey, do you know you’re about to run a program you downloaded, not open a document?”