Skip to content

systemd-boot-builder.py: ignore profile names with invalid chars#114637

Merged
lukegb merged 1 commit intoNixOS:masterfrom
KaiHa:pr/fix-systemd-boot-builder
Apr 25, 2021
Merged

systemd-boot-builder.py: ignore profile names with invalid chars#114637
lukegb merged 1 commit intoNixOS:masterfrom
KaiHa:pr/fix-systemd-boot-builder

Conversation

@KaiHa
Copy link
Contributor

@KaiHa KaiHa commented Feb 28, 2021

Ignore profiles that have chars in their names that are not valid in
filenames on vfat filesystems.

fixes #114552

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Feb 28, 2021
Catch and ignore errors during writing of the boot entries.  These
errors could stem from profile names that are not valid filenames on
vfat filesystems.

fixes NixOS#114552
@KaiHa KaiHa force-pushed the pr/fix-systemd-boot-builder branch from 6f96cfc to e2be5dc Compare March 2, 2021 19:18
@lukegb lukegb merged commit 2136e90 into NixOS:master Apr 25, 2021
if os.readlink(system_dir(*gen)) == args.default_config:
write_loader_conf(*gen)
except OSError as e:
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this will ever work, because profile is undefined at this point...

This should probably be something like:

Suggested change
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(profile, e), file=sys.stderr)
print("ignoring profile '{}' in the list of boot entries because of the following error:\n{}".format(gen[0] if gen[0] else "system", e), file=sys.stderr)

Fixed in #132688.

@nlewo
Copy link
Member

nlewo commented Dec 16, 2022

I think this patch is not restrictive enough since it ignores errors such as "not enough space available" which are not related to the initial issue.

I proposed #206445 but it would be really nice if I could get some help to validate my PR: i didn't run it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixos-rebuild --profile-name crashes with some special characters while creating systemd-boot entry

5 participants