[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "svn add" crashes in case of missing magic.mgc

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 8 Jul 2019 20:36:23 +0200

On Mon, Jul 08, 2019 at 07:03:38PM +0200, Thorsten Schöning wrote:
> Guten Tag Stefan Sperling,
> am Montag, 8. Juli 2019 um 18:10 schrieben Sie:
>
> > SVN only calls the magic_open() function provided by libmagic.
> > It checks the return value and skips mime-type detection via
> > libmagic if an error occurs. I believe that, at the time, this
> > code was tested with and without a magic database file and both
> > cases worked. But I don't think we have regression tests for this...
>
> It might perfectly be that there's something strange with that SVN
> client, because even if I make the file magic.mgc available to SVN by
> additionally linking in one of the checked places or using the
> environment variable "MAGIC", I see a lot of warnings about that file
> being invalid:
>
> > /usr/share/file/misc/magic.mgc, 92: Warning: offset `Ancient_Realms' invalid
> > /usr/share/file/misc/magic.mgc, 93: Warning: offset `Armagon's_Lair' invalid
> > /usr/share/file/misc/magic.mgc, 94: Warning: offset `Into_The_Flood' invalid
> > /usr/share/file/misc/magic.mgc, 95: Warning: offset `Slaughterhouse' invalid
> > ' invalide/file/misc/magic.mgc, 96: Warning: offset `
> > ' invalide/file/misc/magic.mgc, 102: Warning: offset `METADATA
> > /usr/share/file/misc/magic.mgc, 103: Warning: offset `' invalid
> > /usr/share/file/misc/magic.mgc, 106: Warning: offset `' invalid
> > ' invalide/file/misc/magic.mgc, 108: Warning: offset `MozFASL
> > /usr/share/file/misc/magic.mgc, 109: Warning: offset `' invalid
> > /usr/share/file/misc/magic.mgc, 111: Warning: offset `' invalid
> > /usr/share/file/misc/magic.mgc, 112: Warning: offset `' invalid
> > /usr/share/file/misc/magic.mgc, 125: Warning: offset ` REMARK' invalid
> > /usr/share/file/misc/magic.mgc, 126: Warning: offset `' invalid
> > ' invalide/file/misc/magic.mgc, 127: Warning: offset `TypeLib
> > /usr/share/file/misc/magic.mgc, 128: Warning: offset `' invalid
> > /usr/share/file/misc/magic.mgc, 129: Warning: offset `' invalid
>
> Looks like the linked libmagic is incompatible anyway with the
> provided file.
>
> > If possible please try to reproduce with a newer version.
> [...]
> > Your best next step is to pin down the exact location of the
> > crash with a debugger (either live or with a core file).
> > Is SVN crashing or is libmagic crashing?
>
> I'll keep that in mind, but have very limited time currently for
> further research. No idea where to get symbol files from and stuff
> like that...
>
> > (gdb) run add /tmp/svn_crash/test.txt
> > Starting program: /volume1/@entware-ng/opt/bin/svn add /tmp/svn_crash/test.txt
> > warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.
> >
> > Program received signal SIGABRT, Aborted.
> > 0x00007ffff3d240f8 in raise () from /opt/lib/libc.so.6
> > (gdb) bt
> > #0 0x00007ffff3d240f8 in raise () from /opt/lib/libc.so.6
> > #1 0x00007ffff3d2552a in abort () from /opt/lib/libc.so.6
> > #2 0x00007ffff4711dd5 in ?? () from /opt/lib/libmagic.so.1
> > #3 0x00007ffff4716000 in ?? () from /opt/lib/libmagic.so.1
> > #4 0x00007ffff5c652ed in svn_magic.init () from /opt/lib/libsvn_subr-1.so.0
> > #5 0x00007ffff7b83600 in svn_client_add5 () from /opt/lib/libsvn_client-1.so.0
> > #6 0x00000000004077af in ?? ()
> > #7 0x000000000041c39a in ?? ()
> > #8 0x00000000004075b3 in ?? ()
> > #9 0x00007ffff3d11711 in __libc_start_main () from /opt/lib/libc.so.6
> > #10 0x0000000000407629 in ?? ()

Thanks for providing a trace!

This trace indicates the code is crashing inside libmagic.
There's nothing intelligent SVN could do to prevent this.

As a workaround, you can disable use of libmagic in SVN's configuration.
In ~/.subversion/config, add these lines:

[miscellany]
enable-magic-file = no

Regards,
Stefan
Received on 2019-07-08 20:36:36 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.