[MacPorts] #15514: reinplace should warn if nothing got replaced
#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: Port Enhancements Component: base | Version: 1.6.0 Keywords: | -------------------------------------+-------------------------------------- What's always bugged me about reinplace is that you get no notification if nothing got replaced, which will probably bite you later. If you use a patchfile to modify a file, and the patch is out of date, the patch fails to apply and the port command exits with an error. This is good; it alerts the port author to the situation and they can fix it by changing or removing the patch. But with reinplace, if the underlying file you're modifying has changed such that the reinplace no longer causes anything to change, you get no warning and the port command proceeds. I think the correct behavior might ultimately be to error out entirely if a reinplace doesn't change a file, just like we do with failed patches. But as a first step, to get port authors used to this change, it might be friendlier to just print a warning for now. The attached patch adds a warning if a reinplace doesn't change the underlying file. -- Ticket URL: <http://trac.macports.org/ticket/15514> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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: --------------------------------------+------------------------------------- Changes (by ryandesign@macports.org): * milestone: Port Enhancements => MacPorts base enhancements -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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 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. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:2> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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): I agree it should be tested. I've been meaning to reinstall MacPorts in a different prefix, so I may take this opportunity to do that and reinstall all the ports I use and see if my new warning appears anywhere. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:3> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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 afb@macports.org): Issuing a warning shouldn't break the port build, even if it could be annoying if wrong. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:4> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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:4 afb@macports.org]:
Issuing a warning shouldn't break the port build, even if it could be annoying if wrong. Exactly.
So far in my limited tests the warning has been triggered in aquaterm, gd2, libsdl, perl5.8 and perl5.10. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:5> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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 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`). -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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
#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): This patch helped me discover that eclipse-ecj32 was broken; see r38136. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:8> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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 raimue@macports.org): I added `reinplace-warning3.diff` which includes a `-f` option to force the replacement and ignore the warning in cases where this is needed. Now we need to decide if we want an option to ignore the warning or print it always. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:9> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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): Maybe there should still be some indication in debug mode that a reinplace didn't do anything, even if the quiet switch is given. What do you think? -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:10> MacPorts <http://www.macports.org/> Ports system for Mac OS
#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): When this ticket is resolved, fix #16384 too. -- Ticket URL: <http://trac.macports.org/ticket/15514#comment:11> MacPorts <http://www.macports.org/> Ports system for Mac OS
#15514: reinplace should warn if nothing got replaced -------------------------------------+-------------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Keywords: | Port: -------------------------------------+-------------------------------------- Comment(by takeshi@…): reinplace-warning7.diff is the difference from base_2_1_2. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:13> MacPorts <http://www.macports.org/> Ports system for Mac OS
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by khindenburg@…): What's the status of this? Is there objections to committing it? The 7.diff had a typo so it didn't work - my patch 8 swapped the "if" as there's no reason to do the compare if we aren't going to print anything. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:16> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by larryv@…): What happened to the quiet debug message? -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:17> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by khindenburg@…): The "-q" still works to not print the warning. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:18> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by ryandesign@…): We (well, I) seem to have forgotten comment:10. My plan was to commit just enough of the patch to introduce the `-q` flag and make it do nothing at all. Then wait until a version of MacPorts is released supporting that do-nothing flag. Then commit the rest of the patch to make reinplace actually print the warning and have `-q` suppress it. Then we can start adding `-q` to portfiles and portgroups where needed, without having the currently-released version of MacPorts issue an error about an unknown `-q` flag. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:19> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by khindenburg@…): Is this latest 9.diff what you meant? -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:20> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by ryandesign@…): Yeah that looks good. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:21> MacPorts <http://www.macports.org/> Ports system for OS X
#15514: reinplace should warn if nothing got replaced ---------------------------+-------------------------------- Reporter: ryandesign@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts Future Component: base | Version: 1.6.0 Resolution: | Keywords: Port: | ---------------------------+-------------------------------- Comment (by khindenburg@…): added r124909 - now we just have to remember to add the rest later. -- Ticket URL: <https://trac.macports.org/ticket/15514#comment:22> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts