Bug 991182 - rpmlint doesn't expand "~" in /home/username
Summary: rpmlint doesn't expand "~" in /home/username
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-01 19:19 UTC by Germán Racca
Modified: 2013-08-03 07:54 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-08-03 07:54:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Germán Racca 2013-08-01 19:19:24 UTC
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 21:28:51 UTC
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 22:31:41 UTC
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 22:34:18 UTC
(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 07:42:46 UTC
(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 07:54:11 UTC
(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.