pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: do we need to check for text files in subst.mk?



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/subst.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
files.


Because the use generic patterns in a number of places. Not all SUBST
users specify explicit file lists.

./wrapper/bsd.wrapper.mk:SUBST_FILES.unwrap=    ${_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:

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

Roland



Home | Main Index | Thread Index | Old Index