From 50f27779b68fb36cdc2ed4d929c8d97a0f69fe9f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 27 Jun 2019 13:27:01 -0700 Subject: file, stat: various small improvements. file now shows the target of a symbolic link and calls out broken symbolic links. file now shows the device type for block/character special files. file now shows specific reason when it can't open. stat now includes the device type, plus a little more space between the number of blocks and the human-readable file type. Adjusted tests accordingly, which actually makes more of them pass on the host as a convenient side-effect, but I actually made these changes because I've been finding the desktop file and stat output more convenient in these cases. --- tests/file.test | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests/file.test') diff --git a/tests/file.test b/tests/file.test index fa8ea45b..57204e64 100755 --- a/tests/file.test +++ b/tests/file.test @@ -11,6 +11,9 @@ echo "#! /usr/bin/env python" > env.python.script echo "Hello, world!" > ascii echo "6465780a3033350038ca8f6ce910f94e" | xxd -r -p > android.dex ln -s $FILES/java.class symlink +LINK=$(readlink symlink) +ln -s $FILES/java.klass dangler +BROKEN=$(readlink dangler) testing "directory" "file ." ".: directory\n" "" "" testing "empty" "file empty" "empty: empty\n" "" "" @@ -43,14 +46,15 @@ toyonly testing "Android NDK short ELF note" \ "file $FILES/elf/ndk-elf-note-short | sed 's/^.*: //'" \ "ELF shared object, 32-bit LSB arm, dynamic (/system/bin/linker), for Android 28, BuildID=da6a5f4ca8da163b9339326e626d8a3c, stripped\n" "" "" -testing "symlink" "file symlink" "symlink: symbolic link\n" "" "" -testing "symlink -h" "file -h symlink" "symlink: symbolic link\n" "" "" +testing "broken symlink" "file dangler" "dangler: broken symbolic link to $BROKEN\n" "" "" +testing "symlink" "file symlink" "symlink: symbolic link to $LINK\n" "" "" +testing "symlink -h" "file -h symlink" "symlink: symbolic link to $LINK\n" "" "" testing "symlink -L" "file -L symlink" "symlink: Java class file, version 53.0 (Java 1.9)\n" "" "" testing "- pipe" "cat $FILES/java.class | file -" "-: Java class file, version 53.0 (Java 1.9)\n" "" "" testing "- redirect" "file - <$FILES/java.class" "-: Java class file, version 53.0 (Java 1.9)\n" "" "" -testing "/dev/zero" "file /dev/zero" "/dev/zero: character special\n" "" "" +testing "/dev/zero" "file /dev/zero" "/dev/zero: character special (1/5)\n" "" "" testing "-