kcoyner / rpl

intelligent recursive search/replace utility
GNU General Public License v2.0
14 stars 13 forks source link

-R recursive option is removed #8

Open SkycoinSynth opened 3 years ago

SkycoinSynth commented 3 years ago

rpl -R "a" b"

The R option is very important.

This commit should be reverted.

https://github.com/kcoyner/rpl/commit/753e84b769a00a4fc1caf35a31caeadf08f425ed

If there is no R option on rpl, then rpl should be removed from debian repo as it is the most common used variant of the command.

rrthomas commented 3 years ago

You can use recursive glob patterns in version 1.8 and later.

berrak commented 2 years ago

I agree 100% with SkycoinSynth proposal to reintroduce -the R option in the command. Companies may depend on backward compatibility and stable commands when it's included in Linux distributions such as Debian. This command may be used in scripts, and automated developers build systems. Linux has a good reputation for not breaking users' systems, and this change does just that. It's unreasonable to say, "just change all your scripts and build a system with ...". Please urgently reconsider the request to revert to the old option with '-R'.

rrthomas commented 2 years ago

-R was reintroduced in version 1.10, in April 2021.

berrak commented 2 years ago

Thanks for the quick answer. However, I am puzzled (maybe I'm doing something wrong), but I can not get rpl to work on Debian Bullseye. I try to clone a KiCAD design to work from that; the procedure is described here

rpl -R olddir newdir *

The response to this is "-R unrecognized command." I downloaded this old version, and it works as I remembered it a couple of months ago. The reason I say I'm puzzled is that rpl worked as described maybe six months ago. Then, I had to change the hard drive and reinstall Debian again. Are there any minor upgrades in the rpl-code that Debian has distributed since I'm on Bullseye 11.5 compared to the 11.0 release?

berrak commented 2 years ago

I should also inform you that my old Linux installation was a bit of a mess, with a mix of Debian releases. Thus, I'm unsure if I did an upgrade from Buster (v10) to Bullseye (v11), and maybe I also had some packages from testing. In the end, it punished me - and I did a complete only stable (Bullseye) installation on a clean hard drive. Thus I'm not sure which rpl version was working as expected back then, so you know the background.

berrak commented 2 years ago

I noticed that -R was not restored to the old code, instead introduced another way. " This implementation does not restore the previous manual tree walking, but instead relies on Python’s pathlib." It does not seem to work, at least not in the above test case.

rrthomas commented 2 years ago

@berrak, I believe that Debian has shipped the same version of rpl, 1.8.0, which does not support -R, with all versions of Bullseye.

You can get any version of rpl you like from pypi.org (using pip).

berrak commented 2 years ago

That's true, but to get a working rpl with -R, with the above test case, I must go back for years. In addition, two imperfections in the current version released by Debian.

berrak commented 2 years ago

To conclude, do you believe that the Debian maintainer(s) has removed the option -R in Bullseye?

berrak commented 2 years ago

I'm following up on your proposal using PyPI. Tell me which version of rpl on PyPi works, so I do not need to guess and try all /1.10/1.11/1.12/1.13/1.14/. Thanks.

rrthomas commented 2 years ago

To conclude, do you believe that the Debian maintainer(s) has removed the option -R in Bullseye?

The Debian maintainers, as far as I know, have never touched the code (except when they were also the upstream maintainers).

As I said, 1.8.0, shipping in Bullseye, lacks the -R option. Note that this version was released in November 2020; Debian does not usually update packages once a testing distribution enters freeze, so this will have been the version shipped.

rrthomas commented 2 years ago

I'm following up on your proposal using PyPI. Tell me which version of rpl on PyPi works, so I do not need to guess and try all /1.10/1.11/1.12/1.13/1.14/. Thanks.

I'd use the latest. Please do report any bugs you find! (Homepage link for bug reporting is on the PyPI page.)

berrak commented 2 years ago

I removed all previous rpl's and reinstalled Debian's rpl-package (Bullseye - current stable release)

rpl --help
  ...
  optional arguments:
    -h, --help           show this help message and exit
    --version            show program's version number and exit
    --encoding ENCODING  specify character set encoding
    -i, --ignore-case    search case-insensitively
    -m, --match-case     ignore case when searching, but try to match case of replacement to case of original, either capitalized, all upper-case, or mixed
    -w, --whole-words    whole words (OLD-TEXT matches on word boundaries only)
    -b, --backup         rename original FILE to FILE~ before replacing
    -q, --quiet          quiet mode
    -v, --verbose        verbose mode
    -s, --dry-run        simulation mode
    -e, --escape         expand escapes in OLD-TEXT and NEW-TEXT [deprecated]
    -F, --fixed-strings  treat OLD-TEXT and NEW-TEXT as fixed strings, not regular expressions
    --files              OLD-TEXT and NEW-TEXT are file names to read patterns from
    --noglob             disable globbing and other expansions
    -p, --prompt         prompt before modifying each file
    -f, --force          ignore errors when trying to preserve permissions
    -d, --keep-times     keep the modification times on modified files

rpl --version
    rpl 1.8.0
    Copyright (C) 2004-2005 Göran Weinholt <weinholt@debian.org>
    Copyright (C) 2004 Christian Häggström <chm@c00.info>
    Copyright (C) 2016 Kevin Coyner <kcoyner@debian.org>
    Copyright (C) 2017 Jochen Kupperschmidt <homework@nwsnet.de>
    Copyright (C) 2018-2020 Reuben Thomas <rrt@sc3d.org>

In conclusion, option -R is gone, and "rpl" is broken, i.e. does not work as in the previous release (Buster - old-stable). Then I installed "rpl" with 'pip install rpl', the latest version 1.14, as you suggested.

rpl --help
    ...
    optional arguments:
      -h, --help            show this help message and exit
      --version             show program's version number and exit
      --encoding ENCODING   specify character set encoding
      -E, --extended-regex  use extended regular expression module `regex'
      -i, --ignore-case     search case-insensitively
      -m, --match-case      ignore case when searching, but try to match case of replacement to case of original, either capitalized, all upper-case, or mixed
      -w, --whole-words     whole words (OLD-TEXT matches on word boundaries only)
      -b, --backup          rename original FILE to FILE~ before replacing
      -q, --quiet           quiet mode
      -v, --verbose         verbose mode
      -s, --dry-run         simulation mode
      -e, --escape          expand escapes in OLD-TEXT and NEW-TEXT [deprecated]
      -F, --fixed-strings   treat OLD-TEXT and NEW-TEXT as fixed strings, not regular expressions
      --files               OLD-TEXT and NEW-TEXT are file names to read patterns from
      -x GLOB, --glob GLOB  modify only files matching the given glob (may be given more than once)
      -R, --recursive       search recursively
      -p, --prompt          prompt before modifying each file
      -f, --force           ignore errors when trying to preserve attributes
      -d, --keep-times      keep the modification times on modified files

rpl --version
    rpl 1.14
    Copyright (C) 2018-2022 Reuben Thomas <rrt@sc3d.org>
    Copyright (C) 2017 Jochen Kupperschmidt <homework@nwsnet.de>
    Copyright (C) 2016 Kevin Coyner <kcoyner@debian.org>
    Copyright (C) 2004-2005 Göran Weinholt <weinholt@debian.org>
    Copyright (C) 2004 Christian Häggström <chm@c00.info>

I'm pleased with pip rpl 1.14, since it works as before. Sorry, If I have consumed your time in vain. Suppose you have a good connection with the maintainer at Debian. In that case, you could point out the grievances this removal cause companies that run the Debian operating system as part of their IT infrastructure.

rrthomas commented 2 years ago

You can file a bug on the Debian BTS requesting an update to the rpl package with the next point update of Buster, and saying why you think it qualifies for an update within a stable release, if you like.

berrak commented 2 years ago

They modified the source for some reason. I could ask them why they break backward compatibility - which is very serious. As I said, companies depend on stability - I thought they understood such essential matters.

rrthomas commented 2 years ago

As I've said already, the Debian maintainers have not modified the source. Version 1.8.0 did not support -R.

berrak commented 2 years ago

Buster (previous release) had working -R, and one release later it's gone. Thus they decided to use another code base and thought it is not necessary to keep the functionality - which is a flawed decision. Just look at the start of this thread.

rrthomas commented 2 years ago

The code base for some time has been the same, the one I maintain. At one point I removed -R; later, I restored it. It has been the same codebase throughout that process.

berrak commented 2 years ago

It's like breaking an API. If Debian insists on not fixing it, at least use semantic versioning and change this to a significant change with 2. x.x to mark it as incompatible.

rrthomas commented 2 years ago

Sure, but none of this has anything to do with Debian, it's all my fault.

berrak commented 2 years ago

But your pip rpl 1.14 works great :-)

berrak commented 2 years ago

Maybe should we say enough of the thread -- I'm happy, the problem is solved after some frustration. Now it is soon the weekend - time to relax. :-)

bossagypsy1 commented 5 months ago

there is no -R option , so no recursion in the version pulled on Debian using: apt-get install rpl

as of June 2024

rrthomas commented 5 months ago

@bossagypsy1 First, please file a Debian issue for Debian bugs. Secondly, Debian has version 1.14 in stable, which supports -R, which I restored in version 1.10. Maybe you're still using oldstable?

rrthomas commented 5 months ago

@kcoyner this issue can be closed, as I restored -R in version 1.10, released in September 2021.

bossagypsy1 commented 5 months ago
rpl usage

Thanks , is it possible that apt -get will pull a previous version?

rrthomas commented 5 months ago

Please ask Debian questions in a suitable forum. This is the issue tracker for (upstream) rpl.

rrthomas commented 5 months ago

By the way, you can always install rpl directly from PyPI.

bossagypsy1 commented 5 months ago

By the way, you can always install rpl directly from PyPI.

thanks, but I m not running Python

rrthomas commented 5 months ago

rpl is written in Python, you can't run rpl without Python.