Received: from mail.sidefx.com (mail.sidefx.com [206.223.178.163])
	by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id u4ACe8tq027783
	for <bfriesen@simple.dallas.tx.us>; Tue, 10 May 2016 07:40:09 -0500 (CDT)
Subject: Re: [Tiff] snprintf and MSVC 2015
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sidefx.com; s=mail;
	t=1462884008; bh=xnayhUeVB0omfuF8QzYj2lRdkWUB+q6ZokaB5CYtFm8=;
	h=To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	b=FaIkeFAUM8bo3/wuS2K9GKvrQ5p0Ai9Iz0UBK6ojgj/RBHsPK+ELayLo1URiUXYbd
	 VqL8ph627eMRcDPplw0125ljPuJ7JakC9Vauq4PjmeiDO6422aCKiSLBjoNBwvReJY
	 cXn5eeDLBOapaDQG0lqV1Pdn4fEN6V5c14rA8kOQ=
To: tiff@lists.maptools.org, Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
References: <1f558d54-6b57-fb07-835a-a694cfe34752@illinois.edu>
 <958e4ccb-e8b2-5a29-7d07-e0defd9850fe@gatewaygeomatics.com>
 <eaa3b793-4381-69b5-3522-8d97db9cc502@sidefx.com>
 <alpine.GSO.2.20.1605091041160.27960@freddy.simplesystems.org>
 <23643b16-606d-f9d0-7acc-a2184fb318a6@sidefx.com>
 <f94a8900-3d70-6102-eb06-eddcc1adc944@codelibre.net>
 <6f191915-05e2-7ebb-6afe-9fc35fbb704a@sidefx.com>
 <900d0d6d-de33-0e07-64a2-f6a8f707e2d9@codelibre.net>
From: Edward Lam <edward@sidefx.com>
Message-ID: <abc57cdf-99e7-0be7-b657-b91f0023523b@sidefx.com>
Date: Tue, 10 May 2016 08:40:07 -0400
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.0
MIME-Version: 1.0
In-Reply-To: <900d0d6d-de33-0e07-64a2-f6a8f707e2d9@codelibre.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.5.16 (smtp.simplesystems.org [65.66.246.90]); Tue, 10 May 2016 07:40:09 -0500 (CDT)
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4
Status: RO
X-Status: A
X-Keywords:                
X-UID: 20

On 09/05/2016 7:01 PM, Roger Leigh wrote:
> OK.  For clarity and consistency with the other defines, I think
>
> #define HAVE_SNPRINTF 1
>
> would be a bit better (adding 1 at the end)

I agree. Bob, could you make this minor change in CVS as well?

> I've been able to reproduce it now, but the reason is defying
> explanation.  If I open a VS2015 native tools prompt and run nmake, it
> now errors out just like your log, and the patch fixes it.  However...
> this is exactly what I was doing when it succeeded, and I'm still
> building in a new checkout each time, so I'm unsure what the trigger is.

I think it will depend on the environment from which you ran your build tools 
because this behaviour depends on the Platform SDK version being used. In Visual 
Studio 2015, Microsoft has split out part of the C run-time into the Platform 
SDK as of Visual Studio 2015 called the Universal CRT, aka "ucrt". Try comparing 
the include paths and the value of the INCLUDE environment variable between 
where it builds and it doesn't build. Note that you will need to change 
tif_config.vc.h to comment out the fix if you're doing fresh checkouts.

The other potentially confounding factor here is that tif_config.h is copied 
from tif_config.vc.h only if it doesn't exist or is older.

 > The only situation I can see this maybe
> failing is if you built with nmake, it generated a broken tif_config.h
> in the srcdir, and then you do an out-of-tree cmake build, and it
> generates a good tif_config.h in the builddir, but the one in the srcdir
> is used instead.  If anyone is seeing a failure with cmake, could you
> retry in a clean checkout to see if that helps?

I have never used cmake for libtiff so I am certain it has nothing to do with a 
broken tif_config.h. As I previously mentioned, I run "nmake /f Makefile.vc 
clean" to ensure that tif_config.h (and all other generated files) is first 
deleted "in the tree".

I just tried rebuilding again with a fresh checkout and commented out the 
SNPRINTF define in tif_config.vc.h (since Bob had already checked in the fix). 
It fails to build in exactly the same way.

The only reason I see you succeeding is that you already had some tif_config.h 
lying around and/or you're using a different Platform SDK somehow.

Best Regards,
-Edward

