<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bug Report: MFS File Open fails for append when file size = cluster size in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368704#M12167</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can confirm I've been using the edit mfs_init.c solution since January without issue. Now that MQX 4.2 is out and should have the issue resolved I will try that, if I can get past the printf linking issue I've been getting with my code in MQX 4.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 May 2015 14:01:24 GMT</pubDate>
    <dc:creator>ironsean</dc:creator>
    <dc:date>2015-05-21T14:01:24Z</dc:date>
    <item>
      <title>Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368698#M12161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Still working on getting MQX 4.1.1 on a K70 stable enough for for an update to our product. 6 weeks and counting.&lt;/P&gt;&lt;P&gt;My CTO wants me to ask if you guys have heard of unit tests. There cool. Give them a look on wikipedia.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Anyway, here's the bug:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We have found that when a file is exactly a multiple of the cluster size (in our case 4096 bytes) opening with filemode a or a+ fails (fopen returns null).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking through the code it seems that MFS_Move_file_pointer returns sets the error_code to MFS_EOF.&lt;/P&gt;&lt;P&gt;It seems that when the data ends exactly at the end of a cluster, MFS_get_cluster_from_fat returns CLUSTER_EOF as the new "current_cluster".&lt;/P&gt;&lt;P&gt;This sets the error_code to MFS_EOF, which doesn't seem unreasonable since we are seeking to the end of the file, however when we get back to _io_mfs_open, it sees this error and fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I *think* a simple fix is to check if the error_code is&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14125453257324253" jivemacro_uid="_14125453257324253"&gt;
&lt;P&gt;if( error_code == MFS_EOF ) {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error_code = MFS_NO_ERROR;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at line 462 of mfs_init.c (or thereabouts), but I am not an expert on FAT file systems, so I'm looking for confirmation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S.&lt;/P&gt;&lt;P&gt;Easy to replicate, just use the sh_write test app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Oct 2014 21:39:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368698#M12161</guid>
      <dc:creator>chrissolomon</dc:creator>
      <dc:date>2014-10-05T21:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368699#M12162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your bug report.&lt;/P&gt;&lt;P&gt;Yes, you are right. It is known issue. Unfortunately, append mode is implemented wrongly.&lt;/P&gt;&lt;P&gt;As workaround, please use r+/w/w+ modes instead of append mode and seeks manually according your needs.&lt;/P&gt;&lt;P&gt;Next MQX release will contain complete redesigned MFS subsystem which will solve this issue.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;RadekS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Oct 2014 12:56:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368699#M12162</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2014-10-07T12:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368700#M12163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris Solomon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm having this problem. I would like know if your solution solved the problem without side effect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 16:18:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368700#M12163</guid>
      <dc:creator>juarez</dc:creator>
      <dc:date>2014-12-10T16:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368701#M12164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wouldn't it make more sense to change the code that finds Cluster_EOF to simply not throw an MFS_EOF instead? Have you had any issues with that change?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Jan 2015 16:05:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368701#M12164</guid>
      <dc:creator>ironsean</dc:creator>
      <dc:date>2015-01-12T16:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368702#M12165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the late reply, been off the forums for a while. We have been using this for a few months now, in production, with no issues&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 02:56:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368702#M12165</guid>
      <dc:creator>chrissolomon</dc:creator>
      <dc:date>2015-05-20T02:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368703#M12166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;thank you for confirmation.&lt;/P&gt;&lt;P&gt;Just for make it sure. Did you use fix from your initial topic (edit mfs_init.c) or recommended solution with use r+/w/w+ modes instead of append mode?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, current MFS in MQX 4.2 was reworked and do not suffer this by this bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day,&lt;BR /&gt;RadekS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 12:08:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368703#M12166</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2015-05-21T12:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bug Report: MFS File Open fails for append when file size = cluster size</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368704#M12167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can confirm I've been using the edit mfs_init.c solution since January without issue. Now that MQX 4.2 is out and should have the issue resolved I will try that, if I can get past the printf linking issue I've been getting with my code in MQX 4.2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 14:01:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Bug-Report-MFS-File-Open-fails-for-append-when-file-size-cluster/m-p/368704#M12167</guid>
      <dc:creator>ironsean</dc:creator>
      <dc:date>2015-05-21T14:01:24Z</dc:date>
    </item>
  </channel>
</rss>

