Bug 667433 - fedpkg aborts with AttributeError
Summary: fedpkg aborts with AttributeError
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-packager
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Dennis Gilmore
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 667507 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-05 15:37 UTC by Mamoru TASAKA
Modified: 2013-01-10 06:24 UTC (History)
4 users (show)

Fixed In Version: fedora-packager-0.5.2.0-2.fc13
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-19 21:05:28 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Import subprocess from stdlib when possible (846 bytes, patch)
2011-01-05 21:36 UTC, Toshio Ernie Kuratomi
no flags Details | Diff
Switch away from list2cmdline() (3.96 KB, patch)
2011-01-05 21:39 UTC, Toshio Ernie Kuratomi
no flags Details | Diff

Description Mamoru TASAKA 2011-01-05 15:37:08 UTC
Description of problem:
Well, fedpkg aborts like:

$ fedpkg co --branches mfiler3
Traceback (most recent call last):
  File "/usr/bin/fedpkg", line 1086, in <module>
    args.command(args)
  File "/usr/bin/fedpkg", line 425, in clone
    pyfedpkg.clone_with_dirs(args.module[0], args.user)
  File "/usr/lib/python2.7/site-packages/pyfedpkg/__init__.py", line 414, in clone_with_dirs
    clone(module, user, top_path, bare_dir=repo_path)
  File "/usr/lib/python2.7/site-packages/pyfedpkg/__init__.py", line 382, in clone
    _run_command(cmd)
  File "/usr/lib/python2.7/site-packages/pyfedpkg/__init__.py", line 136, in _run_command
    subprocess.list2cmdline(cmd))
AttributeError: 'module' object has no attribute 'list2cmdline'


Version-Release number of selected component (if applicable):
fedpkg-0.5.1.4-7.fc15.noarch
python-2.7.1-1.fc15.i686

How reproducible:
100%

Additional info:
Downgrading python to python-2.7-13.fc15.i686 does not seem to
work.

Comment 1 Mamoru TASAKA 2011-01-05 15:56:57 UTC
Downloading python-kitchen from 0.2.2-1.fc15 to
0.2.1-0.1.a1.fc15.noarch seems to "workaround" this issue.

Comment 2 Mamoru TASAKA 2011-01-05 15:58:17 UTC
s/Downloading/Downgrading/

Comment 3 Toshio Ernie Kuratomi 2011-01-05 18:19:24 UTC
Thanks, Looking into this now.

Comment 4 Dave Malcolm 2011-01-05 20:04:51 UTC
*** Bug 667507 has been marked as a duplicate of this bug. ***

Comment 5 Toshio Ernie Kuratomi 2011-01-05 21:18:47 UTC
Initial discovery, python side:

* list2cmdline() isn't part of the publically defined API of subprocess as given by __all__ however, it is according to the convention that all non-public methods are prepended with an underscore ("_").  list2cmdline() is also not documented (although it is refered to in documentation).

* list2cmdline() is documented as (and used within subprocess for the purpose of) """Translate a sequence of arguments into a command line string, using the same rules as the MS C runtime""".  It's really just for use in constructing commandlines in Windows, not on POSIX systems.

Remedies:
* Upstream bug opened to decide whether list2cmdline() is public or private:
  http://bugs.python.org/issue10838

Initial discovery kitchen side:

* Kitchen has changed to only exporting things listed in subprocess.__all__ in 0.2.2.  This is why 0.2.2 breaks fedpkg whereas 0.2.1 does not.

Remedies:
* After googling to see that list2cmdline() and two public/private variables are being used in actual code, I'm going to explicitly add list2cmdline and the other two variables to what gets exposed via kitchen.subprocess.  That should fix things for now.  Note that I will follow upstream for python-2.7 wrt whether these stay public or not (I don't anticipate this being fixed upstream in python-2.x, only in python-3.x so I feel comfortable with this).

Discoveries fedpkg side:
* list2cmdline() shouldn't be used here.  It's to create a commandline that's usable by the MS C runtime.  Not for Unix shells (and curiously, also not for MS cmd.exe).
* fepkg is importing subprocess from kitchen in preference to subprocess from the stdlib.  We should only do that on python < 2.5 (which doesn't have check_call).  Fixing this will solve this issue everywhere but EPEL4 and EPEL5.

Remedies:
* I'll add a pair of patches for each of these issues and attach to this bug.

Comment 6 Toshio Ernie Kuratomi 2011-01-05 21:36:19 UTC
Created attachment 471945 [details]
Import subprocess from stdlib when possible

First patch to fedpkg will only use kitchen's subprocess if there isn't a new enough version available in the stdlib.

Comment 7 Toshio Ernie Kuratomi 2011-01-05 21:39:27 UTC
Created attachment 471947 [details]
Switch away from list2cmdline()

This uses ' '.join() instead of list2cmdline().  Jesse vaguely recalls there was a reason he didn't like ' '.join() but neither of us know what that would be at the moment.  Since this is used in messages output by logging, this is unlikely to break anything; just result in some commandlines that aren't formatted optimally.  If you find a case of that, I'll be happy to help fix it.

Comment 8 Fedora Update System 2011-01-06 02:19:18 UTC
python-kitchen-0.2.3-2.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/python-kitchen-0.2.3-2.fc13

Comment 9 Fedora Update System 2011-01-06 02:19:24 UTC
python-kitchen-0.2.3-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/python-kitchen-0.2.3-2.fc14

Comment 10 Fedora Update System 2011-01-06 02:19:31 UTC
python-kitchen-0.2.3-2.el4 has been submitted as an update for Fedora EPEL 4.
https://admin.fedoraproject.org/updates/python-kitchen-0.2.3-2.el4

Comment 11 Fedora Update System 2011-01-06 02:19:39 UTC
python-kitchen-0.2.3-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/python-kitchen-0.2.3-2.el5

Comment 12 Toshio Ernie Kuratomi 2011-01-06 02:29:16 UTC
Note, this bug isn't set to close when those updates go to stable since there's the patches here to apply to fedpkg.  But they should make it so that it doesn't matter that fedpkg is using private methods of subprocess until those patches can be applied.

Comment 13 Fedora Update System 2011-01-06 18:50:44 UTC
fedora-packager-0.5.2.0-2.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/fedora-packager-0.5.2.0-2.el5

Comment 14 Fedora Update System 2011-01-06 19:01:53 UTC
fedora-packager-0.5.2.0-2.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/fedora-packager-0.5.2.0-2.fc13

Comment 15 Fedora Update System 2011-01-06 19:04:13 UTC
fedora-packager-0.5.2.0-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/fedora-packager-0.5.2.0-2.fc14

Comment 16 Fedora Update System 2011-01-07 17:35:48 UTC
fedora-packager-0.5.2.0-2.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update fedora-packager'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/fedora-packager-0.5.2.0-2.el5

Comment 17 Fedora Update System 2011-01-14 20:33:06 UTC
python-kitchen-0.2.3-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2011-01-14 20:34:17 UTC
python-kitchen-0.2.3-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2011-01-19 21:04:39 UTC
fedora-packager-0.5.2.0-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2011-01-21 19:22:15 UTC
python-kitchen-0.2.3-2.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2011-01-21 19:22:29 UTC
python-kitchen-0.2.3-2.el4 has been pushed to the Fedora EPEL 4 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2011-01-31 15:52:48 UTC
fedora-packager-0.5.2.0-2.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Fedora Update System 2011-01-31 19:55:28 UTC
fedora-packager-0.5.2.0-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.


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