Also I noticed rm doesn't accept to remove a mount point: $ ./nuttx login: admin password: User Logged-in!
nsh> umount /tmp nsh> mount -t vfat /dev/ram2 /tmp/disk nsh> mount /bin type binfs /etc type romfs /proc type procfs /tmp/disk type vfat nsh> cd /tmp/disk nsh> ls /tmp/disk: nsh> echo "T1" > test1 nsh> echo "T2" > test2 nsh> echo "T3" > test3 nsh> ls /tmp/disk: test1 test2 test3 nsh> cd .. nsh> ls /tmp: disk/ nsh> rm -r disk nsh: rm: unlink failed: 1 nsh> ls /tmp/disk /tmp/disk: nsh> My idea was to mount inside a subdir and remove only it, but it also didn't work. Makes sense since mount points should be "removed" with umount. About removing "." I think Linux is even more restrictive: $ mkdir /tmp/test $ cd /tmp/test $ echo "T1" > test1 $ echo "T2" > test2 $ echo "T3" > test3 $ rm -r . rm: refusing to remove '.' or '..' directory: skipping '.' $ ls test1 test2 test3 $ rm -r * $ ls $ Linux thinks I want to remove the ".", not the files "here"! So it doesn't even remove any file. NuttX seems to be a little bit more smart! hehehe! Best Regards, Alan On Fri, Feb 23, 2024 at 9:33 PM Gregory Nutt <spudan...@gmail.com> wrote: > > On 2/23/2024 6:19 PM, Gregory Nutt wrote: > > > > > > On 2/23/2024 5:57 PM, Alan C. Assis wrote: > >> /tmp: > >> test1 > >> test2 > >> test3 > >> nsh> rm -r . > >> nsh: rm: unlink failed: 1 > >> nsh> ls > >> /tmp: > >> nsh> > >> > >> It reported error "unlink failed: 1", but removed all the files. > > > > 1 = EPERM, Operation not permitted > > > > I suspect that occurred when it tried to rm ".". Try putting a > > subdirectory under /tmp. Does vfat even support the "." hardlink? > > > "." corresponds to the root directory of the mounted file system. > Trying to delete "." will result in an EPERM error on VFAT. See > fat/fs_fat32dirent.c, function fat_remove(). > > It seems like there is some issue with unlink. > >