Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROMFS current directory hardlink does not work #1543

Closed
patacongo opened this issue Aug 9, 2020 · 0 comments · Fixed by #1546
Closed

ROMFS current directory hardlink does not work #1543

patacongo opened this issue Aug 9, 2020 · 0 comments · Fixed by #1546

Comments

@patacongo
Copy link
Contributor

Using configuration sim:nsh

nsh> mount
  /etc type romfs
  /proc type procfs
  /tmp type vfat
nsh> ls -Rl /etc
/etc:
 dr-xr-xr-x       0 .
 -r-xr-xr-x      20 group
 dr-xr-xr-x       0 init.d/
 -r-xr-xr-x      35 passwd
/etc/init.d:
 dr-xr-xr-x       0 ..
 -r-xr-xr-x      71 rcS

/etc/init.d can be listed; /etc/init.d/. cannot:

nsh> ls -l /etc/init.d
/etc/init.d:
 dr-xr-xr-x       0 ..
 -r-xr-xr-x      71 rcS
nsh> ls -l /etc/init.d/.
nsh: ls: stat failed: 2

/etc/init.d/.. can be listed; /etc/init.d/../. cannot:

nsh> ls -l /etc/init.d/..
/etc/init.d/..:
 dr-xr-xr-x       0 .
 -r-xr-xr-x      20 group
 dr-xr-xr-x       0 init.d/
 -r-xr-xr-x      35 passwd
nsh> ls -l /etc/iniit.d/../.
nsh: ls: stat failed: 2

nsh> ls -l /etc/init.d/../group
 -r-xr-xr-x      20 /etc/init.d/../group
nsh> cat /etc/init.d/../group
root:*:0:root,admin
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 9, 2020
This PR corrects an error in the ROMFS file system.  The error occurred more or less randomly after following a hard link.  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync.  This would cause random errors when pathes containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 9, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
@patacongo patacongo linked a pull request Aug 9, 2020 that will close this issue
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 9, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 9, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 10, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
patacongo pushed a commit to patacongo/nuttx that referenced this issue Aug 10, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue apache#1543.  Please compare the following output with the output in Issue apache#1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
@davids5 davids5 assigned davids5 and unassigned davids5 Aug 10, 2020
davids5 pushed a commit that referenced this issue Aug 10, 2020
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue #1543.  Please compare the following output with the output in Issue #1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants