[PATCH] dosfs: Allow creating a file with similar name.
Christian Mauderer
christian.mauderer at embedded-brains.de
Wed Dec 6 15:09:24 UTC 2017
Hello Joel,
Am 06.12.2017 um 16:00 schrieb Joel Sherrill:
> Should the test .doc file be updated to include this test case?
>
I think that "Make sure short file- and directory names and long file-
and directory names are handled correctly for the default character set
(code page 850)" already covers that. It is a case where a file name
should be handled correctly.
> Is this a test case.worth running against other filesystems?
The bug has been (again) a bug that is quite specific to our FAT
implementation. It's more a test to prevent regression in case someone
(for example me) touches the much too complex function
msdos_find_file_in_directory() again. I would think it rather unlikely
that another file system has the same problem with names.
Regards
Christian
>
> --joel
>
> On Dec 6, 2017 9:57 AM, "Christian Mauderer"
> <christian.mauderer at embedded-brains.de
> <mailto:christian.mauderer at embedded-brains.de>> wrote:
>
> From: Christian Mauderer <Christian.Mauderer at embedded-brains.de
> <mailto:Christian.Mauderer at embedded-brains.de>>
>
> If there is already a file with a long file name it isn't possible to
> create a second file which has a name that ends on the first files name
> (for example ets.beam and sets.beam). This patch fixes that.
> ---
> cpukit/libfs/src/dosfs/msdos_misc.c | 10 +++++++---
> testsuites/fstests/fsdosfsname01/init.c | 25 +++++++++++++++++++++++++
> 2 files changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c
> b/cpukit/libfs/src/dosfs/msdos_misc.c
> index 79aaa36520..24eb2d11e0 100644
> --- a/cpukit/libfs/src/dosfs/msdos_misc.c
> +++ b/cpukit/libfs/src/dosfs/msdos_misc.c
> @@ -1564,9 +1564,13 @@ msdos_find_file_in_directory (
> if (entry_matched)
> {
> if (lfn_entry ||
> - lfn_checksum != msdos_lfn_checksum(entry))
> - entry_matched = false;
> - else if (name_len_remaining == 0) {
> + name_len_remaining > 0 ||
> + lfn_checksum !=
> msdos_lfn_checksum(entry)) {
> + msdos_prepare_for_next_entry(&lfn_start,
> +
> &entry_matched,
> +
> &name_len_remaining,
> +
> name_len_for_compare);
> + } else if (name_len_remaining == 0) {
> filename_matched = true;
> rc = msdos_on_entry_found (
> fs_info,
> diff --git a/testsuites/fstests/fsdosfsname01/init.c
> b/testsuites/fstests/fsdosfsname01/init.c
> index d0c909877c..846faf28a3 100644
> --- a/testsuites/fstests/fsdosfsname01/init.c
> +++ b/testsuites/fstests/fsdosfsname01/init.c
> @@ -1097,6 +1097,30 @@ static void test_end_of_string_matches( void )
> rtems_test_assert( rc == 0 );
> }
>
> +static void test_end_of_string_matches_2( void )
> +{
> + int rc;
> + int fd;
> +
> + fd = open( MOUNT_DIR "/ets.beam", O_RDWR | O_CREAT,
> + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
> S_IWOTH );
> + rtems_test_assert( fd >= 0 );
> + rc = close( fd );
> + rtems_test_assert( rc == 0 );
> +
> + fd = open( MOUNT_DIR "/sets.beam", O_RDWR | O_CREAT,
> + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
> S_IWOTH );
> + rtems_test_assert( fd >= 0 );
> + rc = close( fd );
> + rtems_test_assert( rc == 0 );
> +
> + rc = unlink( MOUNT_DIR "/sets.beam" );
> + rtems_test_assert( rc == 0 );
> +
> + rc = unlink( MOUNT_DIR "/ets.beam" );
> + rtems_test_assert( rc == 0 );
> +}
> +
> static void test_full_8_3_name( void )
> {
> int rc;
> @@ -1151,6 +1175,7 @@ static void
> test_file_with_same_name_as_volume_label( void )
> static void test_special_cases( void )
> {
> test_end_of_string_matches();
> + test_end_of_string_matches_2();
> test_full_8_3_name();
> test_file_with_same_name_as_volume_label();
> test_dir_with_same_name_as_volume_label();
> --
> 2.12.3
>
> _______________________________________________
> devel mailing list
> devel at rtems.org <mailto:devel at rtems.org>
> http://lists.rtems.org/mailman/listinfo/devel
> <http://lists.rtems.org/mailman/listinfo/devel>
>
>
>
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
--
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax: +49-89-18 94 741 - 08
PGP: Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list