<div dir="auto">Should the test .doc file be updated to include this test case?<div dir="auto"><br></div><div dir="auto">Is this a test case.worth running against other filesystems?</div><div dir="auto"><br></div><div dir="auto">--joel</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Dec 6, 2017 9:57 AM, "Christian Mauderer" <<a href="mailto:christian.mauderer@embedded-brains.de">christian.mauderer@embedded-brains.de</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Christian Mauderer <<a href="mailto:Christian.Mauderer@embedded-brains.de">Christian.Mauderer@embedded-<wbr>brains.de</a>><br>
<br>
If there is already a file with a long file name it isn't possible to<br>
create a second file which has a name that ends on the first files name<br>
(for example ets.beam and sets.beam). This patch fixes that.<br>
---<br>
 cpukit/libfs/src/dosfs/msdos_<wbr>misc.c     | 10 +++++++---<br>
 testsuites/fstests/<wbr>fsdosfsname01/init.c | 25 +++++++++++++++++++++++++<br>
 2 files changed, 32 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/cpukit/libfs/src/dosfs/<wbr>msdos_misc.c b/cpukit/libfs/src/dosfs/<wbr>msdos_misc.c<br>
index 79aaa36520..24eb2d11e0 100644<br>
--- a/cpukit/libfs/src/dosfs/<wbr>msdos_misc.c<br>
+++ b/cpukit/libfs/src/dosfs/<wbr>msdos_misc.c<br>
@@ -1564,9 +1564,13 @@ msdos_find_file_in_directory (<br>
                     if (entry_matched)<br>
                     {<br>
                         if (lfn_entry ||<br>
-                            lfn_checksum != msdos_lfn_checksum(entry))<br>
-                            entry_matched = false;<br>
-                        else if (name_len_remaining == 0) {<br>
+                            name_len_remaining > 0 ||<br>
+                            lfn_checksum != msdos_lfn_checksum(entry)) {<br>
+                            msdos_prepare_for_next_entry(&<wbr>lfn_start,<br>
+                                                         &entry_matched,<br>
+                                                         &name_len_remaining,<br>
+                                                         name_len_for_compare);<br>
+                        } else if (name_len_remaining == 0) {<br>
                             filename_matched = true;<br>
                             rc = msdos_on_entry_found (<br>
                                 fs_info,<br>
diff --git a/testsuites/fstests/<wbr>fsdosfsname01/init.c b/testsuites/fstests/<wbr>fsdosfsname01/init.c<br>
index d0c909877c..846faf28a3 100644<br>
--- a/testsuites/fstests/<wbr>fsdosfsname01/init.c<br>
+++ b/testsuites/fstests/<wbr>fsdosfsname01/init.c<br>
@@ -1097,6 +1097,30 @@ static void test_end_of_string_matches( void )<br>
   rtems_test_assert( rc == 0 );<br>
 }<br>
<br>
+static void test_end_of_string_matches_2( void )<br>
+{<br>
+  int rc;<br>
+  int fd;<br>
+<br>
+  fd = open( MOUNT_DIR "/ets.beam", O_RDWR | O_CREAT,<br>
+             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );<br>
+  rtems_test_assert( fd >= 0 );<br>
+  rc = close( fd );<br>
+  rtems_test_assert( rc == 0 );<br>
+<br>
+  fd = open( MOUNT_DIR "/sets.beam", O_RDWR | O_CREAT,<br>
+             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );<br>
+  rtems_test_assert( fd >= 0 );<br>
+  rc = close( fd );<br>
+  rtems_test_assert( rc == 0 );<br>
+<br>
+  rc = unlink( MOUNT_DIR "/sets.beam" );<br>
+  rtems_test_assert( rc == 0 );<br>
+<br>
+  rc = unlink( MOUNT_DIR "/ets.beam" );<br>
+  rtems_test_assert( rc == 0 );<br>
+}<br>
+<br>
 static void test_full_8_3_name( void )<br>
 {<br>
   int rc;<br>
@@ -1151,6 +1175,7 @@ static void test_file_with_same_name_as_<wbr>volume_label( void )<br>
 static void test_special_cases( void )<br>
 {<br>
   test_end_of_string_matches();<br>
+  test_end_of_string_matches_2()<wbr>;<br>
   test_full_8_3_name();<br>
   test_file_with_same_name_as_<wbr>volume_label();<br>
   test_dir_with_same_name_as_<wbr>volume_label();<br>
<font color="#888888">--<br>
2.12.3<br>
<br>
______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
</font></blockquote></div><br></div>