Bug 14988

Summary: kldload loads <file> from /modules even if <file> exists locally
Product: Base System Reporter: nn <nn>
Component: kernAssignee: dan <dan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description nn 1999-11-19 01:40:01 UTC
Very non-intuitively, "kldload file.ko" ignores the file "file.ko"
if it exists in the current directly and instead loads
file.ko from /modules if it exists there.

bofur# pwd
/home/nn/w/src/bcm42xx/freebsd
bofur# ls -l if_il.ko
-rwxr-xr-x  1 nn  epi  179942 Nov 18 17:24 if_il.ko
bofur# ls -l /modules/if_il*
ls: No match.
bofur# kldload if_il.ko
kldload: can't load if_il.ko: No such file or directory
bofur# kldload ./if_il.ko
bofur#

How-To-Repeat: see above
Comment 1 dan freebsd_committer freebsd_triage 1999-11-20 00:43:03 UTC
Responsible Changed
From-To: freebsd-bugs->dan

I'll take this if no one minds... 

Comment 2 peter 1999-11-20 13:26:00 UTC
nn@broadcom.com wrote:
> >Number:         14988
> >Category:       kern
> >Synopsis:       kldload loads <file> from /modules even if <file> exists loc
[..]
> >Description:
> Very non-intuitively, "kldload file.ko" ignores the file "file.ko"
> if it exists in the current directly and instead loads
> file.ko from /modules if it exists there.

This is actually as designed...

# sysctl kern.module_path
kern.module_path: /;/boot/;/modules/

If you want it to load from . you can set it to:  ./;/;/boot/;/modules/
and that will work.  It's done that way for the same reason we don't have
"." in the beginning of $PATH.

Cheers,
-Peter
Comment 3 dan freebsd_committer freebsd_triage 1999-11-20 19:32:28 UTC
State Changed
From-To: open->closed

This is actually a "designed feature".  Please see sysctl variable 
kern.module_path 

Cheers to: peter