1. 2

    IRC server at Digital Ocean

    Zoneminder on raspberry pi at home

    1. 4

      This guy again… In the past I’ve wondered if it was satire. If not, he’s like a caricature of a person.

      1. 5

        I always thought it interesting how the GNU tools have this split-brain between emacs and vi keybindings. I know that readline (by default) uses emacs, but I believe you’re able to make it use vi-like keybindings instead (or maybe that’s just a feature of Bash?). The two tools I use daily that use vi keybindings are man and less. And then you can see GNU’s influence with info because they use emacs bindings.

        All in all, it’s a pain and I’m a vim guy so beyond single-line editing on the command line, emacs bindings are completely foreign to me. As a result info pages are almost useless to me because I have no idea how to correctly navigate them. ¯\_(ツ)_/¯

        1. 12

          I believe you’re able to make it use vi-like keybindings instead (or maybe that’s just a feature of Bash?)

          That’s actually mandated by POSIX, as part of the definition of set for the shell. There was originally a proposal to have an “emacs” mode as well, but as the POSIX rationale document states:

          In early proposals, the KornShell-derived emacs mode of command line editing was included, even though the emacs editor itself was not. The community of emacs proponents was adamant that the full emacs editor not be standardized because they were concerned that an attempt to standardize this very powerful environment would encourage vendors to ship strictly conforming versions lacking the extensibility required by the community.

          Gotta love Emacs users ;)

          1. 2

            The original FSF crew were all (most?) emacsphiles, according to Brian Fox.

            Source: many discussions with Brian Fox.

            1. 1

              Aw, man, Brian Fox. What’s up with him these days? I wish I could have been there in the early days of the FSF.

            2. 2

              …I believe you’re able to make it use vi-like keybindings instead…

              In ~/.inputrc:

              set editing-mode vi
              set keymap vi
              

              As a result info pages are almost useless to me because I have no idea how to correctly navigate them.

              That’s why I install pinfo on every Linux machine I use. It’s still not vi-like bindings, but it’s lynx-like bindings, which are at least easy to learn.

              1. 1

                The two tools I use daily that use vi keybindings are man and less.

                If you’re on some reasonably “normal”-ish Linux distro and haven’t gone out of your way to configure things otherwise, man is most likely just displaying its output via less, so those are kind of one and the same as far as keybindings go – and less actually isn’t a GNU program.

                1. 1

                  FWIW, less supports both bindings.

                  1. 0

                    info pages

                    Pet peeve. They’re info manuals not pages. Manpages are called that because individually each was supposed to be but a single, one-page cheat sheet of the full Unix manual.

                    The whole point of TeXinfo was to generate full manuals all at once, and in multiple formats, with an index, a table of contents, chapters, menus, and hyperlinks. If you don’t like the text-based info reader, there is HTML and PDF output as well. Use those!

                    … but I know you’ll tell me next, if it’s not in a text-based terminal, you don’t want to read it. In that case, just read the raw .info[.gz] files. They’re plain text files with a few ASCII control characters.

                  1. 4

                    In terms of desktop adblocking and tracking blocking solutions, I use uBlock Origin, Privacy Badger, and this hosts file.

                    1. 4

                      I like the technique in general but often have local stuff listening on various ports. I wish there was a well-known ‘/dev/null’ IP address which these could be routed to … a tiny daemon could then return a protocol-appropriate NAK immediately and log the attempt.

                      1. 1

                        Rather than 127.0.0.1, could you just route to something on your LAN that doesn’t exist?

                      2. 3

                        I use uBlock Origin as well, works like a charm! Just have to disable font blocking on a few pages for them to be readable.

                      1. 5

                        I like Marshall Rose’s On the Design of Application Protocols, and his specs for BEEP (here, and here). Higher/application-level protocol, but still.

                        1. 2

                          SMTP is close to being the perfect application protocol: it solves a large, important problem in a minimalist way.

                          The very first line just conquered my heart!

                          Thanks!

                        1. 2

                          being born at the ‘right’ time and having the right interests to enjoy runequest, and then call of cthulhu, and then stormbringer - i love reading things like this.

                          1. 4

                            despite the title, there’s a good design/ux discussion - i wish i could promulgate thinking like that at my current org.

                            1. 13

                              “there is no denying that Microsoft has changed as a company in a way that is beneficial to the open source community and beyond.”

                              this is a bold claim which he doesn’t seem to back up. i see no reason to think that their new-found love for linux is anything but the “embrace” phase of a 3-part plan.

                              1. 1

                                agreed.

                              1. 2

                                that’s so cool. i’ve been messing around with zoneminder on a raspberry pi3b with cheap wansview and dlink cameras… i’d love to have extremely cheap hackable cameras on the network.

                                1. 14

                                  another step on the path to total lockdown. i will probably have no choice soon but to run linux again.

                                  1. 2

                                    Why should you care? Are you running custom kernel hacks that need X86 to run?

                                    1. 16

                                      it probably wasn’t obvious what i meant about lockdown.

                                      iterations of macos have continued to lock down what developers can do. you’re increasingly funneled down a path for building software that works best if you’re building macos or ios software, less good if you do anything else.

                                      the end game, in my opinion (when considered alongside the ios-ization of macos), is that apple is on the way to producing consumer electronics almost exclusively (ipads/phones and… headphones?). the exception is the workstations required to build apps for those consumer electronics.

                                      so no, i’m not really running anything that needs x86, i don’t think. arm would be fine, ppc would be fine. why should i care? i think it’s more why do i care - i care because i believe it’ll be more and more annoying to use a mac for anything except building apps for apple’s ecosystem consumer devices. at some point, probably soon, i’ll need to run a different operating system so that it’s less annoying. to me.

                                      1. 8

                                        I think the writing on the wall is clear that “lockdown” for the purposes of anything other than security is a dead end on the desktop. Users who want a locked-down experience aren’t buying powerful (profitable) workstations. If Apple is dropping a few dozen million on scaling up ARM (and their GPUs) for desktops, it’s to make the MacOS platform better. And probably to get away from paying the Xeon tax- those things are super-expensive, and Intel is holding core-counts hostage unless you pay.

                                        1. 6

                                          i don’t agree that security is the overarching theme. when you consider lockdown of users (as opposed to developers), the locked down/consumer products (ipad, iphone) are good for about 76% of apple’s q1 2018 revenue. over the last 6 years, services often drives as much or more revenue as workstations (well, let’s say all macs).

                                          in my opinion it makes ‘bottom line, quarterly revenue’ sense to continue to drive consumer products as the main cash cow. the only real incentive i see around the desktop os is to make it better at making the consumer products stickier. how do you make ipads stickier? better ipad apps.

                                          apple is currently sitting on 285 BILLION us dollars in cash. if they want to throw 100 million (say) at beefing up their own design and fab, i mean, it’s not much of a risk. if it doesn’t work out, they seem flush enough to continue paying intel.

                                          1. 14

                                            76% is still really far from 100%. Macs were 8% of their revenue, which is still 7 billion dollars. With a B. Tres comas. You’d have to be bonkers to throw away 7 billion. And you’d have to be bonkers to reduce your product diversity, especially by tanking your most consistent product line.

                                            No, it’s far more likely that Apple—knowing they have spent the last few years investing heavily in an ARM-based platform, and knowing the newest ARM chips rival Intel for per-core performance at a fraction of the power—believes they can build an ARM laptop light years ahead of the rest of the market. And considering no one else on the market has come close to their level of hardware integration and optimization on ARM, they’re probably right.

                                            There are a couple laptops in preview using the new high powered ARM chips, but Windows+ARM has failed once before, will they be able to launch this time? Apple can launch a product and instantly get mass market penetration even with people bitching left and right about headphone jacks, touch bars, and USB-C ports. Has any Windows laptop gotten that kind of penetration in the last 5 years?

                                            If Apple releases a MacBook Pro that’s competitive with Intel based Windows laptops for compute power, with some ridiculous amount of battery life like 14 hours, what do you think will happen? Do you think the new Windows+ARM and the CLR will be able to compete with Darwin, an ARM-native platform that’s been around for a decade, with an ARM-native kernel, a huge ecosystem of ARM-native libraries, and countless deep integrations with Apple-made ARM chips?

                                            Nah dude, Apple isn’t trying to lock down the laptop ecosystem, they’re trying to reuse their gigantic investment to get off of a hardware platform that’s honestly been stalling. Intel isn’t reducing power use, they aren’t increasing core density, they don’t integrate well with peripheral co-processors that are redefining consumer electronics. Hell IBM POWER might actually take market share from Xeon. Say that to someone from 2010 and they’d laugh so hard they’d halfway suffocate.

                                            1. 1

                                              lockdown doesn’t mean throwing away revenue. the idevices are the perfect example. the amount of control apple exercises over the idevice platforms is their model for the desktop/laptop os. it’s the end goal. it won’t eat into revenue because as you point out, paraphrasing, true believers would purchase plastinated dogshit if apple sold it.

                                              apple has a long way to go in heat dissipation if they want to run their processors in laptops. they’re not there. they’ll get there, but 2020? meh.

                                              1. 3

                                                @robertp @peter: please don’t post in this subthread again. There’s a lot of thoughtful things that could be said about Apple’s hardware and platform, but this flame war precluded them. If you think someone’s terribly wrong, you can make your points and leave the conversation without personal attacks. Readers will be able to judge.

                                                1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                  1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                    1. 5

                                                      Just a reminder, since I’m the one that invited you: please don’t use this tone when addressing other users here.

                                                      1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                        1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                          1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                            1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                              1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                                1. [Comment removed by moderator pushcx: Let's not have a flame war about Apple's design decisions.]

                                                                  1. 3

                                                                    Folks, please stop.

                                                2. 1

                                                  Right, and the only way an expensive change to the workstations makes sense if your goal is “better iPad apps” is to make the developer experience better

                                              2. 3

                                                Can you cite specific examples please? What can you do as a developer in more recent versions of MacOS that you could do before.

                                                I’m not challenging, just trying to understand where you’re coming from here. I do most of my development in high level languages and don’t really see any such restrictions.

                                                1. 3

                                                  They haven’t. They have restricted kernel modules you can load, which you can resolve by self signing your kernel modules, same as you need to self sign your apps to run development versions on a real phone. They have added system integrity protection, which you can disable if you need to. They’ve basically only added security features that are fairly easy to comply with as a developer if you actually wanted to develop anything. But they’re the end of the world if you’re trying to troll on the internet about Apple being evil.

                                                  1. 3

                                                    That’s exactly my impression too. I can’t help but wonder how much of this hand wringing is actually virtue signaling.

                                                    How many of these people will actually make the switch? And why haven’t they done so already if MacOS.current is so god awful?

                                              3. 4

                                                If you look at what Apple has done to the iPhone in terms of lockdown, that’s what awaits MacOS users. I’m writing this on a 2014 Macbook Pro, but it’s the last Macbook Pro I’ll buy as every new MBP I’ve tried has had terrible corner cutting. I run an older OS, because High Sierra is a dumpster fire when it comes to memory management and I can’t comfortably run OpenBSD here.

                                                1. 4

                                                  Hey, if you have 20/20 vision and don’t need any of the accessibility assists MacOS offers, go forth and enjoy. I wish you well in creating a work environment that suits you.

                                                  As for me, I have yet to find a Linux desktop environment that gives me the key chorded zoom and font sizing features I absolutely must have in order to actually use a computer.

                                                  Also, I think you’re engaging in FUD. I don’t see Apple making MacOS equivalent to IOS. There’s no business benefit there - they have the iPad pro to cater to that customer.

                                                  1. 1

                                                    Funny you bring that up. No, I don’t have anywhere close to 20/20 vision. In fact I’m pretty much blind in one eye and very very short sighted in the other. I think you’re possibly misinterpreting my comment (for which, read I think you’re responding to things I never said).

                                                    I mentioned Apple implementing what they’ve done for iOS on the new macbook in terms of user lockdown, not in terms of accessibility features, nor in terms of the direct user experience. If you’d like to know my thoughts on what that means, they’re here.

                                                    1. 1

                                                      OK, but my point is, you claim these are things we should expect. I claim there’s no actual business motivation for them to do this. I assert that they will continue to treat their general purpose computers like general purpose computers.

                                                      Things like Gatekeeper are easily disabled. It’s there to prevent end users like my 76 year old mother in law from shooting herself in the foot, and honestly, she needs them!

                                                      Until they actually happen, you can keep telling me the sky is falling, and I say I’ll believe it when and if it actually happens.

                                                  2. 2

                                                    What has Apple done to lock down the iPhone that could apply to a desktop operating system? I have a hard time following this claim about Apple in the past, so I am genuinely interested if I have missed something.

                                                    1. 1

                                                      Some things to expect:

                                                      • Secure bootloader restrictions, with the added side-effect of not being able to boot non-Apple approved OSes
                                                      • Only being able to run apps from the app store or those signed with a developer ID. This is currently the default but can be changed. I don’t see this change happening overnight, but I do see it happening.
                                                      • Anti-jailbreak measures to stop you from being able to use your general purpose computation device for the purposes of general purpose computation.

                                                      Apple has been integrating iOS elements into MacOS for some time, most notably Siri but also quite a few things generally. It’s a lot of effort to maintain disparate platforms, and bringing MacOS to Apple’s own brand of ARM chips is a way of reducing that complexity. Likewise, if they’re moving everything over to this platform, why reinvent the wheel when they can reuse the existing technology they’ve spent billions of dollars developing.

                                              1. 8

                                                At least in California non-competes are illegal.

                                                1. 14

                                                  Not illegal – legally unenforceable.

                                                  1. 9

                                                    Which is why I happily sign any non-compete, and tell the HR folks (with a smile) “Ok, I’ll sign this, knowing that it’s not enforceable in this state.” The reactions I’ve had vary from friendly chuckles to long useless lectures.

                                                    1. 4

                                                      Good point!

                                                      1. 2

                                                        It’s a little nitpicky, but it’s also important that if a Californian were to read this thread, and then be presented with a non-compete, that she should understand that there is no reason they can’t ask you to sign; they simply can’t hold you to the provisions of the agreement.

                                                        1. 3

                                                          One can also understand then whether or not the employer is going to try to be dishonest or threatening by insisting on signing one.

                                                      2. 1

                                                        Whenever I see that, I wonder how often people that try to resist that get fired or lose a reference for some other reason to cover up what the real reason is. I’ve seen a lot of that outside of non-competes. Happen much in California?

                                                        1. 2

                                                          Sure, it’s still possible. My favorite is replying to a request for information with “sorry, we are legally obliged to not share that information.”

                                                    1. 2

                                                      been looking for the right linux for my 2012-era 11” macbook air for a while now. mint (so i guess ubuntu really?) has done pretty well for the hardware, including to my surprise making the bluetooth stack work with an external mac trackpad. one of these days i’ll try switching to it as my work laptop for a week and see how good or bad it is.

                                                      1. 6

                                                        i hate slack. it’s a necessary evil. i’m still trying to figure out some norms and conventions to make people not think it’s a replacement for email.

                                                        i use weechat for irc, and there’s a native/non-irc gateway slack plugin for it. works like a charm.

                                                        1. 1

                                                          I still have never used slack. How did this develop into a necessary evil? Wouldn’t Matrix or Rocket Chat fill the need? Mattermost? I find it fascinating that nobody wants to self host (use it to test your devops skills if you must) and nobody seems to care about some corporation having the chat logs of your developers (and code snippets, and and and)

                                                          1. 2

                                                            Having tried to self host Matrix, the current server Synapse is a total pain to manage, super resource hungry, single threaded and as soon as you join big channels everything start to crumble. The gateways are buggy or inneficient. Hopefully the new Go server will fix some of the pain point, but overall I found that self-hosting is great if you want to lose your time on debugging and managing server instead of actually working on your projects.

                                                            Right now I’m running The Lounge with IRC gateways and Bitlbee and it works great. Still some pain point and missing some slack features, but it’s all worth the RAM I save and the fact I can use IRC, Slack, Twitter, Facebook Messenger and Hangout in the same tab!

                                                            1. 2

                                                              I’ve been running my Matrix server for 6 months. It was dead simple to setup and requires no maintenance. I upgrade it regularly (I’m the maintainer on FreeBSD) and the IRC bridge works fine, but it is inefficient.

                                                              I don’t know what OS you ran it on, but it’s quite simple to use on FreeBSD.

                                                              edit: large rooms like the matrix dev room have no appreciable performance impact for me either…

                                                              1. 1

                                                                I don’t know, I ran it with avhost/docker-matrix docker image on a n1-standard-1 (3.75 Go RAM) instance in GCP along with the bridges and an HTTPS reverse proxy. After running it for a while, it could take me about 30 seconds to get my message aknowledge :| It could have been a bad config or slow I/O somewhere, in any case I gave up and won’t retry until Dendrite is stable. I had a much simpler setup that I used on a VPS a year ago until I got tired of cleaning the logs and message history that filled up the disk (There was/are no easy way to manage history and properly clean it…). The logs are also so noisy, seems like the dev mismatched INFO level for DEBUG.

                                                                1. 2

                                                                  You have to run a Postgres database too so I wouldn’t try to run it on that hardware. I’ve got 24 cores and 64GB RAM, NVME SSD for ZFS cache, etc.

                                                                  1. 1

                                                                    I find it fascinating that nobody wants to self host […]

                                                                    You have to run a Postgres database too so I wouldn’t try to run it on that hardware. I’ve got 24 cores and 64GB RAM, NVME SSD for ZFS cache, etc.

                                                                    Your last answer pretty much explain your first statement. I can’t wrap around my head the fact that I need a few thousands worth of machine to exchange text messages to a few contacts.

                                                                    1. 1

                                                                      I’m running dozens of services on this machine. Which cost me $400 on eBay 2 years ago. Servers aren’t expensive. VMs are terribly overpriced. Matrix takes up about 1% CPU and 2GB of RAM

                                                            2. 1

                                                              you have to consider the audience, and the tradeoff. the audience is everyone non-tech i work with… i’ve pined for the day non-tech colleagues could use irc, but it just ain’t ever gonna happen. the tradeoff is being ‘part of the team’ vs. left out. in a distributed team, there’s no question about what to do to adapt.

                                                              for whatever reason, slack checked off the boxes that mattermost, hipchat, et al just didn’t. and i don’t see microsoft’s or google’s challenges breaking off any of slack’s pie.

                                                              the question of self hosting is (in my opinion) irrelevant, just like for most folks now the question of self hosting email is irrelevant.

                                                              1. 1

                                                                I run a Mattermost server for friends and family. The experience is still less polished than Slack, although it’s catching up fast. The main problem is mobile OS integration; even fairly simple things (sharing images from the Gallery to Mattermost) are as yet unsupported, at least on Android.

                                                                That said, at the rate it’s improving, it’ll be at parity soon. And for most cases it’s there already.

                                                            1. 2

                                                              I don’t understand how the C implementation of true is non-portable? I mean, every C compiler and environment I have seen can set main() as an integer, and return 0 to the shell. Can some one explain how the following C code is non-portable?

                                                              #include <stdio.h>
                                                              int main() { 
                                                                  return 0;
                                                              }
                                                              
                                                              1. 9

                                                                His complaint is that the executable is not portable, not the source file. The literal file /usr/bin/true on a Linux machine can’t be dropped onto a machine that doesn’t use ELF binaries, for example.

                                                                1. 1

                                                                  That makes way more sense, thank you.

                                                                  1. 3

                                                                    It does make more sense, but what doesn’t (to me) is why Pike of all people complains about binary vs. source compatibility.

                                                                2. 6

                                                                  Can some one explain how the following C code is non-portable?

                                                                  Main must have exactly two parameters (int and char **) or void. Anything else is implementation defined territory.

                                                                  1. 1

                                                                    Good call!

                                                                  2. 1

                                                                    Saved you some bytes, leaving out the include works fine, no?

                                                                    int main(){return 0;}
                                                                    
                                                                    1. 2

                                                                      Saved you some bytes, leave that to your compilet, he knows his job!

                                                                      main(){};
                                                                      
                                                                  1. 59

                                                                    This is why we can’t have good software. This program could literally have been an empty file, a nothing at all, a name capturing the essence perfectly.

                                                                    I’m not sure I could disagree more strongly. An empty file only has the true behavior because of a bunch of incredibly non-obvious specific Unix behaviors. It would be equally reasonable for execution of this file to fail (like false) since there’s no hashbang or distinguishable executable format to decide how to handle it. At a somewhat higher level of non-obviousness, it’s really weird that true need be a command at all (and indeed, in almost all shells, it’s nottrue is a builtin nearly everywhere).

                                                                    true being implementable in Unix as an empty file isn’t elegant—it’s coincidental and implicit.

                                                                    1. 15

                                                                      I mean, it’s POSIX specified behavior that any file that is executed that isn’t a loadable binary is passed to /bin/sh (”#!” as the first two bytes results in “implementation-defined” behavior), and it’s POSIX specified behavior that absent anything else, a shell script exits true.

                                                                      It’s no more coincidental and implicit than “read(100)” advances the file pointer 100 bytes, or any other piece of standard behavior. Sure, it’s Unix(-like)-specific, but, well, it’s on a Unix(-like) operating system. :)

                                                                      1. 25

                                                                        It’s precisely specified, yes, but it’s totally coincidental that the specification says what it does. A perfectly-reasonable and nearly-equivalent specification in an alternate universe where Thomson and Ritchie sneezed five seconds earlier while deciding how executables should be handled would have precisely the opposite behavior.

                                                                        On the other hand, if read(100) did anything other than read 100 bytes, that would be extremely surprising and would not have come about from an errant sneeze.

                                                                        1. 35

                                                                          Black Mirror Episode: The year is 2100 and the world is ravaged by global warming. The extra energy aggregated over decades because non executables went through /bin/sh caused the environment to enter the tipping point where the feedback loops turned on. A time machine is invented, where one brave soul goes back in time with a feather, finds Thomson and makes him sneeze, saving humanity from the brink of extinction. But then finds himself going back to 2100 with the world still ravaged. Learns that it was fruitless because of npm and left-pad.

                                                                          1. 12

                                                                            it’s totally coincidental that the specification says what it does.

                                                                            This is true of literally all software specifications, in my experience.

                                                                            1. 8

                                                                              Surely we can agree that it is far more coincidental that an empty executable returns success immediately than that e.g. read(100) reads 100 bytes?

                                                                              1. 7

                                                                                Why isn’t 100 an octal (or a hex or binary) constant? Why is it bytes instead of machine words? Why is read bound to a file descriptor instead of having a record size from an ioctl, and then reading in 100 records?

                                                                                Just some examples. :)

                                                                                1. 5

                                                                                  Obviously, minor variations are possible. However, in no reasonable (or even moderately unreasonable) world, would read(100) write 100 bytes.

                                                                                  1. 12

                                                                                    Pass a mmap’ed pointer to read, and it shall write. :)

                                                                            2. 12

                                                                              The current (POSIX) specification is the product of historical evolution caused in part by /bin/true itself. You see, in V7 Unix, the kernel did not execute an empty file (or shell scripts); it executed only real binaries. It was up to the shell to run shell scripts, including empty ones. Through a series of generalizations (starting in 4BSD with the introduction of csh), this led to the creation of #! and kernel support for it, and then POSIX requiring that the empty file trick be broadly supported.

                                                                              This historical evolution could have gone another way, but the current status is not the way it is because people rolled out of bed one day and made a decision; it is because a series of choices turned out to be useful enough to be widely supported, eventually in POSIX, and some choices to the contrary wound up being discarded.

                                                                              (There was a time when kernel support for #! was a dividing line between BSD and System V Unix. The lack of it in the latter meant that, for example, you could not make a shell script be someone’s login shell; it had to be a real executable.)

                                                                              1. 10

                                                                                The opposite isn’t reasonable though. That would mean every shell script would have to explicitly exit 0 or it will fail.

                                                                                Every. Shell. Script.

                                                                                And aside from annoying everyone, that wouldn’t even change anything. It would just make the implementation of true be exit 0, instead of the implementation of false be exit 1.

                                                                                And read(100) does do something besides read 100 bytes. It reads up to 100 bytes, and isn’t guaranteed to read the full 100 bytes. You must check the return value and use only the amount of bytes read.

                                                                                1. 7

                                                                                  It’s not obvious to me that an empty file should count as a valid shell script. It makes code generation marginally easier, I suppose. But I also find something intuitive to the idea that a program should be one or more statements/expressions (or functions if you need main), not zero or more.

                                                                                  1. 3

                                                                                    So if you run an empty file with sh, you would prefer it exits failure. And when you run an empty file with python, ruby, perl, et al., also failures?

                                                                                    Why should a program have one or more statements / expressions? A function need not have one or more statements / expressions. Isn’t top level code in a script just a de facto main function?

                                                                                    It’s intuitive to me that a script, as a sequence of statements to run sequentially, could have zero length. A program with an entry point needs to have at least a main function, which can be empty. But a script is a program where the entry point is the top of the file. It “has a main function” if the file exists.

                                                                                    1. 3

                                                                                      I think whatever the answer is, it makes equal sense for Perl, Python, Ruby, shell, any language that doesn’t require main().

                                                                                      In my opinion, your last argument begs the question. If an empty program is considered valid, then existing is equivalent to having an empty main. If not, then it isn’t.

                                                                                      In any case, I don’t mean to claim that it’s obvious or I’m certain that an empty program should be an error, just that it seems like a live option.

                                                                                    2. 2

                                                                                      Exactly. It sounds like arbitrary hackery common in UNIX development. Just imagine writing a semi-formal spec that defines a program as “zero characters” which you pass onto peer review. They’d say it was an empty file, not a program.

                                                                                      1. 2

                                                                                        I guess true shouldn’t be considered a program. It is definitely tied to the shell it runs in, as you wouldn’t call execv("true", {"/bin/true", NULL}) to exit a program correctly. for example. true has no use outside of the shell, so it makes sense to have it use the shell’s features. That is why now it tends to be a builtin. But having it a builtin is not specified by POSIX. Executing file on the other end, is, and the spec says the default exit code it 0 or “true”. By executing an empty file, you’re then asking the shell to do nothing, and then return true. So I guess it is perfectly fine for true to jist be an empty file. Now I do agree that such a simple behavior has (loke often with unix) way too many ways to be executed, ans people are gonna fight about it for quite some time! What about these?

                                                                                        alias true=(exit)
                                                                                        alias true='/bin/sh /dev/null'
                                                                                        alias true='sh -c "exit $(expr `false;echo $? - $?`)"'
                                                                                        

                                                                                        The one true true !

                                                                                        1. 1

                                                                                          It depends upon the system. There is IEFBR14, a program IBM produced to help make files in JCL which is similar to /bin/true. So there could be uses for such a program.

                                                                                          It also has the distinction of being a program that was one instruction long and still have a bug in it.

                                                                                          1. 1

                                                                                            “That is why now it tends to be a builtin.”

                                                                                            Makes sense. If tied to the shell and unusual, I’d probably put something like this into the interpreter of the shell as an extra condition or for error handling. Part of parsing would identify an empty program. Then, either drop or log it. This is how such things are almost always handled.

                                                                                      2. 1

                                                                                        That would mean every shell script would have to explicitly exit 0 or it will fail.

                                                                                        I don’t see how that follows.

                                                                                        Once the file is actually passed to the shell, it is free to interpret it as it wishes. No reasonable shell language would force users to specify successful exit. But what the shell does is not in question here; it’s what the OS does with an empty or unroutable executable, for which I am contending there is not an obvious behavior. (In fact, I think the behavior of running it unconditionally with the shell is counterintuitive.)

                                                                                        And read(100) does do something besides read 100 bytes.

                                                                                        You’re being pedantic. Obviously, under some circumstances it will set error codes, as well. It very clearly reads some amount of data, subject to the limitations and exceptions of the system; zero knowledge of Unix is required to intuit that behavior.

                                                                                        1. 7

                                                                                          I don’t see how that follows.

                                                                                          You claim the exact opposite behavior would have been equally reasonable. That is, the opposite of an empty shell script exiting true. The precise opposite would be an empty shell script—i.e. a script without an explicit exit—exiting false. This would affect all shell scripts.

                                                                                          Unless you meant the opposite of executing a file not loadable as an executable binary by passing it to /bin/sh, in which case I really would like to know what the “precise opposite” of passing a file to /bin/sh would be.

                                                                                          You’re being pedantic. Obviously, under some circumstances it will set error codes, as well. It very clearly reads some amount of data, subject to the limitations and exceptions of the system; zero knowledge of Unix is required to intuit that behavior.

                                                                                          No. Many people assume read will fill the buffer size they provide unless they are reading the trailing bytes of the file. However, read is allowed to return any number of bytes within the buffer size at any time.

                                                                                          It also has multiple result codes that are not errors. Many people assume when read returns -1 that means error. Did you omit that detail for brevity, or was it not obvious to you?

                                                                                          1. 6

                                                                                            If a file is marked executable, I think it’s quite intuitive that the system attempt to execute. If it’s not a native executable, the next obvious alternative would be to interpret it, using the default system interpreter.

                                                                                        2. 3

                                                                                          Saying the behavior is totally (or even partially) coincidental is a bit strong. You’re ignoring the fundamental design constraints around shell language and giving the original designers more credit than they deserve.

                                                                                          Consider this experiment: you pick 100 random people (who have no previous experience to computer languages) and ask them to design a shell language for POSIX. How would all of these languages compare?

                                                                                          If the design constraints I’m talking about didn’t exist, then it would indeed be random and one would expect only ~50% of the experimental shell languages to have a zero exit status for an empty program.

                                                                                          I strongly doubt that is what you would see. I think you would see the vast majority of those languages specifying that an empty program have zero exit status. In that case, it can’t be random and there must something intentional or fundamental driving that decision.

                                                                                          1. 7

                                                                                            I don’t care about how the shell handles an empty file. (Returning successful in that case is basically reasonable, but not in my opinion altogether obvious.) I’m stating that the operating system handling empty executables by passing them to the shell is essentially arbitrary.

                                                                                            1. 4

                                                                                              The reason for the existence of human intelligence isn’t obvious either but that doesn’t make it random. A hostile environment naturally provides a strong incentive for an organism to evolve intelligence.

                                                                                              As far as the operating system executing non-binaries with “/bin/sh” being arbitrary, fair enough. Though I would argue that once the concepts of the shebang line and an interpreter exist, it’s not far off to imagine the concept of a “default interpreter.” Do you think the concept of a default is arbitrary?

                                                                                          2. 1

                                                                                            It’s precisely specified, yes, but it’s totally coincidental that the specification says what it does.

                                                                                            laughs That’s really taking an axe to the sum basis of knowledge, isn’t it?

                                                                                        3. 2

                                                                                          yes an empty file signifying true violates the principle of least astonishment.However if there were a way to have metadata comments about the file describing what it does, how it works, and what version it is without having any of that in the file we’d have the best of both worlds.

                                                                                          1. 2

                                                                                            true being implementable in Unix as an empty file isn’t elegant—it’s coincidental and implicit.

                                                                                            But isn’t this in some sense exactly living up to the “unix philosophy”?

                                                                                            1. 3

                                                                                              No.

                                                                                            2. 1

                                                                                              Why is it weird that true need be a command at all?

                                                                                              1. 0

                                                                                                To me, the issue is whether it is prone to error. If it is not, it is culture building because it is part of the lore.

                                                                                              1. 1

                                                                                                I feel like you’ll have to project this into a higher dimensional space to properly optimize the minima.

                                                                                                1. 3
                                                                                                  • Designed and built a DNA analysis pipeline system using RoR for state/pipeline management and Kubernetes for application orchestration.
                                                                                                  • Designed and built a referral management platform w/JS widgets and API for integration options. (A referral is like, you refer another user and you get a month free).
                                                                                                  • Designed and built a simulation system for modeling nuclear proliferation risk.
                                                                                                  • Designed and rolled out a software engineering process to help a smallish (about 10) inexperienced group of devs do things in a more repeatable, predictable, and visible way.
                                                                                                  • Started stabilizing and modernizing an old codebase.
                                                                                                  1. 2

                                                                                                    private git repo on gitlab.

                                                                                                    1. 1

                                                                                                      Chaos reigns. I’ve been tasked with being the project manager for a month to try to impose some sanity and get things under control.

                                                                                                      It won’t work unless the CEO stops micromanaging devs. Also, a month is not enough.

                                                                                                      1. 13

                                                                                                        I said it before and I’ll say it again. This guy is pure toxic bullshit.