Bug #3248

sync sh(1) with FreeBSD to 2020 version

Added by piecuch 11 months ago. Updated 10 months ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


sh(1) was untouched for 5 years, so there was quite a lot of work with it. Here's a set of commits that syncs our sh(1) with theirs.

The commit order directly reflects my workflow. Some of these commits could probably be squashed/reordered but I kept it this way to keep it simple and let others decide whether we need that many commits.

- [1/10] - nuke dfly's bin/sh and paste current FreeBSD
- [2/10] try to compile sh, see it fails on kill.c so I synced sync kill.c with FreeBSD
- [3/10] try to compile sh, see a compiler warning, spot a bug in kill.c, fix it
- [4/10] try to compile sh, see it fails on test.c, sync test.c with FreeBSD (7 years diff), my work got interrupted
- [5/10] try to compile sh, see it fails on printf.c, sync printf.c with FreeBSD
- [6/10] test.c does compile fine but it's not fully synced, so why not complete the sync
- [7/10] sh and its dependencies are fully synced, so we adapt sh's Makefile (we replaced dfly's Makefile with FreeBSD's) and a couple of source files until build passes. buildworld wasn't working on any of the commits [1/10]..[6/10]
- [8/10] Once we can buildworld, we start applying the dfly-specific changes present in our tree before I started the procedure. This is continued in [9/10]. I haven't synced all the dfly-specific Makefile changes at this stage because I couldn't figure this out.
- [9/10] A continuation of [8/10], but this time it's just a single patch ported back from the past. It has an extra #ifdef to silence compiler warning (and erroring) about an unused label in some cases.
- [10/10] In [8/10] I couldn't figure out how to use DFly's Makefile (and build optimizations), but this is solved now. We throw out FreeBSD's Makefile, put back DFly's Makefile together with pregenerated files and call it done.

checksums (can't have more than 10 attachments):
f8132c17171690081f61343eeb9b7af82930bcaa5b95cde5cbe12c2b290ffeaabbae08c5aa25053346700e5f4fcd88ca1453d51ea4d50d31083cade063fade7d 0001-sh-1-bring-sh-from-freebsd.patch
588f61a05a8980d1ceca5a62e24e0d2852e18c4d126afbadfa698717edcfa300368996acdcf1839c74551c9a768bb86eabbae95b7d587c88235ac781356d7891 0002-kill-1-Don-t-kill-pid-1-on-overflow-from-strtol-3.patch
cfd9ba73e8e75f74a6ced87c84ff3298f9eb9c7679775fe8fe7e12961c198b1e56896860606f3588ae98b6d6a25e82314fc4bd4308cd4f495de93e8189aa9921 0003-sh-1-don-t-kill-everything-when-killjob-fails.patch
e8a1e8fdb13abb2173e163b06e83559a2b7aa18cd6326be34b7a25df574c7ad1004676bee0804e98c102a4a77779976501781b158ab5eedfb66a0968ed730ded 0004-test-1-sync-with-FreeBSD-up-to-93028985.patch
bfd5916557cbdf65c984f150aa6fefac3742dec85641ba4c108caacd790365dc5c0369d655ff3f09b29f93ceb29d7f6b732f64d31d5117553759943762b3c2bb 0005-printf-1-sync-with-FreeBSD.patch
67dd892fd05c2a16a5662852bb257e3d2413eefc42f5fb792438550661e46f8f322e6667ac1abdb7ec316b0de5d1cafb6a55c6bf4c193bbd8eaac4fd0446aa91 0006-test-1-sync-with-FreeBSD.patch
095fa31baf202354bc46c8287a548099c0efb2ed193fe375a5426c5ad8f99ddcf57a9e6d269a839611331bc6f30ea109700c286e0c05f1debdce7cac636dfa3f 0007-sh-1-Fix-compilation.patch
6695036f581b15827f88222eaad11fd8b0269b31db65911a3f85ef8f18a59e4bf61c55c16263e372cd0b49f20a08aa8e6312ec1318a0acacc25d14c5e5f3bfb0 0008-sh-1-Bring-back-patches-between-2234273d6fc-and-05bf.patch
ec3e34a6c71e51863b05242b257a6c747bda8657df3f22a124c104fa5e02757ee0a27ac4c3ae957c24b08f62d5b4a82d7340375e9c865fa0708dcf184e7e24b3 0009-sh-1-Reapply-330497ceac-fix-O_CLOEXEC-race-in-open-f.patch
bdf0c5b8a7668a97ff123c1d0d2f174c1e8f6c5bad9d34fcd68523b60b203bee43ef7d13ea9e5fcc9379d19797f5945fe256ae1e12fa6e68c12fc20bb448009d 0010-sh-1-bring-back-Makefile-changes-between-2234273d6f-.patch




Updated by piecuch 11 months ago

For some reason after all of these changes sh's Makefile needs an extra -I flag for libedit. I don't know why this is the case.


Updated by piecuch 10 months ago

[1/10] also pulls in sh/tests directory, we probably don't want that (or want to include them somehow in the makefile).


Updated by piecuch 10 months ago

  • Status changed from New to Closed

merged by swildner. thanks!

Also available in: Atom PDF