1
0
Fork
You've already forked ice
0
Locate and delete foreign files
  • C 77.2%
  • Makefile 12.6%
  • Roff 10.2%
Find a file
2026年04月18日 14:28:46 +02:00
.editorconfig Add editorconfig 2026年04月05日 21:38:27 +02:00
.gitignore Support MZ and PE binaries 2026年04月18日 10:16:07 +02:00
common.c Add -a and -v options 2026年04月18日 14:28:46 +02:00
common.h Add -a and -v options 2026年04月18日 14:28:46 +02:00
genhosth.c Simplify bininfo structure 2026年04月18日 10:32:22 +02:00
ice.1 Add -a and -v options 2026年04月18日 14:28:46 +02:00
ice.c Add -a and -v options 2026年04月18日 14:28:46 +02:00
LICENSE.md Add license 2026年04月05日 19:19:11 +02:00
Makefile Remove host.h on clean 2026年04月18日 10:51:36 +02:00
README.md Add -a and -v options 2026年04月18日 14:28:46 +02:00
testbin.c Support cross-compilation 2026年04月17日 22:42:05 +02:00

ICE

Make Unix great again by locating and deleting foreign files

ice [-avf] path

Searches recursively in the given directory to list paths of programs and object files that have an architecture or target OS other than the current. Symlinks are not followed.

Options:

  • -a: list all identified executables, not just foreign ones.
  • -v: output the executable type next to the filenames.
  • -f: delete all matched files (best not to use with -a!).

Checks are performed by comparing ELF files' EI_OSABI and E_MACHINE fields against those of a test binary generated at build-time.

Exits 0 on success, 1 on general errors, 2 if any non-critical error occurs (other than invalid ELF files), or 64 on usage error.

Caveats

Currently only works on Unix-likes, and only with ELF files.

Barely vetted, so ice may be overeager in reporting (and deleting) files that are essential to the functioning of the system.

Building

Requires a C compiler and make:

make
sudo make install

Cross-compiling should work too:

make HOSTCC=gcc CC=aarch64-linux-gnu-gcc
make HOSTCC=gcc CC=i686-w64-mingw32-gcc SUFX=32.exe

There are also some cross compile targets built in:

make cross
# or:
make cross-w32
make cross-w64

Future work

  • -x option to not cross filesystem boundaries.
  • Windows and DOS support.
  • More categories, such as non-native binary formats, line endings or text encoding.
  • Faster searching with e.g. kqueue, io_uring, BPF.

Author

By Sijmen J. Mulder (ik@sjmulder.nl). See LICENSE.md