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?



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



Home | Main Index | Thread Index | Old Index