Subject: Re: do we need to check for text files in subst.mk?
To: Roland Illig <rillig@NetBSD.org>
From: Johnny C. Lam <jlam@buildlink.org>
List: pkgsrc-users
Date: 10/04/2007 16:05:59
Roland Illig wrote:
>
> ./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} ; \
> }
Removing the macro is bad because pkgsrc does check so many *-config
files and I wanted to avoid modifying binaries with sed. I knew when I
wrote the current _SUBST_IS_TEXT_FILE macro that it was quite lame, and
I was hoping someone would find a better way. It sounds like you have a
better one above, which you should probably commit after the freeze is over.
Cheers,
-- Johnny Lam