You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/09/15 15:27:43 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

xiaoxiang781216 opened a new pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794


   ## Summary
   because:
   1.The name of directory may terminated by the whitespace
   2.inode_search can handle the trailing '/' correctly
   
   ## Impact
   
   ## Testing
   
   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Ouss4 merged pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
Ouss4 merged pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794#issuecomment-696291691


   @xiaoxiang781216 Did you see the commit message that added this part?
   
   > I see the following behaviour on NuttX 7.26, where I have SD card mounted on /flash and a directory called "frm" on it:
   > 
   > opendir("/flash")  returns  (DIR *) 0x1000c580
   > opendir("/flash/") returns (DIR *) 0x1000c5d0
   > opendir("/flash/frm")  returns (DIR *) 0x1000c620
   > opendir("/flash/frm/")  returns (DIR *) 0x0
   > 
   > From POSIX specs for opendir(): "A pathname ... that ends with one or more trailing slashes shall be resolved as if a single dot character ( '.' ) were appended to the pathname."
   > 
   > So for mount points, opendir() works correctly, but for FAT32 filesystem it fails to open directory if the path has a trailing slash. I'm not quite sure how to cleanly fix this. Stripping the trailing slash in opendir() would require allocating a separate buffer, while fixing it in the FAT32 code seems somewhat complex due to the short/long filename logic.
   > 
   > It is not a big issue for me, I'm just going to fix it on the application side. But still a small portability and standards compliance issue.
   > 
   > NOTE: You would not see this problem if you call opendir() indirectly in NSH (like 'ls -R /') because NSH contains logic to remove trailing '/' characters from paths.
   
   Is that not an issue anymore?


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Ouss4 merged pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
Ouss4 merged pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794#issuecomment-696547055


   @Ouss4 Iprovide a path fix the FAT filesystem directly, please review it.


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Ouss4 commented on pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794#issuecomment-696291691


   @xiaoxiang781216 Did you see the commit message that added this part?
   
   > I see the following behaviour on NuttX 7.26, where I have SD card mounted on /flash and a directory called "frm" on it:
   > 
   > opendir("/flash")  returns  (DIR *) 0x1000c580
   > opendir("/flash/") returns (DIR *) 0x1000c5d0
   > opendir("/flash/frm")  returns (DIR *) 0x1000c620
   > opendir("/flash/frm/")  returns (DIR *) 0x0
   > 
   > From POSIX specs for opendir(): "A pathname ... that ends with one or more trailing slashes shall be resolved as if a single dot character ( '.' ) were appended to the pathname."
   > 
   > So for mount points, opendir() works correctly, but for FAT32 filesystem it fails to open directory if the path has a trailing slash. I'm not quite sure how to cleanly fix this. Stripping the trailing slash in opendir() would require allocating a separate buffer, while fixing it in the FAT32 code seems somewhat complex due to the short/long filename logic.
   > 
   > It is not a big issue for me, I'm just going to fix it on the application side. But still a small portability and standards compliance issue.
   > 
   > NOTE: You would not see this problem if you call opendir() indirectly in NSH (like 'ls -R /') because NSH contains logic to remove trailing '/' characters from paths.
   
   Is that not an issue anymore?


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #1794: vfs: opendir shouldn't remove the trailing whitespace or '/'

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #1794:
URL: https://github.com/apache/incubator-nuttx/pull/1794#issuecomment-696547055


   @Ouss4 Iprovide a path fix the FAT filesystem directly, please review it.


----------------------------------------------------------------
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.

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