[luci] luci.fs.isfile tests break symlinked usb installs

Justin Hannah justin at carrierone.net
Fri Jan 2 20:40:36 CET 2009


I am, like many others, installing packages on external USB storage and 
then using the opkg-link script as described in 
http://wiki.openwrt.org/UsbStorageHowto to symbolic link files into the 
mtd storage.  The problem with this design is that applications do not 
show up in the menus at all because the test for files fails since its 
trying to detect what is installed with files and ignoring symlinks.

Luci application modules seem to use the luci.fs.isfile function defined 
in libs/core/luasrc/fs.lua a lot:

   function isfile(filename)
         return posix.stat(filename, "type") == "regular"
  end

As you can see, this would exclude symbolic links.  I think it would 
make a lot of sense to create a new function like isfileorsymlink or 
isreadable (?)  that would also follow symlinks and see if that file is 
readable, and then replace the use of the function where appropriate in 
applications testing to see if the file it depends upon is installed, or 
maybe theres a better use of POSIX stat.

Thanks.




More information about the luci mailing list