Skip to content

Conversation

@pmenzel
Copy link
Contributor

@pmenzel Paul Menzel (pmenzel) commented Oct 21, 2026 •

Using fakeroot bee … causes measurable overhead (Firefox: 11:34 instead of 17:37). Fake root only during install and packaging; configure and build run without faked’s overhead.

bee-mxqsub runs all of beesh under fakeroot, so every process of the
configure and build steps inherits `LD_PRELOAD=libfakeroot.so`, and
their stat, chmod and chown calls are all served by the one faked
daemon. Large packages pay for this most: the Firefox build on a full
256-processor MXQ node was killed while packaging:

    11:18.27 toolkit/library/build/libxul.so
    13:21.72 ipc/app/plugin-container
    14:38.60 E make[2]: *** Waiting for unfinished jobs....
    /home/pmenzel/bee-files/scripts/bee-mxqsub: line 1: 222979 CPU time limit exceeded (core dumped) ${sandbox[@]+"${sandbox[@]}"} fakeroot beesh "${beesh_args[@]}" "${beefile}"

Without the preload, the same `mach build` took 11:34 instead of 17:37.

With the new option `--fakeroot`, beesh starts faked right before the
install step and stops it after packaging, so only install, crosscheck
and packaging see a fake root. bee-files had to work around this one by
one so far, like firefox.be0 with `env -u LD_PRELOAD`.

Starting faked late also keeps its database clean. If the build deletes
files outside of fakeroot, faked keeps their ownership records, and a
new file reusing the inode inherits the stale owner. In a test, 8 of
300 files copied with `cp -a` or `mv` into the image had the owner
recorded for deleted files. With faked started at the install step,
there are no such records.

beesh does not reimplement fakeroot’s setup: it runs `fakeroot` as a
coprocess, which reports FAKEROOTKEY, LD_PRELOAD and LD_LIBRARY_PATH,
and keeps faked alive until its standard input is closed, by
bee_fakeroot_stop() or by beesh exiting. Under fakeroot already, beesh
says so and keeps using the existing faked daemon.

The new help lines are indented with tabs like the rest of the `<<-EOF`
here-document, which strips only tabs, although `git diff --check`
warns about them:

    src/beesh.sh.in:114: tab in indent.

Tested with a package whose Makefile installs with `-o root`, mode 4755
and `-o 1234`: the package built with `beesh --fakeroot` has the same
owners and modes as one built with `fakeroot beesh`, while the build
step ran with the real UID. A failing install leaves no faked behind.

Assisted-by: Claude Opus 5.5 (Claude Code) <noreply@anthropic.com>
@pmenzel Paul Menzel (pmenzel) changed the title RFC: beesh: Add --fakeroot to fake root only for install and packaging beesh: Add --fakeroot to fake root only for install and packaging Oct 21, 2026
Copy link
Contributor Author

@pmenzel Paul Menzel (pmenzel) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read for review.

Sign in to join this conversation on GitHub.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant