Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1A1826676 for ; Fri, 24 Jun 2011 18:50:25 +0000 (UTC) Received: (qmail 7119 invoked by uid 500); 24 Jun 2011 18:50:24 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 6937 invoked by uid 500); 24 Jun 2011 18:50:24 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 6902 invoked by uid 99); 24 Jun 2011 18:50:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2011 18:50:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [66.111.4.27] (HELO out3.smtp.messagingengine.com) (66.111.4.27) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2011 18:50:16 +0000 Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45]) by gateway1.messagingengine.com (Postfix) with ESMTP id B507220B27; Fri, 24 Jun 2011 14:49:55 -0400 (EDT) Received: from frontend1.messagingengine.com ([10.202.2.160]) by compute5.internal (MEProxy); Fri, 24 Jun 2011 14:49:55 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=date:from:to:cc:subject:message-id:references:mime-version:content-type:in-reply-to; s=smtpout; bh=kWhxJXRMuMXZ5I85itDVbBU8UNA=; b=i/8VLmpWpbaZtkCm2pPBaC3KTCG4zQXt47RnypYy52M22uRbMWzJFsi0y1bGb7qVGsmTVf3JPep5RqaTTZPGWiaELa5CWT+zSX6bMqzyykiPKsY/jmaOCSwbWIZe88KhLAAR8NMMDT6je2hp00K/KiiZltoBZWD4/+LLM4hM5UA= X-Sasl-enc: TOILNIgs2DDFlw9RQ+IZDS9jiWZKdyE8dMuKpugbLtMRcB0mWpQkNiHligtMuw 1308941394 Received: from daniel3.local (bzq-109-67-193-90.red.bezeqint.net [109.67.193.90]) by mail.messagingengine.com (Postfix) with ESMTPSA id 408C2404DE8; Fri, 24 Jun 2011 14:49:54 -0400 (EDT) Date: Fri, 24 Jun 2011 21:49:31 +0300 From: Daniel Shahaf To: dev@subversion.apache.org Cc: commits@subversion.apache.org Subject: Re: svn commit: r1131389 - /subversion/trunk/subversion/libsvn_subr/magic.c Message-ID: <20110624184931.GA18757@daniel3.local> References: <20110604130451.A3BB5238897D@eris.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110604130451.A3BB5238897D@eris.apache.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Checked: Checked by ClamAV on apache.org stsp@apache.org wrote on Sat, Jun 04, 2011 at 13:04:51 -0000: > Author: stsp > Date: Sat Jun 4 13:04:51 2011 > New Revision: 1131389 > > URL: http://svn.apache.org/viewvc?rev=1131389&view=rev > Log: > Work around older libmagic versions that don't define MAGIC_MIME_TYPE. > > This should fix the centos buildbot. > > * subversion/libsvn_subr/magic.c: > (svn_magic__init): If MAGIC_MIME_TYPE isn't supported use MAGIC_MIME instead. > (svn_magic__detect_binary_mimetype): Strip charset information from the > string returned by libmagic if MAGIC_MIME was used. > > Modified: > subversion/trunk/subversion/libsvn_subr/magic.c > > Modified: subversion/trunk/subversion/libsvn_subr/magic.c > URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/magic.c?rev=1131389&r1=1131388&r2=1131389&view=diff > ============================================================================== > --- subversion/trunk/subversion/libsvn_subr/magic.c (original) > +++ subversion/trunk/subversion/libsvn_subr/magic.c Sat Jun 4 13:04:51 2011 > @@ -70,7 +70,14 @@ svn_magic__init(svn_magic__cookie_t **ma > mc = apr_palloc(result_pool, sizeof(*mc)); > > /* Initialise libmagic. */ > +#ifndef MAGIC_MIME_TYPE > + /* Some old versions of libmagic don't support MAGIC_MIME_TYPE. > + * We can use MAGIC_MIME instead. It returns more than we need > + * but we can work around that (see below). */ > + mc->magic = magic_open(MAGIC_MIME | MAGIC_ERROR); > +#else > mc->magic = magic_open(MAGIC_MIME_TYPE | MAGIC_ERROR); > +#endif > if (mc->magic) > { > /* This loads the default magic database. > @@ -115,6 +122,14 @@ svn_magic__detect_binary_mimetype(const > magic_mimetype = NULL; > else > { > +#ifndef MAGIC_MIME_TYPE > + char *p; > + > + /* Strip off trailing stuff like " charset=ascii". */ > + p = strchr(magic_mimetype, ' '); > + if (p) > + *p = '\0'; What is 'magic_mimetype' here? Is it guaranteed to contain a space, or can it be 'text/plain;charset=ascii' ? i.e., should the strchr look for a semicolon? (The libmagic ftp mirror is down, and my man page doesn't mention MAGIC_MIME, so I'm not easily able to check the docs of some old libmagic version.) > +#endif > /* The string is allocated from memory managed by libmagic so > * we must copy it to the result pool. */ > magic_mimetype = apr_pstrdup(result_pool, magic_mimetype); > >