cli icon indicating copy to clipboard operation
cli copied to clipboard

cf7-cli rpm overwrites file without notice

Open Pilot001 opened this issue 5 years ago • 3 comments

Please fill out the issue checklist below and provide ALL the requested information.

  • [x] I reviewed open and closed github issues that may be related to my problem.
  • [x] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • [ ] I attempted to run the command with CF_TRACE=1 to help debug the issue. => would not help here
  • [x] I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with Trying to install the cf7-cli rpm overwrites another rpm managed file without notice.

What happened An existing file /usr/bin/cf got replaced by a link because of the postinstall script of the rpm. Suggestion: Change the postinstall script: "if ! [ -e /usr/bin/cf ]; ln -s -f /usr/bin/cf7 /usr/bin/cf; fi"

Expected behavior A clear and concise description of what you expected to happen. /usr/bin/cf should not become overwritten if it exists.

Exact Steps To Reproduce Steps to reproduce the behavior; include the exact CLI commands and verbose output:

  1. Install any rpm that provides a file "/usr/bin/cf" (e.g. any cf-cli v6 rpm).
  2. Install cf7-cli rpm
  3. /usr/bin/cf got replaced without notice.

Provide more context

  • platform and shell details ( e.g. Mac OS X 10.11 iTerm): SLES12
  • version of the CLI you are running: 7.1.0, 6.53.0
  • version of the CC API Release you are on => does not matter here

Notes regarding V6 and V7 CLI support:

  • V6:
    • Minimum supported version of CF Deployment: v7.0.0 (CAPI Release: 1.74.0 (APIs 2.128.0 and 3.63.0))
    • Maximum supported version of CF Deployment: v13.4.0 (CAPI Release: 1.94.0 (APIs 2.149.0 and 3.84.0))
  • V7:
    • Minimum supported version of CF Deployment: v13.5.0 (CAPI Release: 1.95.0 (APIs 2.150.0 and 3.85.0))

Pilot001 avatar Nov 12 '20 14:11 Pilot001

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/175702099

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Nov 12 '20 14:11 cf-gitbot

I can vouch for this one. And it doesn't even report /usr/bin/cf as a file within the RPM, it's apparently setting the symlink as a '%post" stp. This is nasty, because it means that updates to cf7-cli or cf-cli will flipflow which version is at /usr/bin/cf, and it leaves no way to recover cf-cli 6 on a host that already had cf7-cli installed. The fixes are easy.

  • Include /usr/bin/cf in the %files of the .spec file, ideally as a '%config(noreplace)" file.
  • Alternatively, add "Conflicts: cf-cli" to the spec file to preclude the overlapping installations.
  • Add "Obsoletes: cf-cli" and "Provides: cf-cli = %{version}" to the cf7-cli.spec file to preclude the overlapping installations.

nkadel avatar Feb 15 '21 16:02 nkadel

If you could publish or include a template for the SRPM .spec file, I'd be happy to submit a pull request or diff for the change.

nkadel avatar Feb 22 '21 18:02 nkadel