kxylxp / grub4dos-chenall

Automatically exported from code.google.com/p/grub4dos-chenall
0 stars 0 forks source link

ls /dir/ returns 'true' on empty ext2 directory #139

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Make ext2 USB flash drive
Install wee + grldr
make empty folder /mydir

ls /mydir/ && echo TEST

returns

TEST

but on NTFS and FAT32 volumes it does not return FRED (which is correct).

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by Steve6375 on 30 May 2013 at 6:03

GoogleCodeExporter commented 8 years ago
sorry , I meant under FAT/NTFS is does not return TEST  (not FRED)

Original comment by Steve6375 on 30 May 2013 at 6:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
hmm, it seems that FAT32/FAT16/ext2 differ from exFAT and NTFS when using the 
ls command...

on an NTFS or exFAT volume an empty directory returns 'file not found' for   ls 
/EMPTY/ , but on a FAT16/FAT32/ext2 volumes it does not.

so on NTFS and exFAT, if /AUTO folder is empty
ls /AUTO/ || echo EMPTY FOLDER
works
but on an ext2 or FAT32 volume, it does not

Expected behaviour is that the exFAT and NTFS behaviour is correct. We can test 
for an empty directory using ls, but on FAT/ext2 volumes we cannot test for an 
empty directory.

or can you suggest a different way to detect an empty directory?
best way I have found is
ls (bd)/_ISO/AUTO/ > (md)0x3300+1 && checkrange 0 read 0x660000 > nul && echo 
EMPTY FOLDER!

Original comment by Steve6375 on 21 Jun 2013 at 12:15

GoogleCodeExporter commented 8 years ago
Typical example where I want to test for an empty folder with simple command

Works on NTFS drive but not on FAT drive

iftitle [ls (bd)/_ISO/ANTIVIRUS/ > nul] ^Ctrl+A ANTIVIRUS Menu    [Ctrl+A]\n 
AntiVirus utilities
etc
etc

Original comment by Steve6375 on 6 Jul 2013 at 11:29

GoogleCodeExporter commented 8 years ago
another anomaly...

if we have an empty folder on an NTFS partition (hd0,6) and an empty folder on 
a FAT32 partition (hd0,5) (logical volumes but same issue on Primary partitions 
too):

cat --length=0 (hd0,6)/empty
--> Filesize is 0x0
cat --length=0 (hd0,5)/empty
--> Error 2: Bad file or directory type

also
Two directories called EMPTY  (uppercase), one on FAT32, one on NTFS. Also have 
a file called FRED.txt  (mixed case)

ls (hd0,6)/
--> $AttrDef $BadClus (etc.....)  EMPTY  FRED.txt

ls (hd0,5)/
empty FRED.txt

Notice how the folder EMPTY is listed as 'empty' on a FAT volume (lower case).

Original comment by Steve6375 on 9 Jul 2013 at 5:52