I see.  That is how factor distinguishes stat and lstat :)  Thanks.

Now I can try out the process on a folder with many subfolders and
with millions of files.
[ I wish in factor, there is a facility to make an iterator type of object
out of dirent. ]

--HP


On Wed, Sep 30, 2015 at 4:47 PM, Doug Coleman <doug.cole...@gmail.com>
wrote:

> You can do link-info instead.
>
> On Wed, Sep 30, 2015, 13:42 HP wei <hpwe...@gmail.com> wrote:
>
>> While trying out the word each-file,  I bumped into presumably
>> a bug in
>>
>> file-info ( path -- info )
>>
>> Under linux,
>> if the path is a softlink (symbolic link),
>>
>> path file-info symbolic-link?
>>
>> gives 'f'   ---- and this is wrong.
>>
>> I looked at the implementation of file-info
>> and saw that it calls file-status which in turn calls
>> stat-func.
>> The latter calls __xstat64  ---- this seems to be related to stat
>> function.
>>
>> Under linux, there are two functions that returns the stat-structure.
>> One is stat, the other lstat.
>> If a path is a symbolic link,
>> It is lstat that will return info about the link.
>>
>> -------------------------------------------
>>
>> As a result of this 'bug',  the following (as suggested by John the other
>> day)
>> could not do what is intended (to get the size of a folder).
>>
>> 0 a_path_to_folder t [ file-info dup symbolic-link? [ drop ] [ size>> + ]
>> if  ] each-file
>>
>>
>> --HP Wei
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to