Hey Ori, Great comments!
1. Second copy of utils. It's vendoring of a sort, not something uncommon, but you're absolutely correct in flagging this as it doesn't make much sense to do that in 9front. Would still be a necessity for 4e though: I did a fair bit of experimenting with ape/patch to conclude it's a dead end; ape/diff held up better but still not universally; some tests would fail with ape/diff but pass with 9front's. That's fine, I belive we can find some sort of solution: I'm not a big fan of dragging a copy of the vendored tools through every rebase either. 2. The use of ifs. You're correct in your suspicion that it may not be a straightforward replacement, and it wasn't. In fact, being aware of its intricacies, the largest body of work on this port I spent on was evaluating the effect of each such replacement on a case by case basis. I believe the ifs overrides I ended up putting forward all work as intended. 3. ape/patch and ape/diff. I don't think I kept ape/patch anywhere, but if you spotted anything, i'd appreciate leaving a comment on the line on github. The calls to ape/diff can be swapped with calls to the 9front's diff, system or vendored, I tried that before, it worked equally well. 4. asctime. I had a similar suspicion, and it blocked my previous attempts at backporting this few years back. This time, however, I chose to roll with it and see what happens. Luckily, the test coverage is quite extensive, and git/export | git/import all work as intended, as so does git/rebase (which relies on the pair). The very same tests invalidated my earlier attempts with ape/patch, clearly. I went through several rebases using the modified tooling, all seemed to preserve the time, but I can re-check to make sure, and update the tests (unless it's covered already). Good test coverage, loving it! Thanks for staying open-minded on this. I don't know how many folks here are interested in the cross-edition portability; I do run a mix of both, and even got github actions validating commits on one of my projects on both editions in parallel. And plan9port, too, so as to stay as portable as possible. Thanks, Yaroslav On Fri, May 8, 2026 at 10:29 PM <[email protected]> wrote: > > I'm happy sure that people messing with 4e/9legacy will appreciate > this, and I'm to collaborate to keep this up to date, but I think > the majority of this will not land in 9front. We changed 9front so > we could write better code with these changes. > > I'm not going to import a second copy of the utils that we already > ship; that's just invites having the copies get out of sync. > > The hardest change to verify is the use of ifs. `$sep{} is subtly > differnet from 'ifs=$sep `{}'. This is because $ifs affects the > internals of shell functions. As a demonstration, if you have a > function that cats multiple files: > > fn show{ > for(i in `{seq 10}) > cat /tmp/$i > } > > and want to get comma separated fiels from them: > > fields=`,{show `{seq 10} | tr '\xa' ','} > echo $#fields > > This works totally fine, but if you try to use ifs: > > ifs=, > fields=`{show | tr '\xa' ','} > echo $#fields > > then ifs affects the behavior of the 'show' function, and > we attempt to open a single file named '1 > 2 > 3 > 4 > .. > 10' > > Another problem here is that you have calls to ape/patch and ape/diff; > these will not work on 9front, because we removed them. Ape/patch was > a copy of Gnu patch from 1998, and it's busted. We would regularly get > segfaults from valid diffs on it, so we replaced the 15,160 lines of > patch with a native implementation which works better, at something > like 5% the size. > > We did the same with ape/diff, through in this case we modified the > version that we inherited, and removed 23,922 lines. So, the total > diff here is reducing the size by 38,000 lines, and remmoving a lot > of bugs. > > Finally, I'm not sure that using asctime will actually work; it'll > do the job for git/log, but generating valid git patches that can > be imported with 'git am' will require dates in a specific format. > > I'll take some time to look through this later to see if there are > changes that make sense to take to minimize the diff. > > Quoth Yaroslav K <[email protected]>: > > Hi all, > > > > I’ve completed a full backport of git9 to the 4th Edition / 9legacy > > environment. Earlier attempts existed, and I reviewed the 9legacy > > patches carefully, but even with all undocumented dependencies > > applied, the result still wasn’t in a state where the same codebase > > could run unmodified across systems. > > > > Instead of stacking more patches, I focused on the concrete > > incompatibilities that the port actually encountered: differences > > in rc syntax, flag parsing, libc interfaces, date/time formatting, > > awk behaviour, and the availability of certain helper utilities. > > None of these were major individually, but together they prevented > > a clean build and consistent behaviour on 4e. > > > > The goal was to make git9 edition-agnostic without forking much of > > the code. The result now builds and runs cleanly on both 9front > > and 4e/9legacy. > > > > In practical terms, this meant replacing newer rc constructs with > > legacy-compatible forms, avoiding the 9front-specific aux/getflags > > syntax, steering clear of newer libc calls like Bfdopen, using date > > formatting primitives available on both systems, working around awk > > differences, and importing a small set of auxiliary utilities so > > that behaviour matches across both environments. The PR contains > > the full details, but the overarching theme is reducing shallow > > incompatibilities rather than introducing edition‑specific branches. > > > > To install the port, use the contrib mechanism: > > > > contrib/install yk/git > > > > The RFC PR is here for anyone who wants to review or discuss the > > approach: > > > > https://github.com/9front/9front/pull/2 > > > > This is offered in the spirit of 9legacy: keep the older systems > > usable and interoperable without turning them into museum pieces. > > Feedback is welcome, especially from anyone running mixed environments > > or interested in cross‑edition compatibility. > > > > Thanks, > > Yaroslav Kolomiiets -- - Yaroslav ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Td167d7e8cebadcc4-M4da49053f5386b42619dcbd8 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
