aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/file.c
AgeCommit message (Collapse)Author
2019-04-26file: fix ELF note parsing.Elliott Hughes
Commit 9448c33944651c1644ffbd0f52cf9d43cae19599 broke ELF note parsing, because the bounds checking was off. Fix that but also generalize it so that we won't need note-specific bounds checking in future.
2019-03-09file: add c-sky ELF machine.Elliott Hughes
It's in the Linux 5 kernel headers. If, like me, you'd never heard of it: https://www.phoronix.com/scan.php?page=news_item&px=C-SKY-Approved-Last-Arch
2019-01-08file: add riscv ELF machine.Elliott Hughes
It's in the Linux 4.20 kernel headers.
2018-12-04Clean up some --help formatting.Elliott Hughes
Be consistent about upper versus lower case. (Upper seems to have the majority, so I went with that, though I'm happy to provide the opposite patch as long as we're consistent!) Be consistent about using \t. (Though saving a few bytes seems like it might be better done in the code that generates help.h rather than directly in the source, since tabs make careful ASCII art layout hard enough that we regularly have things misaligned.) Remove trailing periods (most of which seem to have been added by me). Always use the US "human readable" rather than my British "human-readable", and be more consistent about declaring whether we're showing multiples of 1000 or 1024. Just say "verbose" rather than adding a useless "mode" or "output".
2018-11-26file: small do_regular_file optimizationReverend Homer
There are a bunch of if (!memcmp(s+28,...)) lines, let's make them "else if"
2018-09-16file: remove %s with no corresponding argument.Rob Landley
I've had added the argument, but I don't know what it wants? Ubuntu's file calls a bmp file "data".
2018-09-15Add .bmp supoprt to file(1).Elliott Hughes
2018-09-15Add .wav support to file(1).Elliott Hughes
2018-08-04file: slightly improve .class, add .dex.Elliott Hughes
2018-07-28Check for integer overflow in pathologically broken elf files by moving theRob Landley
sh_size>file length test inside the loop and changing the vars to unsigned.
2018-05-27Teach "file -" to recognize ELF files, add bounds checking and comments.Rob Landley
2017-11-26Recognize sh/frv fdpic, and add types for bpf and new microblaze.Rob Landley
2017-11-26Use endianness info to read executable type.Rob Landley
2017-11-03file(1): add ogg, TrueType font, LLVM bitcode, PEM certs, and PE executables.Elliott Hughes
More of the files encountered on the Android system image (plus PE executables, which we build but which shouldn't actually make it to the system image!).
2017-09-25Basic Mach-O support in file(1).Elliott Hughes
The Nexus Player build was subtly broken in that it assumed that the host was using ELF. No-one noticed until a Mac user tried to flash their build, which contained a Mach-O x86 binary instead of an ELF x86 binary. Hilarity ensued. (On the same day, file(1) was able to explain a mixup with an ELF hexagon binary. Next time we see a Mach-O binary on an Android device, we'll be ready!) Bug: http://b/66741960
2017-09-05Replace remaining mb*towc() calls with utf8towc().Rob Landley
2017-05-24Add and use xmmap.Elliott Hughes
Everyone forgets that mmap returns MAP_FAILED rather than NULL on failure. Every use of mmap in toybox was either doing the wrong check, or no check at all (including the two I personally added).
2017-04-03Trivial cleanup. (Whitespace, brackets, and remove unnecessary typecasts.)Rob Landley
2017-04-03Add gzip support. (Doesn't show source OS and timestamp, but reporting themRob Landley
isn't obviously useful.)
2017-02-16Teach file(1) about bzip2 files.Elliott Hughes
If we can read and write bzip2 files, we should be able to identify them too...
2017-01-30Improve file's ELF parsing.Elliott Hughes
An ELF file with no program headers is valid, and binutils leaves e_phentsize zero in that case. Fix the corruption check to cope. Also, since notes are in both the program and section headers (and I'm not aware of the possibility of having no sections but still having notes --- where would they be?), look for them in the section headers instead. Also extend the parsing of the .android.note.ident ELF note to include the NDK version information if present. (This won't be present for platform binaries, but will be present for NDK-built binaries such as app libraries.)
2016-09-13Add ar archive support to file.Elliott Hughes
2016-09-13Add -h and -L to file.Elliott Hughes
On a toybox system, most of your bin directory is symbolic links. Bug: http://b/31294746
2016-09-11Izabera pointed out that "file -" was inconsistent (calling stat on "-" butRob Landley
then reading from stdin if it detected a file). Fixed it so "-" always means stdin and you have to say ./- to look at a local "-". Did some whitespace tweaks while I was there...
2016-07-05Don't try to guess the build id type in file(1).Elliott Hughes
They're really just arbitrary byte sequences of arbitrary length. Sure, a 20-byte sequence is _probably_ a SHA-1, but there's no way to know, so let's stop pretending...
2016-07-03Promote file.Rob Landley