[U-Boot] [PATCH v3 1/2] fs: fat: cannot write to subdirectories

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Jul 9 06:07:47 UTC 2018


On 07/09/2018 04:35 AM, Simon Glass wrote:
> Hi Heinrich,
> 
> On 1 July 2018 at 17:41, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>> fs_fat_write() is not able to write to subdirectories.
>>
>> Currently if a filepath with a leading slash is passed, the slash is
>> treated as part of the filename to be created in the root directory.
>>
>> Strip leading (back-)slashes.
>>
>> Check that the remaining filename does not contain any illegal characters
>> (<>:"/\|?*). This way we will throw an error when trying to write to a
>> subdirectory.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>>  fs/fat/fat_write.c | 16 +++++++++++++++-
>>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> It would be great if we have filesystem tests. We do have the
> fs-test.sh script but it is not using pytest, so best not to build on
> it.

There is a write test for FAT in
lib/efi_selftest/efi_selftest_block_device.c.
See patch "efi_selftest: test writing to file".

I agree having tests independent of the EFI subsystem would be a good idea.

Best regards

Heinrich


More information about the U-Boot mailing list