Page MenuHomeFreeBSD

loader: lua: test that /boot exists first
ClosedPublic

Authored by manu on Dec 13 2021, 1:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 25, 5:30 AM
Unknown Object (File)
Oct 5 2024, 2:20 AM
Unknown Object (File)
Sep 22 2024, 8:08 AM
Unknown Object (File)
Sep 22 2024, 5:35 AM
Unknown Object (File)
Sep 21 2024, 10:07 AM
Unknown Object (File)
Sep 9 2024, 5:53 PM
Unknown Object (File)
Sep 9 2024, 5:52 PM
Unknown Object (File)
Sep 8 2024, 4:38 PM
Subscribers

Details

Summary

Otherwise on fs like tftp where no directory listing is possible we fail
on the .dir method.

MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

manu requested review of this revision.Dec 13 2021, 1:24 PM
stand/lua/core.lua
243

Any objection to moving this up above the autodetect bailout and doing something like...

if not lfs.attributes("/boot", "mode") then
    autodetect = "no"
    loader.setenv("kernels_autodetect", "NO")
end

?

Two benefits:

  1. adds a way to detect that autodetection was skipped rather than it failed
  2. less important, avoid a second stat() on /boot if we re-enter this (e.g., drop to loader prompt and re-enter)
imp added a subscriber: imp.

I'd prefer that we had a variable for "/boot" but that's orthogonal to this change.
However, we need a comment I think for why we do this.
I approved, but that's contingent on expanding the comment to explain why we short-circuit.

stand/lua/core.lua
243

I'm surprised we don't have a variable for "/boot"
However, you should add a comment above explaining why we short-circuit here, drawn from the commit message. It's weird enough that I think explaining why here will likely avert churn in this area in the future.

This revision is now accepted and ready to land.Dec 13 2021, 4:43 PM
stand/lua/core.lua
243

hmmm, I like kyle's notion better.

stand/lua/core.lua
243

Sure, will change this.

Move check up to disable autodetect.

This revision now requires review to proceed.Dec 14 2021, 8:41 AM
manu marked an inline comment as done.Dec 14 2021, 8:42 AM
This revision is now accepted and ready to land.Dec 14 2021, 5:31 PM
This revision was automatically updated to reflect the committed changes.