On Sat, Jun 02, 2012 at 04:55:12PM +0930, David Gowers (kampu) wrote:
> On Sat, Jun 2, 2012 at 6:43 AM, James Paige <[email protected]> wrote:
> >> Actually, I can't believe I missed this before, but it looks like ALL
> >> files < 4096 bytes are affected. The filenames that have smaller sizes
> >> that were not affected were actually the names of directories.
> >>
> >> I am not sure why OPEN works at all on directories, but it does. The LOF
> >> when opening a directory appears to be nonsense.
> >>
> >
> > When using the Linux version of FreeBasic, you can always successfully
> > OPEN directories, and LOF is always 4096.
>
> This is rather academic, but.. is that true even for directories that
> aren't 4096 bytes in size (which is the default size for ext*) ?
Ah, yes, you are right. Some directories return other sizes.
> ---
>
> you can type in, for example, "spamfiles ('/tmp/foo8')" which creates
> a directory with 256 files inside. ('ls' tells me that this directory
> is 5160 bytes. larger nfiles produce larger directory size, for
> example 512 makes the directory 10280 bytes, 1024 -> 20520)
>
>
> SHORT VERSION: I suspect FreeBasic is just returning the actual
> directory size, which may vary according to the number of items
> inside. I guess the only alternative behaviour they could have chosen
> here is to return an invalid value like -1 for directories. But then
> you'd have problems if you really wanted to check the actual directory
> size (for example if you want to defer investigating large directories
> during a tree walking operation)
>
> I'm not sure what use it is to OPEN a directory, though ;)
Yeah, it is nonsensical. I thought it was a mistake, but when I tried to
report it as a bug on the FreeBasic forum, I got replies that make me
think that freebasic users in general are just a bit clueless about
Linux :(
FreeBasic on windows just refuses to OPEN a directory
> [using Python, opening a directory for reading is possible with the
> low-level descriptor-based access tools in 'os' module; AFAICS this
> seems to be only useful for chdir/chmod/chown, and stat. Nothing
> remarkable except being faster than doing these operations by name.]
>
>
> At the moment, I wonder whether this bug is a problem in how FB sets
> up file buffering on Mac. Buffer size == 4096?
I dunno. This bug is over my head, I am fraid :(
---
James
_______________________________________________
Ohrrpgce mailing list
[email protected]
http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org