Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.b-one.net (mx-j.one.com [91.198.169.57])
	by mail9.b-one.net (Postfix) with ESMTP id 16BB140027C
	for <info@awaresystems.be>; Wed, 28 Oct 2009 17:31:07 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=6 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-j.b-one.net (Postfix) with ESMTP id 1C4294A7E50
	for <info@awaresystems.be>; Wed, 28 Oct 2009 17:31:06 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 20E8D1D628169;
	Wed, 28 Oct 2009 11:30:34 -0500 (EST)
Received: from mailout03.t-online.de (mailout03.t-online.de [194.25.134.81])
	by lists.maptools.org (Postfix) with ESMTP id A93EC1D62816F
	for <tiff@lists.maptools.org>; Wed, 28 Oct 2009 11:28:55 -0500 (EST)
Received: from fwd08.aul.t-online.de by mailout03.t-online.de with smtp 
	id 1N3BOI-0005nl-01; Wed, 28 Oct 2009 17:28:54 +0100
Received: from nbsd
	(XpyFM+ZDQh9w4HnXtOA-BqGv07dDPlMhQ68QNF7SM58ZN+7v8r0a-Xgtmcg9AHvQ3V@[91.55.61.185])
	by fwd08.t-online.de
	with esmtp id 1N3BO2-0FiXKK0; Wed, 28 Oct 2009 17:28:38 +0100
Date: Wed, 28 Oct 2009 17:28:34 +0100
From: Juergen Buchmueller <pullmoll@t-online.de>
To: tiff@lists.maptools.org
Message-Id: <20091028172834.279bfc8f.pullmoll@t-online.de>
In-Reply-To: <4AE86B01.9040609@pobox.com>
References: <20091028161845.189bab9a.pullmoll@t-online.de>
	<4AE86B01.9040609@pobox.com>
X-Mailer: Sylpheed 2.7.1 (GTK+ 2.16.6; x86_64--netbsd)
Mime-Version: 1.0
Content-Type: multipart/mixed;
	boundary="Multipart=_Wed__28_Oct_2009_17_28_34_+0100_XsWue4haUyHRxlxs"
X-ID: XpyFM+ZDQh9w4HnXtOA-BqGv07dDPlMhQ68QNF7SM58ZN+7v8r0a-Xgtmcg9AHvQ3V
X-TOI-MSGID: 5909a6fc-3c97-4ad2-b057-4de85ae5e57b
Subject: Re: [Tiff] extending tags in "a"ppend mode?
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

This is a multi-part message in MIME format.

--Multipart=_Wed__28_Oct_2009_17_28_34_+0100_XsWue4haUyHRxlxs
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Wed, 28 Oct 2009 12:02:09 -0400
Frank Warmerdam <warmerdam@pobox.com> wrote:

> Juergen,
> 
> It should be possible to extend the first directory with new tags by opening
> in "r+" (update) mode, setting the tags and closing.  I don't know why you are
> seeing the behavior you encountered.  I would have expected it to attempt to
> append a new image directory and complain about your not providing a complete
> set of tags to define an image.

Ok, I didn't know that "r+" was supported because it isn't mentioned in
the docs.

> It might be helpful if you provided a minimal program and file demonstrating
> your problem.

See attachment. This crashes when I try to run it on the file:
	http://pmbits.ath.cx/RECV002.TIF

Compiled with (adapt include + lib paths):
	gcc -I/usr/pkg/include -Wl,-R/usr/pkg/lib \
		-L/usr/pkg/lib -ltiff -o addtags addtags.c

Run with:
	./addtags somewhere/RECV002.TIF

Stack backtrace:
Program terminated with signal 11, Segmentation fault.
#0  0x00007f7ffd98eb6a in _malloc_prefork () from /usr/lib/libc.so.12
(gdb) bt
#0  0x00007f7ffd98eb6a in _malloc_prefork () from /usr/lib/libc.so.12
#1  0x00007f7ffd98edde in free () from /usr/lib/libc.so.12
#2  0x00007f7ffdc08959 in TIFFCleanup () from /usr/pkg/lib/libtiff.so.3
#3  0x00007f7ffdc089e1 in TIFFClose () from /usr/pkg/lib/libtiff.so.3
#4  0x0000000000400dbe in main ()

To me it looks like a double free() of some kind!?

> Also, in place update of directories is always an iffy procedure with libtiff
> but I would strongly encourage using the most recent release (3.9.1?) if you
> are trying this.

Yes, on my system (NetBSD-5.0.1) there is libtiff-3.9.1 installed.

Thanks,
Juergen

--Multipart=_Wed__28_Oct_2009_17_28_34_+0100_XsWue4haUyHRxlxs
Content-Type: text/plain;
 name="addtags.c"
Content-Disposition: attachment;
 filename="addtags.c"
Content-Transfer-Encoding: base64

I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RkbGliLmg+DQojaW5jbHVkZSA8c3RkaW50
Lmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8dGlmZmlvLmg+DQoNCnN0YXRpYyBj
b25zdCBjaGFyICpzb21lX3N0cmluZ3NbXSA9IHsNCgkiSGVsbG8sIHdvcmxkISIsDQoJImZvbyIs
DQoJImJhciIsDQoJImJheiINCn07DQoNCg0KaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2
KQ0Kew0KCVRJRkYgKmhUSUZGOw0KCVRJRkZGaWVsZEluZm8gKmFwcHRhZ3M7DQoJY2hhciBidWZm
WzMyXTsNCgljb25zdCBjaGFyICpzdHI7DQoJdWludDMyX3QgbiwgbnRhZ3M7DQoJaW50MzJfdCBy
ZXM7DQoNCgloVElGRiA9IFRJRkZPcGVuKGFyZ3ZbMV0sICJyKyIpOw0KDQoJbnRhZ3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QoJCWlmIChhcHB0YWdzW25dLmZp
ZWxkX25hbWUpDQoJCQlmcmVlKGFwcHRhZ3Nbbl0uZmllbGRfbmFtZSk7DQoJfQ0KCWZyZWUoYXBw
dGFncyk7DQoNCglyZXR1cm4gMDsNCn0NCg==

--Multipart=_Wed__28_Oct_2009_17_28_34_+0100_XsWue4haUyHRxlxs
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
--Multipart=_Wed__28_Oct_2009_17_28_34_+0100_XsWue4haUyHRxlxs--
