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)
Wed, Nov 20, 5:46 PM
Unknown Object (File)
Wed, Nov 20, 5:37 PM
Unknown Object (File)
Wed, Nov 20, 5:23 PM
Unknown Object (File)
Wed, Nov 20, 3:37 PM
Unknown Object (File)
Oct 25 2024, 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
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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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
251

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
251

hmmm, I like kyle's notion better.

stand/lua/core.lua
251

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.