Possible bug in FAT dir listing
Till Straumann
strauman at slac.stanford.edu
Wed Jan 14 07:34:30 UTC 2009
Chris Johns wrote:
> Gene Smith wrote:
>
>> I formatted an MMC card on linux with gparted as FAT16. I copy one file
>> to it called freddy.txt I unmount and dump the partition with dd. The
>> root directory entry appears like this:
>> :
>> 003d5f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
>> 003d600: 4166 0072 0065 0064 0064 000f 0055 7900 Af.r.e.d.d...Uy.
>> 003d610: 2e00 7400 7800 7400 0000 0000 ffff ffff ..t.x.t.........
>> 003d620: 4652 4544 4459 2020 5458 5420 0000 9100 FREDDY TXT ....
>> 003d630: 2e3a 2d3a 0000 6eb5 2c3a 0300 1300 0000 .:-:..n.,:......
>> 003d640: 0000 0000 0000 0000 0000 0000 0000 0000 ................
>> :
>>
>> There are two entries. One starts with A and seems to be unicode of some
>> sort (32 bytes at 3d600) while the 2nd is conventional ASCII and is 32
>> bytes at 3d620.
>>
>> When I mount on rtems and do ls in the shell I see this:
>>
>> [/mnt] # ls
>> Af FREDDY.TXT
>>
>> The entry that starts with A shows up as "Af". From what I have read it
>> should actually be ignored and not printed because the byte at 3d60b is
>> 0x0f. The 0x0f is the file attributes indicating this is a volume label,
>> system file, hidden file and read-only. This is a key that it should not
>> be displayed. (Why this filename gets put in I don't know. I think
>> windows does the same.)
>>
>> Both of these sites mention that the attribute flag 0xf means don't show
>> the file:
>> http://www.win.tue.nl/~aeb/linux/fs/fat/fat-1.html
>> http://home.teleport.com/~brainy/lfn.htm
>>
>> This also explains why a volume label shows up as a file in rtems when
>> doing ls. It should be ignored too.
>>
>> AFAICT, there is no code in the rtems FAT library to ignore files when
>> these attribute flags are set. I only see the "directory" attribute
>> checked in some places.
>>
>>
>
> I think the FAT code is ok
Not sure - I vaguely recall encountering a similar problem
(w/o using your 'ls' command). Could this be related to PR#1273 ?
T.
> rather I suspect this is a result of the ls
> command's handling of the attributes for the directory. Could you please file
> a PR with RTEMS bugzilla ? I ported this command from Unix and it must have
> some issues.
>
> Regards
> Chris
>
>
>> -gene
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.com
>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>
More information about the users
mailing list