I take my shitposts very seriously.

  • 3 Posts
  • 268 Comments
Joined 2 years ago
cake
Cake day: June 24th, 2023

help-circle
  • I think I see where your confusion comes from. Either that or you are writing programs with willful and reckless disregard to the importance of standards.

    A process (or program) has multiple outputs. The return code is a one byte value that is set by the process when it ends, and often checked by the parent process (interactive shell, script, program) to make decisions regarding the flow of control. This value is severely restricted in its usefulness, to “provide data”. The type (unsigned byte) limits the range and precision, and you can’t write to it asynchronously or before you’re ready to gracefully end the process. The name is deceptive: this is not the same kind of “return” as the return instruction in programming languages. It simply describes the way a process ended, nothing more. It should never contain meaningful data, and always adhere to the POSIX conventions.

    Why? Because everybody does. More than that, everybody writes programs that expect a return code of zero to mean success, and a return code other than zero to mean failure. It was decided before I was even born. It’s an implicit agreement that we adhere to (except Powershell because they’re special). Deviation from this will only lead to compatibility issues and confusion.

    If you want to convey meaningful data, you should use an output stream. The POSIX standard states that programs should communicate using strings, and that the standard input and output streams should be used for this unless other methods are needed. If your program produces meaningful data and you want to convey it to the parent process or another program, you have to write it to stdout, and the other program has to accept it via stdin. This exchange is facilitated by the shell through the pipe and redirection operators. It frees up the return code to meaningfully indicate the exit state of the program without mixing it up with the data produced by it, and once again, it’s what everybody does, and what everybody expects.


  • To be pedantic: there is no such thing as a boolean value. It’s all just bytes and larger numbers behind an abstraction that allows a higher-level programming language to implement Boolean algebra by interpreting numbers a certain way. One such abstraction is the POSIX convention of treating a return code of zero as success and everything else as a failure. This consequently defines how Boolean algebra is implemented in POSIX-compliant shells:

    • The if statement tests the return code of the command specified in the header, then executes the then branch if the return code is zero, the else branch otherwise.
    • The while loop similarly tests the command in the head and executes the body if its return code is zero.
    • The boolean && and || operators treat zero return values as true and nonzero return values as false. Go try it out.
    • Even the true and false commands are just programs that immediately return 0 and 1 respectively.

    If you start treating nonzero return codes like a success value with meaning, the only thing you’ll achieve is that your scripts won’t be compatible with the shell. stdout exists. Use it.



  • rtxn@lemmy.world
    shield
    Mtolinuxmemes@lemmy.worldPriorities
    link
    fedilink
    arrow-up
    81
    arrow-down
    40
    ·
    edit-2
    5 days ago

    Please observe rule 3 point 3:

    No porn, no politics, no trolling or ragebaiting.

    It goes both ways. The situation is still developing, whatever information you have might become obsolete an hour from now. If you need to air your feelings, this isn’t the right place for it. It’s also worth keeping in mind that the interaction that led to this controversy was nothing more than an already opinionated post and a reply from a Framework employee who has no say in who gets sponsored. Even the person who made the original post decided to “let it rest”.

    Be intelligent, do not be led into a smear campaign on somebody’s leash.






  • Thanks, that’s even more fucked up.

    What’s even even more fucked up is that the package still installs an executable to /usr/bin/firefox, but it’s just a wrapper script that launches the Snap application… and also replaces your desktop shortcuts, application launcher shortcuts, and favourites with its own Reforged Edition file if you’re running GNOME, Unity, MATE, or KDE Plasma.

    Excerpt from /usr/bin/firefox Canonical Edition(TM)
    # [...]
    
    # GNOME Shell
    OLD="firefox.desktop"
    NEW="firefox_firefox.desktop"
    FAVS=$(gsettings get org.gnome.shell favorite-apps 2> /dev/null)
    if echo "$FAVS" | grep -q "'$OLD'"; then
      NEWFAVS=$(echo $FAVS | sed -e "s#'$OLD'#'$NEW'#")
      gsettings set org.gnome.shell favorite-apps "$NEWFAVS"
    fi
    
    # MATE
    OLD="/usr/share/applications/firefox.desktop"
    NEW="/var/lib/snapd/desktop/applications/firefox_firefox.desktop"
    OBJECTS=$(gsettings get org.mate.panel object-id-list 2> /dev/null)
    for object in $OBJECTS; do
      object=$(echo $object | cut -d\' -f2)
      launcher=$(gsettings get org.mate.panel.object:/org/mate/panel/objects/$object/ launcher-location)
      if [ "$launcher" = "'$OLD'" ]; then
        gsettings set org.mate.panel.object:/org/mate/panel/objects/$object/ launcher-location "'$NEW'"
      fi
    done
    
    # [...]
    
    # TODO: handle other desktop environments
    
    exec /snap/bin/firefox "$@"
    

    I’d classify that as malware.


  • Install the OS, clone the config, rebuild, walk away and go to the next computer.

    Honestly, I’d automate it to be even fewer operations. The Windows process is already down to only four keystrokes, and three of them are just to boot into PXE. The fourth is just a pause to make sure every computer has booted into Clonezilla (Debian preloaded with the cloning software and my own scripts, pulled from a TFTP server) before they start pulling the Windows image and the network becomes saturated.


  • If it ever comes to pass, there will be an extensive evaluation to determine which tool is best suited for the job and the environment. The Prime Directive applies: we must not disrupt classes that are in progress or about to start unless they specifically ask for something.

    Support for atomic updates is one feature that I won’t compromise on, and while Ansible will definitely be part of the toolkit (on that note: fuck WinRM, all my homies hate WinRM), its idempotent model on its own is not enough to guarantee disruption-free deployments. If the process fails for any reason, the system must roll back to its last functional state. I don’t know if Nix can do that, but when it becomes relevant (so probably never in my professional capacity), I will find the right tool.

    (for the record, that is not my downvote)


  • I’ve tried, at least in theory, to migrate an entire university’s classroom computers to Linux. Even in the absence of technical limitations, the one obstacle I can’t overcome is entirely human. The living fossils Our esteemed tenured professors refuse to change their habits because they need their Netbeans, they need their Eclipses, they need their Visual Studios. In a lot of ways, it feels like wayland-protocols’ governance. A single NACK from a stubborn fool kneecaps the entire project, and now the university gets to spend hundreds of thousands of euros upgrading the computer labs because the perfectly usable computers are juuuust barely outside Win11’s requirements.

    Sidebar: Back when I was a student at that same university, when Windows was small enough to allow dual-booting with Ubuntu from the same SSD, my Prog-1 teacher insisted on using Joe. He hated Vim, Emacs, and Nano with an equal passion.


    Edit: Just to give some validation to the people who need it, I should point out that Nix would be the ideal OS. We use Clonezilla to deploy a painstakingly prepared golden image of Windows with all applications and configuration changes before every semester. If a teacher forgets to request a software (despite the five separate e-mails and posters around the university), we have to pray that it’s available either as an MSI or through winget, otherwise we have to manually remote into each affected computer (up to several hundred) and install it one by one.

    I would give my left testicle and half my liver for the ability to have a centrally hosted Nix config file that can be edited whenever and then deployed as the computers come online.


  • rtxn@lemmy.worldMtolinuxmemes@lemmy.worldUbuntu based distros
    link
    fedilink
    arrow-up
    22
    ·
    edit-2
    11 days ago

    That’s not the full picture.

    The proprietary store backend really isn’t consequential. Most websites are, and if you have a modern computer, you’ve got proprietary firmware running at ring -3. At best, it’s a distraction from Snap’s real issues.

    Snap packages are compressed filesystems, similar to squashfs. When an application is started for the first time, the filesystem has to be decompressed and mounted to the root filesystem, which (depending on the computer) can take a long time. It also litters your mount points with loopback devices.

    Snap’s sandboxing only works on systems running Systemd. No Devuan, no Artix, no Alpine; the packages will work, but without sandboxing.

    The worst part is Canonical’s desperate attempts to make snaps happen.

    …and I’m sure there’s more that I’m forgetting about.





  • Better out-of-the-box hardware support, in my experience. We have a machine learning server at work, it didn’t see the GPUs on Debian Bullseye with the driver versions specified by the manufacturer, but worked perfectly with Ubuntu Server out of the box.

    A distribution that is preconfigured by professionals has great value in a practical setting, even if that value has diminished in the eyes of the kind of person that Lemmy attracts. If I had tried to get Debian working by overruling the manufacturer’s instructions, I’d have to take responsibility for it, both its maintenance and the downtime and potential damage if I had fucked something up. With Ubuntu, I get to delegate at least part of the responsibility to Canonical (while covering my own ass), and that’s something you can’t backport.