Bug 991182 - rpmlint doesn't expand "~" in /home/username
rpmlint doesn't expand "~" in /home/username
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: rpmlint (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tom "spot" Callaway
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-01 15:19 EDT by Germán Racca
Modified: 2013-08-03 03:54 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-03 03:54:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Germán Racca 2013-08-01 15:19:24 EDT
Description of problem:

I will give you an example. From outside of the directory containing the rpm package:

german@skytux ~ $ cd Downloads/
german@skytux Downloads $ rpmlint ~/repo-local/pekwm-themes-1.0.5-3.noarch.rpm
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 378, in <module>
    main()
  File "/usr/bin/rpmlint", line 89, in main
    loadCheck(c)
  File "/usr/bin/rpmlint", line 73, in loadCheck
    imp.load_module(name, fobj, pathname, description)
  File "/usr/share/rpmlint/TagsCheck.py", line 431, in <module>
    oldest_changelog_timestamp = calendar.timegm(time.strptime("1995-01-01", "%Y-%m-%d"))
AttributeError: 'module' object has no attribute 'timegm'

In the same directory of the rpm package:

german@skytux Downloads $ cd ~/repo-local/
german@skytux repo-local $ rpmlint pekwm-themes-1.0.5-3.noarch.rpm
pekwm-themes.noarch: W: invalid-url URL: http://adrinux.wordpress.com/pekwm-themes/ HTTP Error 410: Gone
pekwm-themes.noarch: W: no-documentation
1 packages and 0 specfiles checked; 0 errors, 2 warnings.

Version-Release number of selected component (if applicable):

rpmlint-1.5-1.fc19.noarch

How reproducible:

Always

Steps to Reproduce:
1. rpmlint to a package outside the directory you currently are
2. you will got the error as explained above
3.

Actual results:

Error as showed in the example above

Expected results:

List the errors encountered in the rpm package

Additional info:

This is Fedora 19 x86_64 with current kernel 3.10.3-300.fc19.x86_64.
Comment 1 Ville Skyttä 2013-08-02 17:28:51 EDT
rpmlint can check packages from any dir just fine. The error indicates that it ends up loading some other "calendar" module than the usual one shipping with Python.

You don't happen to have a calendar.py (and/or .pyc, .pyo) in ~/Downloads and "." in the PYTHONPATH environment variable?

$ ls -la ~/Downloads/*.py*
$ env | grep PYTHON
Comment 2 Germán Racca 2013-08-02 18:31:41 EDT
Oh yes! You are completely right!

german@skytux Downloads $ env | grep PYTHON
PYTHONPATH=/home/german/Programs/gildas-exe-feb13b/x86_64-fedora18-gfortran/python:/home/german/Programs/gildas-exe-feb13b/x86_64-fedora18-gfortran/python::/home/german/modules:/home/german/modules

german@skytux Downloads $ ls -la ~/Downloads/*.py* | grep cal
-rwxrwxr-x. 1 german german 4911 May  3 14:49 /home/german/Downloads/calendar.py
-rw-rw-r--. 1 german german 3300 Aug  2 19:03 /home/german/Downloads/calendar.pyo

german@skytux Downloads $ rm calendar.pyo
german@skytux Downloads $ mv calendar.py ~/Programs/
german@skytux Downloads $ rpmlint ~/repo-local/pekwm-themes-1.0.5-3.noarch.rpm
pekwm-themes.noarch: W: invalid-url URL: http://adrinux.wordpress.com/pekwm-themes/ HTTP Error 410: Gone
pekwm-themes.noarch: W: no-documentation
1 packages and 0 specfiles checked; 0 errors, 2 warnings.

Sorry for the noise and thanks for reading the bug report so quickly.

But this is something that shouldn't happen with rpmlint, because it will crash every time the user wants to run rpmlint in a directory in which there is a calendar.py file, don't you think? I mean, this behaviour is awkward.

Germán.
Comment 3 Germán Racca 2013-08-02 18:34:18 EDT
(In reply to Germán Racca from comment #2)
> Oh yes! You are completely right!
> 
> german@skytux Downloads $ env | grep PYTHON
> PYTHONPATH=/home/german/Programs/gildas-exe-feb13b/x86_64-fedora18-gfortran/
> python:/home/german/Programs/gildas-exe-feb13b/x86_64-fedora18-gfortran/
> python::/home/german/modules:/home/german/modules
> 
> german@skytux Downloads $ ls -la ~/Downloads/*.py* | grep cal
> -rwxrwxr-x. 1 german german 4911 May  3 14:49
> /home/german/Downloads/calendar.py
> -rw-rw-r--. 1 german german 3300 Aug  2 19:03
> /home/german/Downloads/calendar.pyo
> 
> german@skytux Downloads $ rm calendar.pyo
> german@skytux Downloads $ mv calendar.py ~/Programs/
> german@skytux Downloads $ rpmlint
> ~/repo-local/pekwm-themes-1.0.5-3.noarch.rpm
> pekwm-themes.noarch: W: invalid-url URL:
> http://adrinux.wordpress.com/pekwm-themes/ HTTP Error 410: Gone
> pekwm-themes.noarch: W: no-documentation
> 1 packages and 0 specfiles checked; 0 errors, 2 warnings.
> 
> Sorry for the noise and thanks for reading the bug report so quickly.
> 
> But this is something that shouldn't happen with rpmlint, because it will
> crash every time the user wants to run rpmlint in a directory in which there
> is a calendar.py file, don't you think? I mean, this behaviour is awkward.
> 
> Germán.

This happens every time:

german@skytux ~ $ touch calendar.py
german@skytux ~ $ rpmlint repo-local/pekwm-themes-1.0.5-3.noarch.rpm 
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 378, in <module>
    main()
  File "/usr/bin/rpmlint", line 89, in main
    loadCheck(c)
  File "/usr/bin/rpmlint", line 73, in loadCheck
    imp.load_module(name, fobj, pathname, description)
  File "/usr/share/rpmlint/TagsCheck.py", line 431, in <module>
    oldest_changelog_timestamp = calendar.timegm(time.strptime("1995-01-01", "%Y-%m-%d"))
AttributeError: 'module' object has no attribute 'timegm'

german@skytux ~ $ ll calendar*
-rw-rw-r--. 1 german german   0 Aug  2 19:33 calendar.py
-rw-rw-r--. 1 german german 111 Aug  2 19:33 calendar.pyo
Comment 4 Ville Skyttä 2013-08-03 03:42:46 EDT
(In reply to Germán Racca from comment #2)
> But this is something that shouldn't happen with rpmlint, because it will
> crash every time the user wants to run rpmlint in a directory in which there
> is a calendar.py file, don't you think?

No, I don't. It's not limited to calendar.py, it's the same thing with all python modules, and it's not even limited to rpmlint, this affects practically every python program out there. Just be careful with PYTHONPATH.
Comment 5 Germán Racca 2013-08-03 03:54:11 EDT
(In reply to Ville Skyttä from comment #4)
> (In reply to Germán Racca from comment #2)
> > But this is something that shouldn't happen with rpmlint, because it will
> > crash every time the user wants to run rpmlint in a directory in which there
> > is a calendar.py file, don't you think?
> 
> No, I don't. It's not limited to calendar.py, it's the same thing with all
> python modules, and it's not even limited to rpmlint, this affects
> practically every python program out there. Just be careful with PYTHONPATH.

You are right once again :)

As I'm learning Python, I realized later that it will happen with other python programs as well, because reading the source code of rpmlint, I could see that it imports calendar, and if there is a calendar.py in my Python path, it will import it first. And this is not restricted to rpmlint.

Well, thanks for everything, I'm closing this bug.

All the best,
Germán.

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