Author hroncok
Recipients hroncok
Date 2018-02-20.11:06:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519124808.65.0.467229070634.issue32885@psf.upfronthosting.co.za>
In-reply-to
Content
We (Fedora's Python SIG) would like to promote usage of Tools/scripts/pathfix.py (we've even moved it to $PATH) in Fedora RPM build (a.k.a spec files) instead of various error prone finds + greps + seds.

However when running pathfix.py, it creates backup files (with ~ suffix). This is mostly unfortunate in RPM build environment, because one needs to clean those up, otherwise one gets warnings and errors like this:


error: Installed (but unpackaged) file(s) found:
   /usr/bin/spam~


Or the file with ~ might even get installed if a more relaxed patter is used in a %files section that lists what is part of the RPM package.

    %{_bindir}/spam-*


We even have shebangs checks/mangling in place and the ~ suffixed file still has the wrong shebang, resulting in warnings like this:

*** WARNING: mangling shebang in /usr/bin/spam~ from #!/usr/bin/python -Es to #!/usr/bin/python2 -Es. This will become an ERROR, fix it manually!



Steps to Reproduce:
1. $ echo '#!python' > omg
2. $ Tools/scripts/pathfix.py -i "/usr/bin/python3" -p omg  # possibly with extra flag, see bellow
omg: updating
3. $ ls

Actual results: omg  omg~


Expected results: omg



Since the backup feature was here for ages, instead of changing the behavior, I suggest a flag is added that disables this. 2to3 has exactly the proposed flag as: "-n, --nobackups       Don't write backups for modified files".

This doesn't necessarily need to go into all versions, but I've selected all that has this problem. Getting it to 3.6+ would be great, however if it goes to anything later, we'll backport it in the Fedora package.


I have a patch ready, sill send PR.
History
Date User Action Args
2018-02-20 11:06:48hroncoksetrecipients: + hroncok
2018-02-20 11:06:48hroncoksetmessageid: <1519124808.65.0.467229070634.issue32885@psf.upfronthosting.co.za>
2018-02-20 11:06:48hroncoklinkissue32885 messages
2018-02-20 11:06:48hroncokcreate