You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "alexguirre (via GitHub)" <gi...@apache.org> on 2024/10/28 08:17:05 UTC

[PR] fs/nfs: fix offset in append mode and attributes after create [nuttx]

alexguirre opened a new pull request, #14528:
URL: https://github.com/apache/nuttx/pull/14528

   ## Summary
   
   Fixes the following issues:
   - When opening a NFS file in append mode, its file pointer was at offset 0 instead of the end of file.
   
   - When creating a NFS file, the response read pointer wasn't advanced after reading the attributes_follows bool, which caused the attributes to be off by 4 bytes. For example, the file size read the GID.
   
   ## Impact
   
   NFS now has a more correct behavior, closer to other file systems.
   is
   ## Testing
   
   Simulator, with a NFS mount (`nsh> nfsmount 10.0.1.1 /nfs /export udp`) and the following test program:
   ```c
   int main(int argc, FAR char *argv[]) {
     for (int i = 0; i < 5; i++) {
       FILE *f = fopen("/nfs/test.txt", "a");
       long start_pos = ftell(f);
   
       fseek(f, 0, SEEK_END);
       long size = ftell(f);
   
       fseek(f, start_pos, SEEK_SET);
   
       const char* data = "Hello World";
       fwrite(data, strlen(data), 1, f);
   
       long end_pos = ftell(f);
       fclose(f);
   
       printf("size:%ld      start:%ld      end:%ld\n", size, start_pos, end_pos);
     }
   
     return 0;
   }
   ```
   
   Initial result:
   ```
   size:281466386776064      start:0      end:11
   size:11      start:0      end:11
   size:11      start:0      end:11
   size:11      start:0      end:11
   size:11      start:0      end:11
   ```
   After fix:
   ```
   size:0      start:0      end:11
   size:11      start:11      end:22
   size:22      start:22      end:33
   size:33      start:33      end:44
   size:44      start:44      end:55
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs/nfs: fix offset in append mode and attributes after create [nuttx]

Posted by "nuttxpr (via GitHub)" <gi...@apache.org>.
nuttxpr commented on PR #14528:
URL: https://github.com/apache/nuttx/pull/14528#issuecomment-2440861476

   [**\[Experimental Bot, please feedback here\]**](https://github.com/search?q=repo%3Aapache%2Fnuttx+13552&type=issues)
   
   
   
   The PR appears to meet the NuttX requirements:
   
   * **Summary:**  Clearly describes the issues fixed (incorrect file pointer in append mode and attribute offset issue in NFS).
   * **Impact:** Concisely explains the impact as improved NFS behavior. While not overly detailed, the test program suggests this fix aligns NFS with expected file system operations, likely not requiring user adaptation. The impact sections (build, hardware, documentation, etc.) are implicitly addressed as "NO" by omission, which is acceptable if no changes are expected in those areas. 
   * **Testing:**  Provides sufficient detail on the testing environment (simulator, specific NFS mount command) and includes a clear test program. The "before" and "after" logs effectively demonstrate the issue and its resolution.
   
   **Recommendation:** To further strengthen the PR, consider adding a brief comment explicitly stating that the impact sections are not applicable (e.g., "No changes to build process, hardware, documentation, etc."). 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fs/nfs: fix offset in append mode and attributes after create [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #14528:
URL: https://github.com/apache/nuttx/pull/14528


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org