https://github.com/KerfuffleV2 — various random open source projects.

  • 2 Posts
  • 14 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle





  • Thanks for the reply. Unfortunately, I could just use Any for that since Vec is 'static as long as the items are (and I don’t think you could use anyvec if the tiems weren’t static).

    I asked in the Rust Discord channels and it seems like my approach is fine. Even the mutable version is okay and doesn’t need to be unsafe if it returns the reference with self’s lifetime.


  • The more I think about it, the more I’m convinced the immutable slice version is safe. I’m pretty sure the mutable version in the playground is also safe because you can’t turn it into a mutable reference without consuming it and it requires a mutable reference to build.

    The mutable version is pretty inconvenient to actually use if you want to store the AnySliceMut and pass it to other functions. The other function would have to reconstruct it and pass it back once it was done with the mutable reference. But what if:

    // ^ impl AnySliceMut
        pub unsafe fn as_slice_mut(&mut self) -> Option<&'a mut [T]> {
            if TypeId::of::() != self.tid {
                return None;
            }
            Some(unsafe { std::slice::from_raw_parts_mut(self.ptr as *mut T, self.len) })
        }
    

    Obviously it’s possible to abuse but if I just do something like pass it to a function that takes a mut ref and that function doesn’t do anything weird like save the reference is this okay? MIRI is apparently okay with it: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=149ad441a1c66b3f1fd7f2107acbeccf



  • Are you using a distro with fairly recent packages? If not, then possibly you could try looking for supplementary sources that could provide more recent version. Just as an example, someone else mentioned having a similar issue on Debian. Debian tends to be very conservative about updating their packages and they may be quite outdated. (It’s possible to be on the other side of the problem, with fast moving distros like Arch but they also tend to fix stuff pretty fast as well.)

    Possibly worth considering that hardware can also cause random crashes, faulty RAM, overheating GPUs, CPUs, memory or overclocking stuff beyond its limits. Try checking sensors to make sure temperatures are in a reasonable range, etc.

    You can also try to determine if the times it crashes have anything in common or anything unusual is happening. I.E. playing graphics intensive games, hardware video decoding, that kind of thing. Some distros have out of memory process killers set up that have been known to be too aggressive, and processes like the WM that can control a lot of memory will sometimes be a juicy target for them.

    As you probably already know if you’ve been using Linux for a while, diagnosing problems is usually a process of elimination. So you need to eliminate as many other possibilities as you can. Also, it’s general hard for people to help you with such limited information. We don’t know the specific CPU, GPU, distribution, versions of software, what you were doing when it occurred, anything like that. So we can’t eliminate many possibilities to give you more specific help. More information is almost always better when asking for technical help on the internet.



  • Would a link to crates.io be enough here?

    I’d tend to say: probably not. It’s not that people don’t know that crates.io exists, right? So that’s not changing anything.

    or want to find a new crate for some topic I go to lib.rs

    And lib.rs will suppress the visibility of crates it thinks are “bad” and you’d never even know the crate existed to go look at the objective data on crates.io. Or let’s say a result comes up but it’s just an empty page with a link to crates.io: you won’t have enough information to know whether it’s worth going through the trouble of following a link to another site and a lot of people wouldn’t bother.

    So I don’t think that change really solves anything.



  • Do you have suggestions what the future of lib.rs should be?

    Not the same person, but my suggestions would be:

    1. Reverse the decision to go closed source. Making stuff less transparent isn’t really going to help, and the primary controversy is coming from philosophical differences not the code itself. You can’t practically (and really shouldn’t) hide your policies. So going closed source is just another thing for people to complain about.
    2. Allow opting out of the opinionated parts in a relatively easy way. You can’t force other adults to align with your philosophy here, and trying is just going to cause problems.
    3. Personally, I think a better approach to the opinionated part isn’t directly changing data or obscuring/deprioritizing results. What you could do instead is add a section that has some context about why you think certain categories/crates are harmful. This makes the information available but doesn’t force people to do any particular thing.

    I think by taking that approach you’ll avoid a lot of the backlash because you are allowing people a choice.

    I’m not a lawyer and this isn’t legal advice, but personally I’d be pretty careful about editorializing/moderating content in this kind of situation. Suppose someone publishes as crate that actively causes harm. Users download it and get their data stolen/wiped/whatever. Can they reasonably have an expectation that you should have protected them from that sort of thing? After all, you are editorializing the content and going so far as to moderate content that doesn’t cause direct immediate harm to an individual but even content that potentially is harmful to society.

    Possibly I should disclose that I avoid lib.rs currently because I don’t agree with the philosophy of editorializing crates and personally I hate opinionated stuff that doesn’t give me choice/control. I use open source software/resources specifically because I care about having a choice. We don’t disagree philosophically on points like the harm of crypto such as bitcoin, I just don’t like this approach to dealing with it. Also, painting all crypto stuff with the same brush can potentially delay less (or maybe even non-?) harmful alternatives that don’t involve wasting massive amounts of computation to no end.


  • You missed the other person’s point. It’s not a game and the consequences of ignoring the problem are likely to be massive.

    Also, you know who will be the absolute last to feel pain from stuff like climate change? The wealthy. The overwhelming majority of people that will be affected aren’t privileged and in fact the least privileged are going to suffer the brunt of it.

    You’re not going to punish the rich and powerful and make them regret their choices with this approach. By the time they’re even feeling moderate discomfort, you’ll be long gone.


  • I won’t do a single shit unless the people that are actually causing this crisis do something.

    Companies wouldn’t produce stuff but for people buying it. Naturally people who aren’t willing to stop buying the product aren’t going to do stuff like support legislature that makes it become a lot more expensive and/or difficult to acquire, or even forbidden entirely.

    So it’s political suicide for a politician to do something like that: they’ll just get voted out. Without regulations forcing companies to adhere to those restrictions, it’s basically business suicide to just do something that hamstrings the company’s ability to produce whatever product. Their competitors will just eat them.

    I’m not saying companies/the rich don’t have responsibility, they absolutely do. I really think that change, for the most part, has to start with the population in general though. I definitely strongly disagree with anyone saying that consumers don’t have at least equal responsibility.