Subject: Re: do we need to check for text files in
To: Joerg Sonnenberger <>
From: Roland Illig <>
List: pkgsrc-users
Date: 10/04/2007 21:43:01
Joerg Sonnenberger wrote:
> On Thu, Oct 04, 2007 at 09:02:59PM +0200, Klaus Heinz wrote:
>>The check I am talking about is _SUBST_IS_TEXT_FILE in mk/
>>Why do we need to check for the "text" property of a file if we
>>explicitly specify the files where substitutions ought to be done? The
>>simple solution: do not list files in SUBST_FILES.* which are not text
> Because the use generic patterns in a number of places. Not all SUBST
> users specify explicit file lists.

./wrapper/    ${_UNWRAP_FILES}

The worst instance is the above. _UNWRAP_FILES includes ./*-config, 
which in the case of devel/pkg-config results in checking a binary file.

I have changed the _SUBST_IS_TEXT macro in my local copy of pkgsrc to 
just check for embedded '\0' bytes, and it works great:

         { nchars=`wc -c < "$$file"`; \
           notnull=`tr -d '\\0' < "$$file" | wc -c`; \
           [ "$$nchars" = "$$notnull" ] || ${FALSE} ; \