+
+2007-02-04 15:50 Christos Zoulas <christos@zoulas.com>
+
+ * Debian fixes (Reuben Thomas)
+
2007-02-04 11:31 Christos Zoulas <christos@zoulas.com>
* !mine: annotations in magic files (Reuben Thomas)
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure ChangeLog config.guess config.sub \
- depcomp install-sh ltmain.sh missing mkinstalldirs
+ depcomp install-sh ltcf-c.sh ltmain.sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
-depcomp =
-am__depfiles_maybe =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
top_srcdir = @top_srcdir@
# don't enforce GNU packaging standards
-AUTOMAKE_OPTIONS = foreign no-dependencies
+AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = LEGAL.NOTICE MAINT PORTING
SUBDIRS = src magic doc python
all: config.h
if test "$enable_largefile" != no; then
- { echo "$as_me:$LINENO: checking for special C compiler options needed for large files=
-" >&5
-echo $ECHO_N "checking for special C compiler options needed for large files=
-... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
if test "${ac_cv_sys_largefile_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
--- /dev/null
+
+#------------------------------------------------------------------------------
+# clarion: file(1) magic for # Clarion Personal/Professional Developer
+# (v2 and above)
+# From: Julien Blache <jb@jblache.org>
+
+# Database files
+# signature
+0 leshort 0x3343 Clarion Developer (v2 and above) data file
+# attributes
+>2 leshort &0x0001 \b, locked
+>2 leshort &0x0004 \b, encrypted
+>2 leshort &0x0008 \b, memo file exists
+>2 leshort &0x0010 \b, compressed
+>2 leshort &0x0040 \b, read only
+# number of records
+>5 lelong x \b, %ld records
+
+# Memo files
+0 leshort 0x334d Clarion Developer (v2 and above) memo data
+
+# Key/Index files
+# No magic? :(
+
+# Help files
+0 leshort 0x49e0 Clarion Developer (v2 and above) help data
--- /dev/null
+
+#------------------------------------------------------------------------------
+# erlang: file(1) magic for Erlang JAM and BEAM files
+# URL: http://www.erlang.org/faq/x779.html#AEN812
+
+# OTP R3-R4
+0 string \0177BEAM! Old Erlang BEAM file
+>6 short >0 - version %d
+
+# OTP R5 and onwards
+0 string FOR1
+>8 string BEAM Erlang BEAM file
+
+# 4.2 version may have a copyright notice!
+4 string Tue Jan 22 14:32:44 MET 1991 Erlang JAM file - version 4.2
+79 string Tue Jan 22 14:32:44 MET 1991 Erlang JAM file - version 4.2
+
+4 string 1.0 Fri Feb 3 09:55:56 MET 1995 Erlang JAM file - version 4.3
--- /dev/null
+
+#------------------------------------------------------------------------------
+# gnumeric: file(1) magic for Gnumeric spreadsheet
+# This entry is only semi-helpful, as Gnumeric compresses its files, so
+# they will ordinarily reported as "compressed", but at least -z helps
+39 string =<gmr:Workbook Gnumeric spreadsheet
+!:mime application/x-gnumeric
--- /dev/null
+
+#------------------------------------------------------------------------------
+# inform: file(1) magic for Inform interactive fiction language
+
+# URL: http://www.inform-fiction.org/
+# From: Reuben Thomas <rrt@sc3d.org>
+
+0 regex [Cc]onstant[[:space:]]+[Ss]tory Inform source text
--- /dev/null
+
+#------------------------------------------------------------------------------
+# kde: file(1) magic for KDE
+
+0 string [KDE\ Desktop\ Entry] KDE desktop entry
+!:mime application/x-kdelnk
+0 string #\ KDE\ Config\ File KDE config file
+!:mime application/x-kdelnk
+0 string #\ xmcd xmcd database file for kscd
+!:mime text/x-xmcd
--- /dev/null
+
+#------------------------------------------------------------------------------
+# llvm: file(1) magic for LLVM byte-codes
+# URL: http://llvm.cs.uiuc.edu/docs/BytecodeFormat.html#signature
+# From: Al Stone <ahs3@fc.hp.com>
+
+0 string llvm LLVM byte-codes, uncompressed
+0 string llvc0 LLVM byte-codes, null compression
+0 string llvc1 LLVM byte-codes, gzip compression
+0 string llvc2 LLVM byte-codes, bzip2 compression
--- /dev/null
+
+#------------------------------------------------------------------------------
+# lua: file(1) magic for Lua scripting language
+# URL: http://www.lua.org/
+# From: Reuben Thomas <rrt@sc3d.org>, Seo Sanghyeon <tinuviel@sparcs.kaist.ac.kr>
+
+# Lua scripts
+0 string/b #!\ /usr/bin/lua Lua script text executable
+0 string/b #!\ /usr/local/bin/lua Lua script text executable
+0 string #!/usr/bin/env\ lua Lua script text executable
+0 string #!\ /usr/bin/env\ lua Lua script text executable
+
+# Lua bytecode
+0 string \033Lua Lua bytecode,
+>4 byte 0x50 version 5.0
+>4 byte 0x51 version 5.1
--- /dev/null
+
+#------------------------------------------------------------------------------
+# luks: file(1) magic for Linux Unified Key Setup
+# URL: http://luks.endorphin.org/spec
+# From: Anthon van der Neut <anthon@mnt.org>
+
+0 string LUKS\xba\xbe LUKS encrypted file,
+>6 beshort x ver %d
+>8 string x [%s,
+>40 string x %s,
+>72 string x %s]
+>168 string x UUID: %s
--- /dev/null
+
+#------------------------------------------------------------------------------
+# mathcad: file(1) magic for Mathcad documents
+# URL: http://www.mathsoft.com/
+# From: Josh Triplett <josh@freedesktop.org>
+
+0 string .MCAD\ Mathcad document
--- /dev/null
+
+#------------------------------------------------------------------------------
+# mozilla: file(1) magic for Mozilla XUL fastload files
+# (XUL.mfasl and XPC.mfasl)
+# URL: http://www.mozilla.org/
+# From: Josh Triplett <josh@freedesktop.org>
+
+0 string XPCOM\nMozFASL\r\n\x1A Mozilla XUL fastload data
--- /dev/null
+
+#------------------------------------------------------------------------------
+# netware: file(1) magic for NetWare Loadable Modules (NLMs)
+# From: Mads Martin Joergensen <mmj@suse.de>
+
+0 string NetWare\ Loadable\ Module NetWare Loadable Module
Magdir/bout \
Magdir/bsdi \
Magdir/btsnoop \
+Magdir/c-lang \
Magdir/c64 \
Magdir/cad \
Magdir/cafebabe \
Magdir/chord \
Magdir/cisco \
Magdir/citrus \
-Magdir/c-lang \
+Magdir/clarion \
Magdir/claris \
Magdir/clipper \
Magdir/commands \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
+Magdir/erlang \
Magdir/esri \
Magdir/fcs \
Magdir/filesystems \
Magdir/geos \
Magdir/gimp \
Magdir/gnu \
+Magdir/gnumeric \
Magdir/grace \
Magdir/gringotts \
Magdir/hitachi-sh \
Magdir/ibm6000 \
Magdir/iff \
Magdir/images \
+Magdir/inform \
Magdir/intel \
Magdir/interleaf \
Magdir/island \
Magdir/java \
Magdir/jpeg \
Magdir/karma \
+Magdir/kde \
Magdir/lecter \
Magdir/lex \
Magdir/lif \
Magdir/linux \
Magdir/lisp \
+Magdir/llvm \
+Magdir/lua \
+Magdir/luks \
Magdir/mach \
Magdir/macintosh \
Magdir/magic \
Magdir/mail.news \
Magdir/maple \
+Magdir/mathcad \
Magdir/mathematica \
Magdir/matroska \
Magdir/mcrypt \
Magdir/mmdf \
Magdir/modem \
Magdir/motorola \
+Magdir/mozilla \
Magdir/msdos \
Magdir/msvc \
Magdir/mup \
Magdir/ncr \
Magdir/netbsd \
Magdir/netscape \
+Magdir/netware \
Magdir/news \
Magdir/nitpicker \
Magdir/ocaml \
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-pkgdata_DATA = magic magic.mime magic.mgc magic.mime.mgc
-EXTRA_DIST = magic2mime Localstuff Header magic.mime $(magic_FRAGMENTS)
-CLEANFILES = magic magic.mgc magic.mime.mgc
+pkgdata_DATA = magic magic.mgc
+EXTRA_DIST = Localstuff Header $(magic_FRAGMENTS)
+CLEANFILES = magic magic.mgc
@IS_CROSS_COMPILE_FALSE@FILE_COMPILE = $(top_builddir)/src/file
+
+# FIXME: Build file natively as well so that it can be used to compile
+# the target's magic file
@IS_CROSS_COMPILE_TRUE@FILE_COMPILE = file
magic_FRAGMENTS = \
Magdir/acorn \
Magdir/bout \
Magdir/bsdi \
Magdir/btsnoop \
-Magdir/cad \
-Magdir/cafebabe \
Magdir/c-lang \
Magdir/c64 \
+Magdir/cad \
+Magdir/cafebabe \
Magdir/cddb \
Magdir/chord \
Magdir/cisco \
Magdir/citrus \
+Magdir/clarion \
Magdir/claris \
Magdir/clipper \
-Magdir/cracklib \
-Magdir/spec \
Magdir/commands \
Magdir/communications \
Magdir/compress \
Magdir/console \
Magdir/convex \
+Magdir/cracklib \
Magdir/ctags \
Magdir/dact \
Magdir/database \
Magdir/digital \
Magdir/dolby \
Magdir/dump \
+Magdir/dyadic \
Magdir/editors \
Magdir/efi \
Magdir/elf \
Magdir/encore \
Magdir/epoc \
+Magdir/erlang \
Magdir/esri \
Magdir/fcs \
Magdir/filesystems \
Magdir/freebsd \
Magdir/fsav \
Magdir/games \
-Magdir/geos \
Magdir/gcc \
+Magdir/geos \
Magdir/gimp \
Magdir/gnu \
+Magdir/gnumeric \
Magdir/grace \
Magdir/gringotts \
Magdir/hitachi-sh \
Magdir/ibm6000 \
Magdir/iff \
Magdir/images \
+Magdir/inform \
Magdir/intel \
Magdir/interleaf \
Magdir/island \
Magdir/java \
Magdir/jpeg \
Magdir/karma \
+Magdir/kde \
Magdir/lecter \
Magdir/lex \
Magdir/lif \
Magdir/linux \
Magdir/lisp \
+Magdir/llvm \
+Magdir/lua \
+Magdir/luks \
Magdir/mach \
Magdir/macintosh \
Magdir/magic \
Magdir/mail.news \
Magdir/maple \
+Magdir/mathcad \
Magdir/mathematica \
Magdir/matroska \
Magdir/mcrypt \
Magdir/mmdf \
Magdir/modem \
Magdir/motorola \
+Magdir/mozilla \
Magdir/msdos \
Magdir/msvc \
Magdir/mup \
Magdir/ncr \
Magdir/netbsd \
Magdir/netscape \
+Magdir/netware \
Magdir/news \
Magdir/nitpicker \
Magdir/ocaml \
Magdir/rtf \
Magdir/sc \
Magdir/sccs \
+Magdir/scientific \
Magdir/sendmail \
Magdir/sequent \
Magdir/sgi \
Magdir/sketch \
Magdir/smalltalk \
Magdir/sniffer \
-Magdir/dyadic \
-Magdir/scientific \
Magdir/softquad \
+Magdir/spec \
Magdir/spectrum \
Magdir/sql \
Magdir/sun \
Magdir/troff \
Magdir/tuxedo \
Magdir/typeset \
-Magdir/unknown \
Magdir/unicode \
+Magdir/unknown \
Magdir/uuencode \
Magdir/varied.out \
Magdir/varied.script \
uninstall uninstall-am uninstall-pkgdataDATA
-magic: Header Localstuff $(magic_FRAGMENTS)
+magic: Header Localstuff $(magic_FRAGMENTS) $(top_builddir)/src/file
cat $(srcdir)/Header $(srcdir)/Localstuff > $@
for frag in $(magic_FRAGMENTS); do \
if test -f $(srcdir)/$$frag; then \
magic.mgc: magic
$(FILE_COMPILE) -C -m magic
-
-magic.mime.mgc: magic.mime
- $(FILE_COMPILE) -C -m $(srcdir)/magic.mime
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#endif
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.111 2008/01/28 00:14:38 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.112 2008/02/04 16:33:46 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
}
EATAB;
-#if 0
- file_magwarn(ms, "Description: %s\nNew type: %s", m->desc, l);
-#endif
for (i = 0;
*l && ((isascii((unsigned char)*l) && isalnum((unsigned char)*l))
|| strchr("-+/", *l)) && i < sizeof(m->mimetype);
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.116 2007/10/29 00:54:08 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.117 2007/12/27 16:35:58 christos Exp $")
#endif /* lint */
process(argv[optind], wid);
}
+ c = magic->haderr ? 1 : 0;
magic_close(magic);
- return 0;
+ return c;
}
#include "tar.h"
#ifndef lint
-FILE_RCSID("@(#)$File: is_tar.c,v 1.29 2007/10/17 19:33:31 christos Exp $")
+FILE_RCSID("@(#)$File: is_tar.c,v 1.30 2008/01/26 18:45:16 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
* Return
* 0 if the checksum is bad (i.e., probably not a tar archive),
* 1 for old UNIX tar file,
- * 2 for Unix Std (POSIX) tar file.
+ * 2 for Unix Std (POSIX) tar file,
+ * 3 for GNU tar file.
*/
private int
is_tar(const unsigned char *buf, size_t nbytes)
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.45 2007/12/27 16:35:59 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.46 2008/01/30 20:36:13 christos Exp $")
#endif /* lint */
+#ifndef PIPE_BUF
+/* Get the PIPE_BUF from pathconf */
+#ifdef _PC_PIPE_BUF
+#define PIPE_BUF pathconf(".", _PC_PIPE_BUF)
+#else
+#define PIPE_BUF 512
+#endif
+#endif
+
#ifdef __EMX__
private char *apptypeName = NULL;
protected int file_os2_apptype(struct magic_set *ms, const char *fn,
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.60 2007/11/08 00:31:37 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.61 2007/12/27 16:35:59 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
- va_start(va, f);
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
- (void) fprintf(stderr, "%s, %lu: Warning ", ms->file,
- (unsigned long)ms->line);
+ if (ms->file)
+ (void) fprintf(stderr, "%s, %lu: ", ms->file,
+ (unsigned long)ms->line);
+ (void) fprintf(stderr, "Warning: ");
+ va_start(va, f);
(void) vfprintf(stderr, f, va);
va_end(va);
(void) fputc('\n', stderr);
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$File: readelf.c,v 1.68 2007/12/27 16:13:26 christos Exp $")
+FILE_RCSID("@(#)$File: readelf.c,v 1.69 2008/01/26 18:45:16 christos Exp $")
#endif
#ifdef ELFCORE
if (file_printf(ms, "Solaris") == -1)
return size;
break;
+ case GNU_OS_KFREEBSD:
+ if (file_printf(ms, "kFreeBSD") == -1)
+ return size;
+ break;
+ case GNU_OS_KNETBSD:
+ if (file_printf(ms, "kNetBSD") == -1)
+ return size;
+ break;
default:
if (file_printf(ms, "<unknown>") == -1)
return size;
off_t fsize;
int flags = 0;
- /*
- * If we cannot seek, it must be a pipe, socket or fifo.
- */
- if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
- fd = file_pipe2file(ms, fd, buf, nbytes);
-
- if (fstat(fd, &st) == -1) {
- file_badread(ms);
- return -1;
- }
- fsize = st.st_size;
/*
* ELF executables have multiple section headers in arbitrary
* file locations and thus file(1) cannot determine it from easily.
* Instead we traverse thru all section headers until a symbol table
* one is found or else the binary is stripped.
+ * Return immediately if it's not ELF (so we avoid pipe2file unless needed).
*/
if (buf[EI_MAG0] != ELFMAG0
|| (buf[EI_MAG1] != ELFMAG1 && buf[EI_MAG1] != OLFMAG1)
|| buf[EI_MAG2] != ELFMAG2 || buf[EI_MAG3] != ELFMAG3)
return 0;
+ /*
+ * If we cannot seek, it must be a pipe, socket or fifo.
+ */
+ if((lseek(fd, (off_t)0, SEEK_SET) == (off_t)-1) && (errno == ESPIPE))
+ fd = file_pipe2file(ms, fd, buf, nbytes);
+
+ if (fstat(fd, &st) == -1) {
+ file_badread(ms);
+ return -1;
+ }
+ fsize = st.st_size;
class = buf[EI_CLASS];
#define GNU_OS_LINUX 0
#define GNU_OS_HURD 1
#define GNU_OS_SOLARIS 2
+#define GNU_OS_KFREEBSD 3
+#define GNU_OS_KNETBSD 4
#endif