Threads for emilengler

    1. 9

      I think there’s a reason why languages like PHP once were created, despite having such a capable language as C/C++ widely available.

      It goes something like:

      You can write a fast program in C, but in perl/python/php you can write a program fast

      1. 4

        I don’t completely disagree, but I think there’s also other reasons for PHP picking up. For example it providing the 90s version of serverless, and no compilation being required.

        On top of that the fact that approaches to get closer to natural languages (in one way or another) as well as text processing were big goals, also easy interfacing with databases in the standard library.

        Times change, we see trends in the opposite direction. Ambiguity and expressiveness over simplicity are not the goal anymore, and people want things to look familiar, trading writing a few more understood constructs for simplicity. People prefer being explicit instead of implicit.

        An example of that is also how there’s a trend away from duck typing. Once that was a good thing, because it’s closer to natural language and less writing, and just like with natural language you were able to be shorter when many things are implied.

        Then we had a rise of Java style languages and now the interesting new languages are the ones copying much of the philosophy that people associate with C.

        Not saying people should use C or BCHS, but that a language isn’t bad because people follow different trends, learn other languages in school or similar. Popular languages tend to keep evolving and the ecosystems maturing.

        Of course that also means legacy as in “failed attempts”, old interfaces (see Go getting new network address types), unmaintained libraries, etc. accumulating and I have to admit the lack of these is really exciting about new languages. There’s usually also just less bad, ugly, buggy, unidiomatic code on very new languages.

        However, times have changed and given that there isn’t much too similar to BCHS, also because both the world and the technologies it depends on were at least different I think the existence of PHP doesn’t seem like a good argument against BCHS.

        Again, not saying you should use it or that PHP worse or better. Just that such general rules usually aren’t the best helpers for practical decisions.

      2. 5

        C is a straightforward, non-mustachioed language.

        So much to unpack here.

        1. 1

          It has full access to the kernel’s system calls and a massive set of development tools and libraries.

          I don’t think C the programming language has anything to do with syscalls. Which ones you have access to instead depending on which ones your standard library decides to implement wrappers for, same as many other languages. Granted on BSD this is likely most of them, but certainly isn’t guaranteed.

          1. 1

            I think you might have replied to this comment in error.

            1. 1

              Let’s pretend I replied one level up, or that I was also unpacking that section of the website. :)

              1. 1

                Sorry, I missed that you were referring to content on the same site. The phrase “non-mustachioed” was a thought terminator.

                I think the entire site is meant to be read as satire. “The internet is unsafe” - granted, but recommending C in that case is not best practices.

                httpd(8): OpenBSD’s home-grown web server. If you need more features for your web application, submit a patch.

                OK then.

                It’s not as if you can’t use a sane language like Perl on OpenBSD, it’s included in base for building.

      1. 6

        if you program and want any longevity to your work, make a game. all else recycles, but people rewrite architectures to keep games alive.

        – Why The Lucky Stiff

        1. 7

          git-checkout(1) is truly a very misleading command due to its various possible meanings (same with C static keyword). I hope these commands could make the situation better but I think it might be a lost race as git-checkout is already very established in the workflow of many users.

          1. 5

            I hope these commands could make the situation better but I think it might be a lost race as git-checkout is already very established in the workflow of many users.

            I think framing this as a “race” is kind of a false dichotomy; these commands can improve the ergonomics for people who find checkout confusing. I won’t be switching, but that’s because checkout’s behaviour has always felt intuitive to me, which is why it’s firmly established in my workflow.

            The new commands broaden the friendliness of git, they’re not “losing” just because I personally have no need to take them up. It’s not one or the other.

            1. 4

              The goal is definitely GNU-free, but yea, it still depends on gmake to build some packages. It’s the only GNU dependency, too. A gmake replacement would finish the job.

              1. 4

                Seems that you would have to replace freetype as well.

                Curious to read a little bit more about the rationale though. What’s so wrong about GNU software?

                1. 20

                  I think one advantage is that GNU has had something of a “monopoly” in a few areas, which hasn’t really improved the general state of things. The classic example of this is gcc; everyone had been complaining about its cryptic error messages for years and nothing was done. Clang enters the scene and lo an behold, suddenly it all could be improved.

                  Some more diversity isn’t a bad thing; generally speaking I don’t think most GNU projects are of especially high quality, just “good enough” to replace Unix anno 1984 for their “free operating system”. There is very little innovation or new stuff.

                  Personally I wouldn’t go so far so make a “GNU free Linux”, but in almost every case where a mature alternative to a GNU project exists, the alternative almost always is clearly the better choice. Sometimes these better alternatives have existed for years or decades, yet for some reason there’s a lot of inertia to get some of these GNU things replaced, and some effort to show “hey, X is actually a lot better than GNU X” isn’t a bad thing.

                  1. 8

                    A LOT of people have soured on GNU/FSF as a result of the politics around RMS and the positions he holds.

                    1. 3

                      A lot of people were soured on them long before that; the whole GPL3 debacle set a lot of bad blood, the entire Open Source movement was pretty much because people had soured on Stallman and the FSF, the relentless pedantry on al sorts of issues, etc. Of course, even more people soured on them after this, but it was just the last in a long line of souring incidents.

                      Was (re)watching some old episodes of The Thick of It yesterday; this classic Tucker quote pretty much sums up my feelings: “You are a fucking omnishambles, that’s what you are. You’re like that coffee machine, from bean to cup, you fuck up.”

                      1. 1

                        For sure. Never seen The Thick Of It but I love Britcoms and it’s on my list :)

                        I’ve always leaned towards more permissive licenses. We techies love to act as if money isn’t a thing and that striving to make a living off our software is a filthy dirty thing that only uncool people do.

                        And, I mean, I get it! I would love NOTHING more than to reach a point in my life where I can forget about the almighty $ once and for all and hack on whatever I want whenever I want for as long as I want! :)

                    2. 4

                      Yeah, when I hear “GNU” I think cruft. And this is from someone who uses emacs! (I guess you could argue it’s the exception that proves the rule, since the best thing about emacs is the third-party ecosystem).

                      And this is only about GNU as an organization, to be clear. I have no particular opinions on the GPL as a license.

                      1. 2

                        Even Emacs is, unfortunately, being hampered by GNU and Stallman, like how Stallman flat-out refused to make gcc print more detailed AST info for use in Emacs “because it might be abused by evil capitalists”, and the repeated drama over the years surrounding MELPA over various very small issues (or sometimes: non-issues).

                        1. 2

                          Yeah, it’s really unfortunate :/

                    3. 12

                      From the site:

                      Why
                      • Improve portability of open source software
                      • Reduce requirements on GNU packages
                      • Prove the “It’s not Linux it’s GNU/Linux …” copypasta wrong
                      1. 2

                        Why not? (I’m not affiliated with the project, you’d have to ask the people maintaining it)

                        1. 6

                          Yeah, “why not?” is a valid reason imvho. I would like to know which one it theirs in actuality. I often find that the rationale behind a project is a good way to learn things.

                          And fair enough, I assumed you were affiliated. FWIW, Freetype is not a GNU project, but it is indeed fetched from savannah in their repos, which I found slightly funny.

                          ETA: it also seems to be a big endeavor so the rationale becomes even more interesting to me.

                          1. 1

                            My rationale was partially to learn things, partially for the memez and partially as an opportunity to do things the way I want (all these people arguing about init systems, iglunix barely has one and I don’t really need anything more). I wanted to do Linux from scratch to learn more about Linux but failed at that and somehow this ended up being easier for me. I think I definitely learnt more trying to work out what was needed for myself rather than blindly following LFS.

                        2. 1

                          There is nothing inherently wrong with gnu software; I just like to have choice.

                          1. 1

                            Freetype is available under its own permissive license.

                            1. 1

                              That’s correct! I downloaded https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.11.0.tar.xz just to double check, and here is the license:

                              FREETYPE LICENSES
                              -----------------
                              
                              The FreeType  2 font  engine is  copyrighted work  and cannot  be used
                              legally without  a software  license.  In order  to make  this project
                              usable to  a vast majority of  developers, we distribute it  under two
                              mutually exclusive open-source licenses.
                              
                              This means that *you* must choose  *one* of the two licenses described
                              below, then obey all its terms and conditions when using FreeType 2 in
                              any of your projects or products.
                              
                                - The FreeType License,  found in the file  `docs/FTL.TXT`, which is
                                  similar to the  original BSD license *with*  an advertising clause
                                  that forces  you to explicitly  cite the FreeType project  in your
                                  product's  documentation.  All  details are  in the  license file.
                                  This license is suited to products which don't use the GNU General
                                  Public License.
                              
                                  Note that  this license  is compatible to  the GNU  General Public
                                  License version 3, but not version 2.
                              
                                - The   GNU   General   Public   License   version   2,   found   in
                                  `docs/GPLv2.TXT`  (any  later  version  can  be  used  also),  for
                                  programs  which  already  use  the  GPL.  Note  that  the  FTL  is
                                  incompatible with GPLv2 due to its advertisement clause.
                              
                              The contributed  BDF and PCF  drivers come  with a license  similar to
                              that  of the  X Window  System.   It is  compatible to  the above  two
                              licenses (see files `src/bdf/README`  and `src/pcf/README`).  The same
                              holds   for   the   source    code   files   `src/base/fthash.c`   and
                              `include/freetype/internal/fthash.h`; they wer part  of the BDF driver
                              in earlier FreeType versions.
                              
                              The gzip  module uses the  zlib license (see  `src/gzip/zlib.h`) which
                              too is compatible to the above two licenses.
                              
                              The  MD5 checksum  support  (only used  for  debugging in  development
                              builds) is in the public domain.
                              
                              --- end of LICENSE.TXT ---
                              
                          2. 4

                            Why would anyone want to write a GNU make replacement when GNU make exists?

                            1. 3

                              Having it under a more permissive license is a very valid reason though. Guess why FreeBSD is writing their own git implementation…

                              If the only tool for a task is closed-source then there is a project trying to make an open-source one. If the only open-source tool for a task is under a copyleft license then there is a project trying to make a non-copyleft one. Once a project is BSD, MIT or public domain we can finally stop rewriting it.

                              1. 2

                                If avoiding copyleft is the goal then the Linux kernel is a weird choice. And important parts of the FreeBSD kernel (zfs) are under a copyleft license too (CDDL).

                                1. 1

                                  I find OpenBSD to be one of the best choices as far as license goes. I’ve been slowly moving all my Debian machines to OpenBSD in the past year (not only because of the license, but because it’s an awesome OS).

                                  1. 1

                                    I haven’t tried using OpenBSD in earnest since are around 1998. I prefer a copyleft to a BSD style license personally but maybe I’ll take another look. And I hear that tar xzf blah.tar.gz might even work these days.

                                    1. 1

                                      It gets improved with every new major release, I’ve used it consistently for the past 3 or 4 releases and there’s always noticeable improvement in performance, user-land tools, drivers, arch support, etc. I’d definitely give it a try again!

                                2. 1

                                  This is fine reasoning but relativized. After all, I could just as easily say that if the only tool for a task is under a non-copyleft license, then there is a project trying to make a GNU/FSF version; once GNU has a version of a utility, we can stop rewriting it.

                                3. 2

                                  They don’t want to do that. They want a non-GNU replacement for GNU make

                                  1. 1

                                    They could just fork GNU make. That would work right?

                                    1. 4

                                      Or use bsdmake.

                                      1. 2

                                        bsdmake is in fact included, but it can’t build all gmake makefiles unfortunately.

                                        1. 3

                                          I used to do a fair bit of packaging on FreeBSD, and avoiding things like GNU make, autotools, libtool, bash, etc. will be hard and a lot of effort. You’ll essentially have to rewrite a lot of project’s build systems.

                                          Also GTK is GNU, and that’ll just outright exclude whole swaths of software, although it’s really just “GNU in name only” as far as I know.

                                        2. 1

                                          No bmake isn’t enough to build the Linux kernel

                                        3. 1

                                          Depends on their goals. Some people don’t like GNU or GPL projects. If that’s the case then probably not.

                                          1. 4

                                            If they don’t like GPL projects then using the Linux kernel is a weird choice.

                                          2. 1

                                            The entire point here is to not contain any GNU code, so no.

                                            1. 5

                                              zlib is derived from GNU code (gzip) so anything that includes zlib or libpng etc will “contain GNU code”. This includes for example the Linux kernel.

                                              1. 6

                                                He didn’t say they’ve achieved their goal. It’s still a goal.

                                                Why does it seem like you’re trying to “gotcha” on any detail you can refute?

                                                It’s just someone’s project.

                                                1. 3

                                                  I’m trying to understand the goal. If the goal is avoiding software that originated from the GNU project that is probably futile. The GNU project has been a huge, positive influence on software in general.

                                                  1. 5

                                                    You know the goal. They stated it. The parent comment to you stated it again.

                                                    It might be futile, but luckily we don’t control other peoples free time and hobbies, so they get to try if they want. You seem to be taking personal offense at the goal.

                                        4. 1

                                          For fun

                                      2. 3

                                        From the site:

                                        Iglunix is a Linux distribution but, unlike almost all other Linux distributions, it has no GNU software¹

                                        ¹With the exception of GNU make for now

                                        1. 1

                                          Yes I still haven’t been able to replace a couple projets. For self hosting gnu make is all that’s left, for chromium bison (and by extension gnu m4) and gperf are all that’s left.

                                        1. 4

                                          I wonder if somebody gona implement sqlite as an optional storage backend for Git’s ref and commit-graph. It would be interesting to see a benchmark against the current WIP reftable format.

                                          1. 10

                                            Somewhat related: SQLite itself uses the Fossil-SCM instead of Git which uses an SQLite DB to store its data.

                                            1. 3

                                              Yeah I have heard of Fossil but unfortunately its not that common as Git.

                                              Here is the context for what im suggesting for those who might be interested https://gitlab.com/gitlab-org/git/-/issues/6#note_501523892. Refs in Git are managed either in many files or concat into a single file plain text.

                                              It would be very interesting if somebody try using SQLite for it. I think most of the ground works are being done with the reftable format introduction that would help the tests in git.git to stop accessing the refs files directly and use API instead.

                                              1. 2

                                                I totally agree with you. The git storage format is only barely documented and not even standardized. This makes it really hard for alternative git implementations like got(1), git9(1) or OpenGIT to get going. An SQLite DB would offer standardization to at least some degree.

                                                Yeah I have heard of Fossil but unfortunately its not that common as Git.

                                                Fossil is not competing against Git though but goes hand in hand with it. This is especially notable that there is no limit on the amount of imports and exports you can do between Fossil and Git.

                                          1. 4

                                            Why use C89 in 2021? That’s a 32 year old standard. We have C17 now.

                                            1. 9

                                              Especially with C89 you have a huge variety of compilers available allowing you to run your code on nearly every architecture as well as checking your code for maximum standard compliance (some compilers are more liberal than others).

                                              With any C standard that is >= C99 you are effectively forced using clang or gcc.

                                              1. 4

                                                Can you give an example of an architecture that is only supported by a C89 compiler?

                                                1. 3

                                                  MS VisualC++ only began to add C99 support in Visual Studio 2013, and I’m not sure they support anything newer. So you’re no longer limited to C89 for Windows code these days, but there’s a long tradition of “keep your expectations very low if you want to write C and be portable to the most popular desktop OS”.

                                                  1. 3

                                                    According to this blog post they were working on C11 and C17 support last year. I don’t know how far they are with things they listed as missing.

                                              2. 4

                                                Later versions of the C standard are a lot less portable and a lot more complex. I use C89 when I want to write software that I know will be portable across many different machines and will work with nearly any C compiler. IMO, it doesn’t really make sense to target anything later than C11; C17 doesn’t make enough notable and useful changes to warrant using it.

                                                1. 1

                                                  Some old code bases, especially in the embedded space, are still written for it.

                                                1. 2

                                                  In the SiteDefinition there is find_video_direct_url() function. Is it a good abstraction, generic and flexible enough? What if some site requires composing the video from several pieces or does some other kind of streaming? Some sites may also require specific User-Agent headers or some cookies.

                                                  Maybe the SiteDefinition could return an input stream of bytes or get an output stream of bytes as a parameter and write to it.

                                                  BTW: I like your Code of Merit.

                                                  1. 1

                                                    I am not the author though

                                                    1. 1

                                                      You are right, downloading from several parts is not supported yet, resulting in a lack of support for (e.g.) YouTube playlists. I outlined a draft to fix this in issue #1 and I hope that someone helps me to make it. :-) Thank you for the suggestion.

                                                    1. 3

                                                      strlcpy is identical to the sprintf invocation from before, except it uses the correct size_t return type. This still means it fails to satisfy the performance requirements of 3 and 4

                                                      This isn’t true. I don’t know why this person thinks strlcpy is implemented in terms of snorintf, but of course it isn’t; that would be silly. I haven’t seen the implementation, but I have no reason to assume its performance is less than the optimized code at the start.

                                                        1. 1

                                                          What interface works best depends on your use. Are you reallocating the destination buffer if it is too small? Are you concatenating a lot of strings? Are you scanning a buffer copying out substrings?

                                                          Performing a strlen like this one can be dangerous because people might end up with accidentally quadratic code.

                                                          1. 2

                                                            Totally fair point! However even for such simple but critical functions I prefer to use a bullet-proofen implementation which strlcpy(3) and strlcat(3) are.

                                                      1. 2

                                                        I’m generally an enjoyer of the SQLite ecosystem and it’s always interesting how they come up with their own solutions cause other ones weren’t fitting: CVSTrac, Fossil-SCM, Lemon and apparently Althttpd which all look really neat in my opinion.

                                                        1. 10

                                                          Nice, super easy/quick upgrade from 6.8 using sysupgrade.

                                                          1. 4

                                                            Upgraded my server too. This time there sure wasn’t any manual work.

                                                            After sysupgrade, there was nothing to sysmerge, so I just pkg_add -u’d and rebooted again.

                                                            1. 5

                                                              While talking about pkg_add -u, it received a major boost in performance!

                                                          1. 6

                                                            I hope this might lead to a relicensing of Plan9 to a more liberal license than GPL. Many forks already did that maybe a newer license could bring back some unity

                                                            1. 29
                                                              1. 7

                                                                Why would that matter? Linux is under the GPL and it seems to do just fine. In fact, for an operating system it feels like the GPL might be the best option to prevent fragmentation and incompatibility.

                                                                1. 12

                                                                  The problem is that several Plan 9 forks license their contributions under a different license so up until now there’s no unity and that kinda sucks to check which part of the code is under which license

                                                                  1. 2

                                                                    Oh, gotcha, that’s unfortunate!

                                                                2. 3

                                                                  I don’t think that would help anything: folks who refuse to contribute their changes to the rest of the community (as required by the GPL) are unlikely to contribute those changes to the rest of the community when no longer so required.

                                                                  Sure, things like the BSDs exist, but their ecosystem is far, far smaller than the GNU ecosystem.

                                                                  1. 3

                                                                    That would be an issue for a usual open source project. The status of the plan 9 and its forks is: there are forks, with the plural ‘s’. Allow me to rephrase your statement: folks who refuse others’ changes are unlikely to accept those changes no matter what license they use.

                                                                1. 2

                                                                  Interesting design decision to avoid any heap allocation, even at the cost of performance.

                                                                  Thinking about performance, I started to idly wonder just how much of the work could be done at compile time, if you had a better meta programming framework than C macros.

                                                                  1. 4

                                                                    The costs appear much greater than performance. It looks like providing an invalid regex results in memory corruption: https://github.com/kokke/tiny-regex-c/issues/30

                                                                    1. 3

                                                                      Yeah, when I saw this library I considered all the potential bugs possible when implementing something as fiddly as regexes in a language as unsafe as C; then I backed slowly away.

                                                                      1. 1

                                                                        I mean, just because it’s in C doesn’t mean it’s untrustworthy. GNU Grep is written in C (over 3K lines, not including external helpers) and seems to work pretty well.

                                                                      2. 1

                                                                        That issue was closed as “fixed” a year ago, about 6 months after it was opened. The code now passes analysis by KLEE.

                                                                        1. 2

                                                                          The response from the maintainer made it seem like it was a design decision. And also, “If you are concerned about security problems, this library is not for you.”

                                                                          But good to see that it has been fixed. It looks like the maintainer has gone from “i don’t care about ub” to “let’s do formal analysis to prove it doesn’t happen.” That’s good.

                                                                      3. 2

                                                                        That decision is probably based on the intended platform:

                                                                        Most (all?) of my public projects are designed to be runnable on embedded platforms, and usually that means I make some harsh compromises.

                                                                        Static allocation makes it much easier to ensure that code won’t run out of memory on a device with very little of it.

                                                                        1. 1

                                                                          There is a template-based compile-time regex implementation in C++. I didn’t bookmark it, though; all I remember is it was written by a Russian woman about four years ago.

                                                                          I imagine this could be done in Rust, Nim or Zig, too.

                                                                          1. 2

                                                                            You mean this?

                                                                        1. 4

                                                                          This is by far the best resource for networking ever published. His guides aren’t boring as he even makes them entertaining and fun to read

                                                                          1. 2

                                                                            I recall being put of by the overly tongue-in-cheek tone. It distracted me from what I wanted to know. Though that might be because I wanted a reference manual, and what I was reading was more like a book.

                                                                          1. 8

                                                                            http://undeadly.org for anything OpenBSD-related

                                                                            1. 4

                                                                              About Dragonfly, but actually covering all BSDs to some degree.

                                                                              https://www.dragonflydigest.com/

                                                                              1. 3

                                                                                The weekly bsd and then one day later the weekly “cool stuff from the internet” are one of the posts I look forward to everyone week!

                                                                                1. 1

                                                                                  Absolutely. They manage to be the highlight from my tracked rss these days, quite often.

                                                                                2. 2

                                                                                  I second this.

                                                                              1. 12

                                                                                Some more interesting articles on the website, including: http://jehanne.io/2018/11/15/simplicity-awakes.html

                                                                                I wonder why GCC and not e.g. tcc, if simplicity is stated as the primary goal?

                                                                                The author ponders package management in one place, I’m curious if they’d like https://github.com/andrewchambers/hermes

                                                                                1. 4

                                                                                  I think the answer to this question is that much software relies on a (GNU) C standard not fully supported by tcc. As far as I know tcc only supports C89 fully (maybe even GNU89 although I am not sure)

                                                                                  1. 1

                                                                                    Is there an alternative minimal C toolchain that supports C11?

                                                                                    1. 7

                                                                                      cproc? The vast majority of packages in Oasis Linux are compiled with it

                                                                                      1. 1

                                                                                        Even if it supports C11, that wouldn’t be sufficient. Many applications use so called GNU C extensions (Linux for example) which are only fully supported by clang and gcc.

                                                                                  1. 3

                                                                                    As someone who is the target audience of this guide (programming experience but never written a single line of R in my life) I must say that this guide is pretty good. Short, simple and straightforward. Unfortunately many languages often only offer guides for total beginners which isn’t necessarily a bad thing but often boring for people with programming experience who just want to get started as fast as possible. This often leads to the skipping of chapters and therefore the missing of important information from those.