Bug 1399173 - rpmconf: diff fails on stale link
Summary: rpmconf: diff fails on stale link
Keywords:
Status: CLOSED DUPLICATE of bug 1350249
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmconf
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-28 13:36 UTC by Jerome Marchand
Modified: 2017-04-05 11:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-05 11:45:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jerome Marchand 2016-11-28 13:36:05 UTC
Description of problem:
I just updated to Fedora 25 and tried to update my config files with "rpmconf -a". The tool detect a change in mock/default.cfg. When I try to show the diff, it fails.

$ sudo rpmconf -a
Configuration file '/etc/mock/default.cfg'
lrwxrwxrwx. 1 root root 20 Oct 10  2014 /etc/mock/default.cfg -> fedora-20-x86_64.cfg
lrwxrwxrwx. 1 root root 20 Nov 28 13:01 /etc/mock/default.cfg.rpmnew -> fedora-23-x86_64.cfg

 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      M     : merge configuration files
      Z     : background this process to examine the situation
      S     : skip this file
 The default action is to keep your current version.
*** aliases (Y/I/N/O/D/M/Z/S) [default=N] ? 
Your choice: d
Traceback (most recent call last):
  File "/sbin/rpmconf", line 77, in <module>
    main()
  File "/sbin/rpmconf", line 68, in main
    rconf.run()
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 90, in run
    self._handle_package(pkg_hdr)
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 289, in _handle_package
    tmp.format(conf_file, "rpmnew"))
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 333, in _handle_rpmnew
    self.show_diff(conf_file, other_file)
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 176, in show_diff
    pydoc.pager(err_msg + "".join(diff))
  File "/usr/lib64/python3.5/difflib.py", line 1177, in unified_diff
    _check_types(a, b, fromfile, tofile, fromfiledate, tofiledate, lineterm)
  File "/usr/lib64/python3.5/difflib.py", line 1312, in _check_types
    raise TypeError('all arguments must be str, not: %r' % (arg,))
TypeError: all arguments must be str, not: None


It turned out that both file are link and the first one points to a removed file:

$ ll /etc/mock/default.cfg /etc/mock/default.cfg.rpmnew 
lrwxrwxrwx. 1 root root 20 Oct 10  2014 /etc/mock/default.cfg -> fedora-20-x86_64.cfg
lrwxrwxrwx. 1 root root 20 Nov 28 13:01 /etc/mock/default.cfg.rpmnew -> fedora-23-x86_64.cfg

Chosing to install the packager's version (Y or I), works as expected (/etc/mock/default.cfg now pointing to fedora-23-x86_64.cfg) and resolves the issue for me.

Steps to Reproduce:
I assume it's easy to build a couple of (conffile, conffile.rpmnew) links, one of them stale, to reproduce the issue. I just happen to encounter this situation after the upgrade to Fedora 25.

Actual results:
rpmconf crashes.

Expected results:
No crash obviously. Other than that, I'm not sure what's the best course of action in such a case. Some indication that those files are link and that one of them is stale would be nice.

Comment 1 Thomas Jarosch 2017-02-10 13:37:18 UTC
Duplicate of bug #1350249

Comment 2 Miroslav Suchý 2017-04-05 11:45:13 UTC

*** This bug has been marked as a duplicate of bug 1350249 ***


Note You need to log in before you can comment on or make changes to this bug.