#15514: reinplace should warn if nothing got replaced --------------------------------------+------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts base enhancements Component: base | Version: 1.6.0 Resolution: | Keywords: --------------------------------------+------------------------------------- Comment (by ryandesign@macports.org): Replying to [comment:2 jkh@apple.com]:
This behavior should be made conditional. There are legitimate usage cases where a replacement might "fail", and before deciding whether this new behavior should be the default or not it should also be tested out in the ports tree to see how many ports actually break with the new behavior.
I've found one such possibly legitimate use case in the mysql5 port, which does a reinplace on every manual page and configuration file, not all of which contain the string to be replaced. This causes many warnings to appear. {{{ # Fix paths in manpages and sample configuration files foreach manpage [glob -type f ${destroot}${prefix}/share/man/man\[1-9\]/*] { reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${manpage} } foreach samp_conffile [glob -type f ${destroot}${prefix}/share/${mysql}/mysql/my-*.cnf] { reinplace "s|/etc/my.cnf|${sysconfdir}/my.cnf|g" ${samp_conffile} } }}} Replying to [comment:6 raimue@macports.org]:
Not sure if it is faster or better than `diff -q`, but `cmp -s $file $tmpfile` returns as exit value if two files differ, without any output on stdout (getting rid of `>/dev/null`).
Thank you, Rainer, I didn't know `cmp`. That's surely better. I'll attach a new patch. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:7> MacPorts <http://www.macports.org/> Ports system for Mac OS