Page MenuHomeFreeBSD

core.lua: follow symlinks when looking for bootable kernels
Needs ReviewPublic

Authored by leres on Sat, Mar 7, 9:47 PM.

Details

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71252
Build 68135: arc lint + arc unit

Event Timeline

leres requested review of this revision.Sat, Mar 7, 9:47 PM
stand/lua/core.lua
258

I'd much prefer we continue using ftype and just do an extra lfs.attributes if it's a symlink. stat(2) is super expensive in some of these environments, anything we can do to minimize the impact is ideal

At first I tried to find a DL_* that would identify a symlink but could not (I think I tried DT_LNK). I also tried debugging the logic using lua from the command line but wasn't easily able to figure out how to use the luafilesystem port from the command line...

I recently learned enough lua to write a wireshark dissector and was *not* impressed with the online documentation available.

I'm willing to take another run at this; where are the DL_* tokens defined?

At first I tried to find a DL_* that would identify a symlink but could not (I think I tried DT_LNK). I also tried debugging the logic using lua from the command line but wasn't easily able to figure out how to use the luafilesystem port from the command line...

I recently learned enough lua to write a wireshark dissector and was *not* impressed with the online documentation available.

I'm willing to take another run at this; where are the DL_* tokens defined?

We need to break it out here: https://cgit.freebsd.org/src/tree/libexec/flua/lfs/lfs.c#n445

If you can give me a day or two, I'm happy to fix this. This part of lfs is nonstandard, you would need to test with the userland harness we have in tools/boot. lua-img.sh && lua-test.sh

Address feedback and use ftype to permit symlinks.
Unfortunately lfs.DT_DIR is not defined so use magic value 10

Humm... I found that the value for lfs.DT_LNK will be 10 but I suck at git and my attempt to update this review didn't work. I tried:

git arc update 365c0df83f86c25000fc8d0863d53391f41b27a6

Not sure what I'm doing wrong.

I'm not in a rush to solve this, waiting a few days is fine.

Address feedback and use ftype to permit symlinks.
Unfortunately lfs.DT_DIR is not defined so use magic value 10