• 0 Posts
  • 120 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle
  • When I change devices or hit file size limits, I’ll compress and send things to my NAS.

    Whaaatt!?!!? That sounds like you don’t use git? You should use git. It is a requirement for basically any job and there is no reason to not use it on every project. Then you can keep your projects on a server somewhere, on your NAS if you want else something like github/gitlab/bitbucket etc. That way it does not really matter about your local projects, only what is on the remote and with decent backups of that you don’t need to constantly archive things from your local machine.



  • You could do a lot of things. Rust had a gc and it was removed so they have already explored this area and are very unlikely to do so again unless there is a big need for it that libraries cannot solve. Which I have not seen anyone that actually uses the language a lot see the need for.

    Not like how async was talked about - that required a lot if discussion and tests in libraries before it was added to the language. GC does not have anywhere near as many people pushing for it, the only noise I see is people on the outside thinking it would be nice with no details on how it might work in the language.


  • So someone that is not involved in rust at all and does not seem to like the language thinks it will get a GC at some point? That is not a very credible source for such a statement. Rust is very unlikely to see an official GC anytime soon if ever. There are zero signs it will ever get one. There was a lot of serious talk about it before 1.0 days - but never made it into the language. Similar to green threads which was a feature of the language pre 1.0 days but dropped before the 1.0 release. Rust really wants to have a no required runtime and leans heavy on the zero-cost abstractions for things. Which a GC would impose on the language.


  • There are quite a few places where a GC is just not acceptable. Anything that requires precise timing for one. This includes kernel development, a lot of embedded systems, gaming, high frequency trading and even latency critical web servers. Though you are right that a lot of places a GC is fine to have. But IMO rust adds more than just fast and safe code without a GC - lots of people come to the language for those but stay for the rest of the features it has to offer.

    IMO a big one is the enum support it has and how they can hold values. This opens up a lot of patterns that are just nice to use and one of the biggest things I miss when using other languages. Built with that are Options and Results which are amazing for representing missing values and errors (which is nicer than coding with exceptions IMO). And generally they whole type system leads you towards thinking about the state things can be in and accounting for those states which tends to make it easier to write software with fewer issues in production.


  • but imagine if you have to perform this operation for an unknown amount of runtime values

    This is a poor argument. You dont write code like this in rust. If you can find a situation where it is an actual issue we can discuss things but to just say imagine this is a problem when it very likely is not a problem that can be solved in a better way at all let alone a common one is a very poor argument.

    Typically when you want an escape from lifetimes that means you want shared ownership of data which you can do with an Arc. Cow and LazyLock can also help in situations - but to dismiss all these for some imagined problem is a waste of time. Comes up with a concrete example where it would help. Very likely you would find another way to solve the problem in any realistic situation you can come up with that I would suspect leads to a better overall design for a rust program.

    I would say this is just a straw man argument - but you have not even created a straw man to begin with, just assume that one exists.


  • For someone only on chapter 7, this is ok. I would not call it idiomatic but you have not gotten to the Error Handling in chapter 9 yet. I would probably hold on getting feedback on error handling until you have gotten to that point.

    But the TLDR of it is rust has two forms of errors, unrecoverable errors in the form of panic and recoverable ones in the form of returning a Result. In this case you have opted for panicking which IMO is the wrong choice for something that is expected to fail - and http requests and parsing external data is expected to fail (even if only some of the time). Networks fail all the time, servers go down, send back wrong responses and many other things.

    Do you really want to crash your program every time that happens? Probably not - at least not at this level. Instead you likely want to return an error from this function and let the caller deal with it instead as they will likely have more context as to what to do with it rather than in the leaf functions of where the error originates.


    But all that is probably for once you have read through chapter 9. For now it is good to know that when you have the pattern

    match foo {
        Ok(value) => value,
        Err(err) => panic!("it broke! {}", err),
    }
    

    You can generally replace that with a call to expect instead:

    foo.expect("it broke")
    

    Or just unwrap it if you dont need to add more context for what ever reason.


  • It doesn’t technically have drivers at all or go missing. All supporting kernel modules for hardware are always present at the configuration level.

    This isn’t true? The Linux kernel has a lot of drivers in the kernel source tree. But not all of them. Notably NVIDIA drivers have not been included before. And even for the included drivers they may or may not be compiled into the kernel. They can and generally are compiled with the kernel but as separate libraries that are loaded at runtime. These days few drivers are compiled in and most are dynamically loaded depending on what hardware is present on the system. Distros can opt to split these drives up into different packages that you may or may not have installed - which is common for less common hardware.

    Though with the way most distros ship drivers they don’t tend to spontaneously stop working. Well, with the exception of Arch Linux which deletes the old kernel and modules during an upgrade which means the current running kernel cannot find its drivers and stops dynamically loading them - which often results in hotplug devices like USB to stop working if you try to plug them in again after the drivers get unloaded (and need a reboot to fix as that boots into the latest kernel that has its drivers present).


  • I don’t get it? They seem to be arguing in favor of bootc over systemd because bootc supports both split /usr and /usr merge? But systemd is the same. There is really nothing in systemd that requires it one way or another even in the linked post about systemd it says:

    Note that this page discusses a topic that is actually independent of systemd. systemd supports both systems with split and with merged /usr, and the /usr merge also makes sense for systemd-less systems.

    I don’t really get his points for it either. Basically boils down to they don’t like mutable root filesystem becuase the symlinks are so load bearing… but most distros before use merge had writable /bin anyway and nothing is stopping you from mounting the root fs as read-only in a usr merge distro.

    And their main argument /opt and similar don’t follow /usr merge as well as things like docker. But /opt is just a dumping ground for things that don’t fir the file hierarchy and docker containers you can do what you want - like any package really nothing needs to follow the unix filesystem hierarchy. I don’t get what any of that has to do with bootc nor /usr merge at all.



  • TLDR; yes it does affect security. But quite likely not by any meaningful amount to be worth worrying about.

    Any extra package you install is extra code on your system that has a chance to include vulnerabilities and thus could be an extra attack vector on your system. But the chances that they will affect you are minuscule at best. Unless you have some from of higher threat model then I would not worry about it. There are far more things you would want to tackle first to increase your security that have far larger effects than a second desktop environment being installed.



  • nous@programming.devtoLinux@lemmy.mlShould I be worried?
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    15 days ago

    If you have everything you need backed up you can reinstall on a new hard drive and restore everything you need. So you should not be completely fucked. Just an inconvenience you might have to go through. You will lose the stuff not backed up so if any of that is a pain to get again it might be more painful to restore everything.

    Others have said some thing you might want to try. But having a spare disk you can swap to is never a bad idea. Disks to fail and you should plan for what to do when they do. Backing up your data is a good first step.

    I would say it is not a bad idea to just get a new disk now and go through the process of restoring everything anyway - you can treat it like your disk has failed and do what you would need to do to restore. With the ability to swap back when you need to.

    This is a good way to find things you might have missed in your backups.




  • I no longer use git stash. I found far too many issues with it. Merge conflicts and old no longer useful stashing building up, forgetting what was on it and which branch it came from and other things. These days the only time I stash is with --autostash on a git rebase as that is very temporary.

    Instead I have moved to a worktree where I just commit everything on the main branch. Then use a different worktree to create a branch and cherry pick from main and create prs from that branch.

    No need to stash as my main worktree never changes off the main branch and my second worktree never has local changes that are not committed.

    If I need to change focus or fix a bug I can just do that, commit those changes only and cherry pick to a new branch all without affecting my current work (assuming I have not changed the area the bug is in too much but that is not a big issue if you keep commits small and create PRs often so you don’t drift too far from master).

    If I have drifted too far I can always create a new worktree from origin and not touch my local main.




  • When people want memory safety, it’s exactly because they don’t want a garbage collector.

    Everyone should want memory safety and garbage collection is a form of memory safety. A form that enforces the safety at runtime and comes with a steep cost there. People use unsafe languages not because of their lack of safety but because they don’t want to pay the costs involved.

    Even rust has a cost - but that is on the compiler and developer instead of at runtime. Rusts memory safety makes the compiler and language a bit more complex so is a bit more to learn to get a program to compile - which is a cost to the developer. Though IMO it does make it easier to write correct code.

    Memory safety without a runtime cost is what rust is selling.


  • Rust syntax is badly designed compared to most other languages I used

    It really isn’t badly designed. Yeah there are more symbols than you are used to from JS/Typescript world. But more symbols does not mean bad syntax. It makes things more explicit which IMO makes things easier to read and understand what is going on. Rather than all the implicit behavior in JS/TS.

    Let’s take a look at hashmaps vs json

    What is the point of this? Lets compare two different things to prove no point! Look I can do it to:

    let person = Person {
      name: "joe".to_string(),
      age: 23
    }
    
    const scores = new Map();
    
    scores.set('Name', Joe);
    scores.set('Age', 23);
    
    

    Why would you construct a map like this? That is not what maps are for in either JS or rust. But either way all these examples are easy to read and can tell what they are doing even if you have not coded the language before. Now you do need more of an understanding of rust code to read some rust code but not these examples given.

    Every single library in rust is half-baked.

    That is just hyperbole. Many rust libraries are very mature now. Not having a website is not a sign of maturity and the docs for axum are very good in rust docs site. If you really want a webserver with a website then you have actix-web. Many rust projects do have sites like this or even books on how to use them. And if you look at the JS ecosystem, how many libraries do you use there that have nothing more then a readme on their github page? IMO I tend to find far worst documentation for JS libraries then I do for rust ones - if you look beyond the big things like react.

    No GUI framework is as stable as something like Qt or GTK

    This is true of basically all languages but C/C++ and maybe JS. Most languages just lean on these for good UIs, but there is a lot of effort ATM in getting nicer GUI support in native rust. It will come with time but a GUI library is a complex thing to make.

    literally every rust project has like 1 dev maintaining it in his free time and has “expect breaking changes” in the readme

    This is just more untrue hyperbole.

    Apparently everyone loves dealing with hours and hours of debugging basic problems because it makes you a better programmer, or there’s some information I’m just missing.

    One of the things I love about rust is I don’t need to spend hours and hours debugging basic problems because the language is explicit and makes me think better about things upfront. Rather then spending hours wondering why something is producing weird output at runtime because something somewhere else got a "1" instead of a 1. It takes a bit more effort to get something to compile, but I find vastly fewer surprises at runtime then I do in other languages. And it is those runtime bugs that take the most amount of time to solve.

    When you’re running a company you don’t have time to mess around with syntax quirks, you need thinks done, stable and out the door

    You also don’t want things to break in production and have to spend hours and hours debugging some weird edge case.