Bug 1350249

Summary: rpmconf tracebacks if one of the files is a broken symlink
Product: [Fedora] Fedora Reporter: Miroslav Vadkerti <mvadkert>
Component: rpmconfAssignee: Miroslav Suchý <msuchy>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 24CC: jmarchan, msuchy, thomas.jarosch, xjakub
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpmconf-1.0.19-1.fc26 rpmconf-1.0.19-1.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-10 16:01:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Vadkerti 2016-06-26 18:50:23 UTC
Description of problem:
After following the guide at [1] I run rpmconf -a after upgrading to F24. When trying to diff /etc/mock/default.cfg and /etc/mock/default.cfg.rpmnew I got a traceback. See below:

 sudo rpmconf -a
Configuration file '/etc/mock/default.cfg'
lrwxrwxrwx. 1 root root 20 Feb  5  2015 /etc/mock/default.cfg -> fedora-20-x86_64.cfg
lrwxrwxrwx. 1 root root 20 Jun 26 20:13 /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 91, in run
    self._handle_package(pkg_hdr)
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 290, in _handle_package
    tmp.format(conf_file, "rpmnew"))
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 334, in _handle_rpmnew
    self.show_diff(conf_file, other_file)
  File "/usr/lib/python3.5/site-packages/rpmconf/rpmconf.py", line 177, 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

Looking more closely the issue is that one of the files is a broken symlink:

lrwxrwxrwx. 1 root root 20 Feb  5  2015 /etc/mock/default.cfg -> fedora-20-x86_64.cfg

Looks like this is some letftover from previous installation. Anyway the diff should not fail this way :)

[1] https://fedoraproject.org/wiki/FedUp#Cleaning_Up_Post_Upgrade

Version-Release number of selected component (if applicable):
rpmconf-1.0.16-2.fc24.noarch

How reproducible:
100%

Steps to Reproduce:
1. cp /etc/mock/default.cfg /etc/mock/default.cfg.rpmnew
2. Create broken symlink /etc/mock/default.cfg
3. rpmconf -o mock
4. Press 'D'

Actual results:
traceback, see description

Expected results:
rpmconf tells the user that one of the files is a broken symlink.

Additional info:

Comment 2 Miroslav Suchý 2016-06-27 10:30:21 UTC
Fixed in commit:
 * f0543ce (HEAD -> master) 1350249 - correctly pass /dev/null to difflib

Comment 3 Thomas Jarosch 2017-02-10 13:43:54 UTC
Direct link to the patch:

https://github.com/xsuchy/rpmconf/commit/f0543ced24227f5bb2ebe591278ae27c5a8d34ce.patch

Just stumbled upon this one after doing an upgrade to F25.
So it's still an issue for Fedora (F25).

Thanks Miroslav for the fix!

Comment 4 Miroslav Suchý 2017-04-05 11:45:13 UTC
*** Bug 1399173 has been marked as a duplicate of this bug. ***

Comment 5 Fedora Update System 2017-04-05 12:28:12 UTC
rpmconf-1.0.19-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-a239a0459d

Comment 6 Fedora Update System 2017-04-05 12:28:18 UTC
rpmconf-1.0.19-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0ce35fa95e

Comment 7 Fedora Update System 2017-04-05 19:54:55 UTC
rpmconf-1.0.19-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-0ce35fa95e

Comment 8 Fedora Update System 2017-04-05 21:55:51 UTC
rpmconf-1.0.19-1.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-a239a0459d

Comment 9 Fedora Update System 2017-04-10 16:01:23 UTC
rpmconf-1.0.19-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2017-04-13 23:51:55 UTC
rpmconf-1.0.19-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.