• 14 Posts
  • 234 Comments
Joined 2 years ago
cake
Cake day: December 16th, 2024

help-circle











  • You might want to have a glance at the OpenSSF compiler hardening guide, and maybe try out ASAN (-fsanitize=address).

    E.g. I get

    [nobody@bb14e99a9c8e cldr]$ ./build/cldr --update --language C.
    caution: filename not matched:  ethical-tldr/pages.C./*/*.md
    
    =================================================================
    ==454==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 4 byte(s) in 1 object(s) allocated from:
        #0 0x7fa48a32c0c1 in malloc (/usr/lib/libasan.so.8+0x12c0c1) (BuildId: b8a4241051a1621937fdc46e867ba7ecb56d96ea)
        #1 0x7fa489e8be0f  (/usr/lib/libc.so.6+0x8be0f) (BuildId: 503200d7fda94a5dc6058d7e0694e5d1dcb2e372)
        #2 0x7fa48a2f2761 in vasprintf (/usr/lib/libasan.so.8+0xf2761) (BuildId: b8a4241051a1621937fdc46e867ba7ecb56d96ea)
        #3 0x561d84213d8c in strfmt (/home/nobody/cldr/build/cldr+0x6d8c) (BuildId: 2a0f13efc2c9b12a67e7dd810a2cbdfd1866e53d)
    
    SUMMARY: AddressSanitizer: 4 byte(s) leaked in 1 allocation(s).
    





  • That is Labour’s position, and if left unchecked, they will form majorities with the Conservatives and the right-wing populists to go through with that.

    The article I linked is from today and about the smaller greener parties’ opposition to drilling in LoVeSe and how they plan to use budget negotiations to get the government to commit to no drilling there. Currently only Labour is in government, as they failed to get more parties into government, instead relying on year-to-year budget negotiations with, uh, the Far Left, the Socialists, the Greens and the Agrarians (who are fairly populist and anti-climate-policies, no matter how much climate change wrecks their voters). The budget isn’t just moving NOK around, it also contains a whole lot of verbal agreements about what the government should do.

    So while there’s no majority for a general bill banning arctic oil exploration, the other parties can still negotiate for the government to leave it be, at the cost of some other stuff they’d like to get into the budget, as Labour still doesn’t want to have to resort to a line-by-line treatment of the budget in parliament.

    In Labour’s case it’s also a case of the main labour union umbrella organisation being very heavily influenced by the unions working in the oil sector. There are some other unions who are opposed to arctic drilling, and who would like to get the transition started before our customers start going away and we’re left with a very heavy case of Dutch disease. They’ve butted heads in the past, but I haven’t noticed any bickering recently, and the main union umbrella org itself just narrowly avoided having an oil guy becoming its leader (because he’d been sleeping with subordinates in the labour unions and Labour, not because of his policies).

    Might also add that the way Norwegian oil taxes work, there’s very little taxes on anything oil-related until they start turning a profit, at which point the taxes kick in, feeding the oil fund. So there’s not all that much incentive for the oil sector to avoid possibly unprofitable ventures, as those turn into huge tax writeoffs.

    Personally, seeing EV uptake accelerate this year, and the general exponential rollout of renewables, and developments in batteries, I suspect that by the time any arctic oil might find its way to the market, the market is going to be a lot less oil-and-gas-hungry, hopefully even to the point where pumping oil in the arctic isn’t actually a profitable venture.




  • Default/optional arguments: can be confusing when the default value is initialized.

    Yeah, which especially becomes an issue in languages with poor mutability controls. Probably the most benign variant of argument defaults would be restricting them to being const, or at the very least immutable including internal mutability. Instead we have situations like in Python where it’s necessary for linters to warn people that setting [] or some other mutable data structure as a default is a bad idea (e.g. B006).

    There’s also the issue that API designers may not want their parameter names to be part of the API

    Yeah, this is also something of a mixed bag, where

    • there are some cases where having the parameter name as part of the API is desirable,
      • e.g. if some parameter position both before and after a change is a T, but it’s used for different purposes,
      • though it is unclear whether that can’t always be better covered by using the type system better;
    • while in most cases being locked out of doing some trivial renaming for whatever purpose (like s/blacklist/blocklist/) because it would break clients is just a PITA.

    I wrote in another comment that I was partial to named arguments out of habit, but the more I think on it, I wonder if it’s not mostly a tool to work around missing type information and bad APIs, which, uh, may not be the most desirable thing to add to Rust.




  • When I do ls --help|less --raw-control-chars it doesn’t show the control characters, and it looks all neat and pretty. Isn’t this the opposite of how it’s supposed to work?!

    You’ve gotten a longer reply to this, but just to make it clear: No, that’s how it’s supposed to work.

    • By default less mangles control characters so they can’t do anything to your display (or bell)
    • With -R, less will pass some control characters through raw and unmangled; enough to give you stuff like pretty colours
    • With -r, less won’t mangle any control characters, which, if you’re doing something stupid like trying to read a binary file, can leave your terminal prompt fucked up and in need of a reset.