reinplace instruction and automatic line feeds

Joshua Root jmr at macports.org
Sun Jan 5 08:03:57 PST 2014


On 2014-1-5 20:23 , Nicolas Pavillon wrote:
> Hello, 
> 
> I noticed that the “reinplace” instruction is automatically adding a line feed to files, which is causing problems with some binary files which should have a predefined length. 
> 
> In particular, there is a set of instructions in the kde4-1.1 portgroup which scans all files to replace an include instruction:
> post-extract {
>     # Following the official word: Change #include ["<]Phonon...[">] to
>     # ...phonon... in all files that contain that header.
>     fs-traverse item ${worksrcpath} {
>         if {[file isfile ${item}]} {
>             reinplace -locale C "/#include/s at Phonon@phonon@" ${item}
>         }
>     }
> }
> 
> However, this way also applies reinplace to binary files, and adds a “0A” line feed at the end of the file. One obvious way would be to filter through file extensions, but this may become quite cumbersome. Would anyone have a better suggestion, or, even better, a way to prevent reinplace to add this line feed?

The reinplace proc is just a front-end to sed(1), which is a
line-oriented tool and thus the wrong choice for modifying binaries. So
yes, I'd say you need to not run it on the binaries, one way or another.

Also, is this really something that has to be done to every kde4 port?
And is it not being fixed upstream?

- Josh


More information about the macports-dev mailing list