Package: file
Version: 1:5.29-1
Severity: important

In jessie the default magic path is "/etc/magic:/usr/share/misc/magic":

$ dpkg -l file|cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version            Architecture Description
+++-==============-==================-============-==========================================
ii  file           1:5.22+15-2+deb8u3 amd64        Determines file type using 
"magic" numbers
$ file -v
file-5.22
magic file from /etc/magic:/usr/share/misc/magic
$ cat /etc/debian_version 
8.7

Somewhere between then and current unstable this has changed to instead
look for ~/.magic instead of /etc/magic:

$ dpkg -l file|cat
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-==========================================================
ii  file           1:5.29-2     amd64        Recognize the type of data in a 
file using "magic" numbers
$ file -v
file-5.29
magic file from /home/olly/.magic:/usr/share/misc/magic
$ cat /etc/debian_version 
stretch/sid

I can't see any mention of this change in either
/usr/share/doc/file/changelog.Debian.gz or
/usr/share/doc/file/changelog.gz so it isn't clear to me if this change
was intentional or not.  But this change is unhelpful (custom magic
rules in /etc/magic will quietly no longer be searched).  This seems to
be a regression of https://bugs.debian.org/279324 and comments there
suggest that both the reporter and maintainer thought that searching
/etc/magic is the correct and expected behaviour.

It looks like the cause is that two hunks were dropped from the patch
local.support-local-definitions-in-etc-magic.patch between 5.28-4 and
5.29-1:

$ interdiff 
file-{5.28-4,5.29-1}/debian/patches/local.support-local-definitions-in-etc-magic.patch
reverted:
--- b/src/Makefile.am
+++ a/src/Makefile.am
@@ -4,7 +4,7 @@
 
 bin_PROGRAMS = file
 
+AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
 AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
reverted:
--- b/src/Makefile.in
+++ a/src/Makefile.in
@@ -340,7 +340,7 @@
 MAGIC = $(pkgdatadir)/magic
 lib_LTLIBRARIES = libmagic.la
 nodist_include_HEADERS = magic.h
+AM_CPPFLAGS = -DMAGIC='"$(MAGIC)"'
-AM_CPPFLAGS = -DMAGIC='"/etc/magic:$(MAGIC)"'
 AM_CFLAGS = $(CFLAG_VISIBILITY) @WARNINGS@
 libmagic_la_SOURCES = magic.c apprentice.c softmagic.c ascmagic.c \
        encoding.c compress.c is_tar.c readelf.c print.c fsmagic.c \

The documentation seems to not exactly match either behaviour - "man
file" says:

| The information identifying these files is read from /etc/magic and
| the compiled magic file /usr/share/misc/magic.mgc, or the files in the
| directory /usr/share/misc/magic if the compiled file does not exist.
| In addition, if $HOME/.magic.mgc or $HOME/.magic exists, it will be
| used in preference to the system magic files.

The wording could perhaps be clearer, but that seems to imply that the
default should actually be to search:

$HOME/.magic:/etc/magic:/usr/share/misc/magic

Cheers,
    Olly

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_NZ.UTF-8, LC_CTYPE=en_NZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages file depends on:
ii  libc6      2.24-8
ii  libmagic1  1:5.29-2
ii  zlib1g     1:1.2.8.dfsg-4

file recommends no packages.

file suggests no packages.

-- no debconf information

Attachment: signature.asc
Description: PGP signature

Reply via email to