[vlc-devel] vlc_loaddir always falis on Mac OSX

Rémi Denis-Courmont remi at remlab.net
Mon Oct 10 21:18:11 CEST 2011


	Naohiro-san hello,

Le lundi 10 octobre 2011 21:28:07 Naohiro KORIYAMA, vous avez écrit :
> Lua support is completely not working on VLC 1.2.0-git for Mac OS X.
> 
> Because vlc_loaddir always fails.
> vlc_loaddir calls vlc_readdir for getting files in the directory.
> In vlc_readdir, if there is no more files, fpathconf returns -1, but
> NAME_MAX is not defined at limits.h on Mac OS X, and ENOMEM is set to
> errno.

That seems odd. fpathconf() should not depend on the offset of the directory 
descriptor. The real problem is, readdir_r() does not accept a buffer length 
parameter:
"The storage pointed to by entry shall be large enough for a dirent with an 
array of char d_name members containing at least {NAME_MAX}+1 elements."
( http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html )

If NAME_MAX is undefined, *ahem* I do not know what that is even supposed to 
mean.

> When vlc_readdir returns NULL, if some value is set to errno,
> vlc_loaddir returns -1.
> So, vlc_loaddir always returns -1, and no lua scripts are found and
> processed.
> 
> Skipping the test of errno, lua scripts will run. On my test build, I
> can play youtube video with youtube.lua.

That would be one option. But scandir() is specified to return -1 on error. 
And even if we ignored the specification, make vlc_scandir() return a positive 
value and only set errno, the caller would still need to handle real I/O 
errors. So this is just tossing the problem around the code base really.

> I cannot decide how to modify, so I only report this issue.

I kludged around it.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list