Zucca

@Zucca@sopuli.xyz

This profile is from a federated server and may be incomplete. Browse more on the original instance.

bash coding standards?

i didnt care about how i wrote my bash scripts, coz i know theyd ultimately be used just by myself. but for the past few day, i’ve been working on this project, mk-blog which uses some bash scripts, there are chances that others might look at them. besides in work they’re asking me maintain a server. so why not learn the...

Zucca,

$() instead of

So much this!

Zucca,
  • utilize awk if you need to process (=more complex than just grepping) large amounts of text.
    • make your awk code conform to at least busybox awk for compability

I once did a sh script that needed (because I wanted a challenge?) to be compatible with vanilla Android shell too. So I needed to test it with regular bash, busybox and mksh+toybox. That was ‘fun’.

I’ve had some initial plans to spllit the code out from that project and develop a “shell” library that would ease building shell scripts that are compatible with different systems… But I bet someone else has already done that.

Zucca,

I would then assume those scripts weren’t written properly to begin with.

But yes, shell scripts should be used (normally) to automate some simple tasks (file copying, backups…) or as an wrapper to exec some other program. I’ve written several shell scripts to automate things on my personal machines.

However shell script can be complex program while at the same time being (somewhat) easy to maintain:

  • functions, use functions, alot
    • comment every function and describe what it expects in stdin or as an arguments
    • also comment what it outputs or sets

This way at least I don’t break my scripts, when I need to modify a function or some way extend my scripts. Keeping the UNIX philosophy inside shell scripts: let one function do one thing well.

And of course: YMMV. People have wastly different coding standards when it comes to personal little(?) projects.

Zucca,

Initially the bug report was shot down by systemd developer Luca Boccassi of Microsoft with:

Emphasis mine.

While MS at least tries to be good guy nowdays, I just can’t trust their code too much.

Zucca,

DOS (probably) ➡️ Windows95/98 and MacOS 7/8/9 ➡️ mkLinux ➡️ Gentoo ➡️ Arch Linux ➡️ Gentoo

So yeah. Pretty early on I concluded that Gentoo is the best for me.

Zucca, (edited )

Gentoo cured my distrohopping

Kinda the same with me, I’ve been using Gentoo the most of my life.

Zucca,

Zucca,

Like 65534 times.

So close to full 16-bit max. So close…

Zucca,

Gah. I should have stated “I see what you did there.” instead. ;)

Zucca,

I’ve always thought GOAT stands for Gentleman Of All Trades. I make a wild guess it’s Girl Of All Trades in this case?

Zucca,

TIL: that exists.

Zucca,

Yes.

Really the hardest part of desktop linux for a regular, so called “internet user”, in the installation.

They don’t have no clue how to install an operating system, even windows.

I once installed CentOS workstation for my father on his ThinkPad. Firefox and Libreoffice is all he needs. Automatic updates in the background make sure all the latest security patches are applied. There have been few time when, after the update, the laptop hangs at boot. I’ve since told him to choose the second-to-last boot option from the “start-up menu” until the fix for the bug has been deployed (usually in within a 24h).

So really using Linux isn’t the hard part. Back in 2004 (ish) I went the painful route of installing my first Linux - Gentoo. But boy I learned a lot from it. Yes, I had a helping friend to get me over the hardest parts.

Zucca,

That’s a really neat feature.

Zucca,

https://sopuli.xyz/pictrs/image/9d76b984-7539-47d2-9d83-3fc0f98c2b39.webp

Rolling with Gentoo here. Reinstall is not performed even when complete hardware upgrade has been done.

Zucca,

Well, yeah. Hard drive failure can force a reinstall. And with laptops there isn’t usually another place for a hard drive, from where to restore the system.

Zucca,

Sir, your thinking is certainly what kids call “next-level”.

Zucca,

sudo is a setuid binary, but it’s a fairly simple program

Some people would disagree to this.

The brief description of run0 already has too many potential points of failure.

If the “listener” is PID1, which will run the privileged command, in theory, it would be quite bullet proof (in a working system PID1 is always there). But since this is systemd, PID1 is much more than that and much more complex. On the other hand spawning another daemon from PID1 to be the “listener” makes it, perhaps, even more complicated. You’d have to make sure the listener is always running and have some process supervisor there to watch if it exits… and maybe even a watchdog polling it to make sure it isn’t frozen.

So my conclusion is the same as yours:

a solution in search of a problem

We already have a working solution. Have a well written SUID program. I’ve been using doas for some years now. It’s simple enough that I trust it.

Zucca,

Yeah. I keep one root tmux session open on my main PC for administrative tasks.

Zucca,

because it’s actually designed modular

Oh? Try to use systemd without logind or journald. logind isn’t so bad, but journald was bad enough, that I gave up with systemd.

Zucca,

Yes. I agreed with you. But I made it sound like something else. Bad wording on my side.

As I’m too Gentoo openrc user. I also use seatd+greetd instead of (e)logind and replacing sysvinit with openrc-init. The availability of choices made me do it!

Zucca,

Besed on the upvotes, it’s not only your opinion. 👍

Zucca,

Yikes.

I’d switch to musl on all of my boxes if it weren’t that nearly all precompiled software (closed source, games mainly) are compiled against glibc.

Zucca,

Void offers musl too. Unless they’ve discontinued it.

But

compile everything yourself?

I do (almost) exactly that. I run Gentoo almost everywhere. The ‘almost’ is because Gentoo now offers an official bin repository too, so I can mix compiled and pre-compiled software. (Although you’ve always had the option to set up your own binary host).

Zucca,

Nope. I mainly get my games (curretly around 10 only) from gog.

Zucca,

My short answer:

Should I switch to Wayland?

Yes.

Applications that don’t cope with wayland still work via Xwayland. Go ahead.

Linux 6.6 To Better Protect Against The Illicit Behavior Of NVIDIA's Proprietary Driver (www.phoronix.com)

Luis Chamberlain sent out the modules changes today for the Linux 6.6 merge window. Most notable with the modules update is a change that better builds up the defenses against NVIDIA’s proprietary kernel driver from using GPL-only symbols. Or in other words, bits that only true open-source drivers should be utilizing and not...

Zucca,

This is what’s wrong in so many countries.

Zucca,

My first Gentoo install took like a week to get X running. It was my first foray into Linux (Ok, I briefly tried mkLinux).

I learnt the hard way, but I learnt. And I’m still on that same path: Gentoo. Why I don’t bother switching? Because I can customize Gentoo to whatever I like, so instead of doing distro hop I just reconfigure things.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • fightinggames
  • All magazines