17 ms·
macOS Sonoma Broke Grep
- cstrahan 3y agoApple introduced a bug in grep that, under certain circumstances, causes grep to assert.
- alberth 3y agoLet’s not forget that macOS BSD userland utilities are also super old and outdated.
- stateofinquiry 3y agoSerious question, where is the effort going on each of these annual OS releases? I truly don't know, probably out of ignorance. Comparability with new HW? Supporting new file formats? As far as I can tell the headline feature of the latest MacOS is a screensaver with very large file sizes. Perhaps Apple and its many developers efforts would be better employed updating these essential tools and QA of the same.
- dagmx 3y agoThere’s tons of things that are new in every OS version The consumer facing site shows consumer facing features. Hence why you’d see things like screensavers and video effects highlighted. The developer side features are documented on videos released at WWDC each year. https://developer.apple.com/news/?id=cj1fjit2 https://developer.apple.com/news/?id=cj1fjit2 Or summarized in the Platform State of the Union https://developer.apple.com/news/?id=gxtoci7w https://developer.apple.com/news/?id=gxtoci7w
- stateofinquiry 3y agoThat is helpful- Thank you! There is a lot there indeed.
- pjmlp 3y agoGood enough for UNIX certification, though.
- mort96 3y agoI recently found out that Apple is shipping rsync 2.6.9. That's from 2006. It's missing a bunch of features, and I'm guessing a bunch of protocol improvements and security fixes...
- 0x0 3y agoIt's because newer versions of rsync switched license to GPL3 (from GPL2), and apparently Apple is not touching that with a ten foot pole. It's also why the included bash is frozen in time (and probably why they switched to zsh as the default interactive shell)
- tedunangst 3y agolol, I'm in this file.
- Aachen 3y agoAs tedu, or what do you mean?
- shassard 3y agohttps://github.com/apple-oss-distributions/text_cmds/blob/c0780aa3432383e0acde7dc7cf42972716925de6/grep/util.c#L3 https://github.com/apple-oss-distributions/text_cmds/blob/c0...
- Aachen 3y agoThat's the line I'm referring to indeed
- tedunangst 3y agoAye, though I checked the rev number and they apparently forked from before I added -o support, so I'm in the clear.
- deleted 3y ago[deleted]
- kevans91 3y agoWe (FreeBSD) should really reconcile our diff against OpenBSD and figure out what of the work I've done downstream makes sense and what doesn't. I'd imagine there's a healthy amount in both categories.
- nunez 3y agoSwitching to bsd grep is one of the first things I do on a new macOS install. The builtins are old as hell!
- cpressland 3y agoAny reason for picking the BSD variants of usedland tooling over the GNU ones?
- torstenvl 3y agoCan't speak for everyone, but for me... familiarity, hackability, simplicity, standards compliance. GNU coreutils deviate from POSIX in a number of instances. GNU coreutils are also verbose and potentially overengineered. Compare GNU ls.c (4726 LOC) to FreeBSD ls.c (1030 LOC), for example. Even if you include the other BSD source files used in ls, the FreeBSD version is still half the size of the GNU version. GNU grep is over 3000 LOC, whereas the FreeBSD version is 724.
- burntsushi 3y agoWhat kinds of patches have you made to the BSD coreutils programs that you use?
- torstenvl 3y agohttps://github.com/torstenvl/betterls https://github.com/torstenvl/betterls To be fair, one of these two flags comes built in with GNU ls, but using GNU ls comes with the downside of losing support for macOS extended attributes (and GNU ls doesn't have --group-dots-extra-first).
- Pet_Ant 3y agoI mean that seems like a simple patch to upstream if it’s a real deal breaker for you….
- soneil 3y agoInteresting - it only appears to affect me with --color set (which is a default alias, but if you unalias grep it stops exploding.)
- ArchOversight 3y ago% type grep grep is /usr/bin/grep % echo -n "a" | /usr/bin/grep -o 'b*' Assertion failed: (advance > 0), function procline, file util.c, line 732. zsh: done echo -n "a" | zsh: abort /usr/bin/grep -o 'b*' Your alias is not part of the macOS default.
- soneil 3y agoah, you're right - it looks like it was part of ohmyzsh. It appears I missed the -o; without it, my alias asserts, but unaliased doesn't. With the -o they both assert. Still not what I was expecting, but the failure to cleanly replicate it is mine.
- burntsushi 3y agoThe key here is that both -o and --color will force grep to fine every match on each matching line. And it looks like that triggers the buggy code path. Without those options, it's possible grep won't need to find each match on each matching line, but rather, just whether a line matches at all.
- mjsweet 3y agoMy partner is an Astrophysicist who relies on Gnu Emacs as her daily driver. Her work involves managing a treasure trove of legacy code written in a variety of languages like Fortran, Matlab, IDL, and IRAF. This code is essential for her data reduction pipelines, supporting instruments across observatories such as Keck 1 & 2, the AAT, Gemini, and more. Each time she acquires a new Mac, she embarks on a week-long odyssey to set up her computing environment from scratch. It's not because she enjoys it; rather, it's a necessity because the built-in migration assistant just doesn't cut it for her specialised needs. While she currently wields the power of an M1 Max MacBook Pro and runs on the Monterey operating system, she tends to stick with the pre-installed OS for the lifespan of her hardware, which often spans several years. In her case, this could be another 2-3 years or even more before she retires the machine or hands it over to a postdoc or student. But why does she avoid the annual OS upgrades? It's simple. About a decade ago, every OS update would wreak havoc on her meticulously set-up environment. Paths would break, software would malfunction, and libraries that used to reside in one place mysteriously migrated to another. The headache and disruptions were just not worth it. She decided to call it quits on annual OS upgrades roughly 7-8 years ago. While I've suggested Docker as a potential solution, it still requires her to take on the role of administrator and caretaker, which, in her busy world of astrophysical research, can be quite the distraction.
- bloopernova 3y agoIt might not be up to her requirements, but an Ansible playbook may help. It's what we use to set up new MacBooks and only runs in localhost mode. Ansible is fairly quick to learn, and can control homebrew so it's able to install a lot of stuff. If you're interested, ping me and I can share some snippets. Also I bet you'll get a reply from someone evangelizing Nix ;) EDIT: Oh, and git repo with dot files is very useful. As is homebrew bundle, which installs a list generated from a different host. EDIT 2: oh also I just moved MacBooks last week, so a lot of this fresh in my head right now. Including cargo/rust, VSCode profiles, brew bundle, ublock origin config, backups of .envrc files, etc etc ad infinitum. My Emacs config was actually about the easiest bit to move!
- MichaelZuo 3y ago
- saagarjha 3y agoI honestly feel like the fix here is replacing the assert with advance = advance > 0 ? advance : 1;
- mvdtnz 3y agoI dread every MacOS update. It's always so painful, you never know what they're going to break.
- bborud 3y agoTo make it more entertaining we should take bets on "what daemon will shit itself this release". Right now I'm staring at the calendar daemon. Spending 70-80% CPU syncing a calendar that hasn't been in use for a few years. If I had screwed up that badly I'd be embarrassed and keen to ship a fixed version pronto. Apple doesn't seem to give a shit about software quality.
- euroderf 3y agoA few years ago... I had stored some archives (more than ten years of personal stuff) directly under the file system root. A macos upgrade eliminated them. All of them. No warning in advance, no warning as it trashed my stuff. Really user-hostile.
- nocsi 3y agoYou're saying you store personal stuff right at '/'? Apple did give warnings it was going to push forward with securing the rootfs.
- euroderf 3y agoWhere ? Buried in some tech talk somewhere ? Hmph.
- bobbylarrybobby 3y agoThe right move would be to move it into /Users/softwareupdatefiles and require admin access to read (or something like that).
- bartvk 3y agoI really dislike these kinds of comments. You don't give any example, but you say "always painful"? Literally always? What exactly broke for you in the last three updates?
- raverbashing 3y agoYeah, grep '.' was broken in previous versions (maybe it's a zsh builtin, but it is broken), it would give you repeated lines
- sschueller 3y agoOpenssl is also "broken". As in if you generate a pfx export file using the openssl command included on macos you can not import the resulting pfx into the same machines Keychain. You have to use the legacy flag!
- rurban 3y agoAnd you have to use -passout for the -passin, or -noenc.
- lysium 3y agoIn one of the comments: that lower-cased LANG is invalid on macOS, so the system will silently default to LANG=C Oh my!
- yakubin 3y agoFTR it's about en_GB.utf8 vs en_GB.UTF-8. For a moment I thought it's about lang vs LANG which would be expected behaviour IMO.
- walthamstow 3y agoAnyone having better luck with a clean install vs upgrading to Sonama?
- munro 3y agoI immediately switched to GNU grep, I hate the built in Mac/BSD utils. And now i've completely switched to ripgrep <3
- DangitBobby 3y agoMy company uses Rippling with a security policy which forces you to install updates a few days after they are released (or it just closes all your shit without warning to install). Really hoping Sonoma doesn't break anything. So far I've never done a major OS update without spending at least an hour unfucking something that it broke.
- rsync 3y agoThe real news here is not that Grep got broken… The real news is that people who work at apple don’t use grep. (Or persistent ssh connections…) (Or multiple monitors…)
- soraminazuki 3y agoThere's nothing real about that assumption. What almost certainly happened is people didn't use the -o option enough to notice. Even less so in a way that triggers the bug.
- kazinator 3y agoLooks like the test suite isn't comprehensive enough to currently make it possible to work on that grep implementation with confidence.