Bug 5028 - Don't let Python buffer stdout
Summary: Don't let Python buffer stdout
Status: RESOLVED WONTFIX
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 1
Hardware: All Linux
Priority: Low normal
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-19 14:28 CET by Olav Vitters
Modified: 2012-12-02 14:32 CET (History)
0 users

See Also:
Source RPM: mgarepo
CVE:
Status comment:


Attachments

Description Olav Vitters 2012-03-19 14:28:08 CET
Please change:
#!/usr/bin/python
to:
#!/usr/bin/python -u

This will ensure the output is more consistent when running from a script (or when stdout is redirected, e.g. to a file or to cat).

I have a script called mga-gnome which assumes the last line is the error message. I currently set PYTHONUNBUFFERED=1 in my script to ensure that mgarepo does the right thing. However, it would be nicer if mgarepo works nicely by default.

To demonstrate:

> ------------------ ORIGINAL OUTPUT ------------------

$ mgarepo submit | cat
error: command failed: ssh pkgsubmit.mageia.org /usr/local/bin/submit_package -t cauldron --define sid=6dbfdcb3-0678-4205-9763-b0984136901c -r 213551 svn+ssh://svn.mageia.org/svn/packages/cauldron/yelp
--2012-03-19 14:22:33--  http://binrepo.mageia.org//79e237b198412ffb4737d6990b0fe573f14568d2
Resolving binrepo.mageia.org (binrepo.mageia.org)... 2a02:2178:2:7::3, 212.85.158.147
Connecting to binrepo.mageia.org (binrepo.mageia.org)|2a02:2178:2:7::3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 856392 (836K) [text/plain]
Saving to: `/var/lib/schedbot/repsys/tmp/tmpeNF4w4/SOURCES/yelp-3.3.4.tar.xz'

     0K .......... .......... .......... .......... ..........  5%  293M 0s
    50K .......... .......... .......... .......... .......... 11%  489M 0s
   100K .......... .......... .......... .......... .......... 17%  472M 0s
   150K .......... .......... .......... .......... .......... 23%  325M 0s
   200K .......... .......... .......... .......... .......... 29%  521M 0s
   250K .......... .......... .......... .......... .......... 35%  545M 0s
   300K .......... .......... .......... .......... .......... 41%  554M 0s
   350K .......... .......... .......... .......... .......... 47%  544M 0s
   400K .......... .......... .......... .......... .......... 53%  486M 0s
   450K .......... .......... .......... .......... .......... 59%  685M 0s
   500K .......... .......... .......... .......... .......... 65%  677M 0s
   550K .......... .......... .......... .......... .......... 71%  711M 0s
   600K .......... .......... .......... .......... .......... 77%  707M 0s
   650K .......... .......... .......... .......... .......... 83%  664M 0s
   700K .......... .......... .......... .......... .......... 89%  572M 0s
   750K .......... .......... .......... .......... .......... 95%  718M 0s
   800K .......... .......... .......... ......               100%  532M=0.002s

2012-03-19 14:22:33 (525 MB/s) - `/var/lib/schedbot/repsys/tmp/tmpeNF4w4/SOURCES/yelp-3.3.4.tar.xz' saved [856392/856392]

--2012-03-19 14:22:33--  http://binrepo.mageia.org//ecd8907e3e603c55398c420015f5a882de5c1471
Resolving binrepo.mageia.org (binrepo.mageia.org)... 2a02:2178:2:7::3, 212.85.158.147
Connecting to binrepo.mageia.org (binrepo.mageia.org)|2a02:2178:2:7::3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4683 (4.6K) [text/plain]
Saving to: `/var/lib/schedbot/repsys/tmp/tmpeNF4w4/SOURCES/yelp.png'

     0K ....                                                  100%  722M=0s

2012-03-19 14:22:33 (722 MB/s) - `/var/lib/schedbot/repsys/tmp/tmpeNF4w4/SOURCES/yelp.png' saved [4683/4683]

warning: /usr/share/repsys/default.chlog not found. using built-in template.
error: Failed to upload svn://svn.mageia.org/svn/packages/cauldron/yelp:
Executing perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --config /etc/youri/submit-todo.conf --define user=ovitters --define sid=6dbfdcb3-0678-4205-9763-b0984136901c cauldron /var/lib/schedbot/repsys/srpms/@213551:yelp-3.3.4-1.mga2.src.rpm (sudo_user ovitters)
UNIVERSAL->import is deprecated and will be removed in a future perl at /usr/lib/perl5/vendor_perl/5.12.2/YAML/AppConfig.pm line 5
Deprecated method, use as_string now at /usr/share/mga-youri-submit/lib/Youri/Submit/Check/ACL.pm line 32
Deprecated method, use as_file() now at /usr/share/mga-youri-submit/lib/Youri/Submit/Check/Host.pm line 32
Initializing repository
Deprecated method, use as_string now at /usr/lib/perl5/vendor_perl/5.12.3/Youri/Repository/Mageia.pm line 457
Submission errors, aborting:
- yelp-3.3.4-1.mga2.src:
 - Current or newer revision(s) already exists in core/release for cauldron: yelp-3.3.4-1.mga2.src

Submitting yelp at revision 213551
URL: svn+ssh://svn.mageia.org/svn/packages/cauldron/yelp
Implicit target: cauldron


> ------------------ UNBUFFERED OUTPUT ------------------

$ PYTHONUNBUFFERED=1 mgarepo submit | cat
Submitting yelp at revision 213551
URL: svn+ssh://svn.mageia.org/svn/packages/cauldron/yelp
Implicit target: cauldron
error: command failed: ssh pkgsubmit.mageia.org /usr/local/bin/submit_package -t cauldron --define sid=2179b54e-b809-481f-932b-b05e7883e77e -r 213551 svn+ssh://svn.mageia.org/svn/packages/cauldron/yelp
--2012-03-19 14:22:48--  http://binrepo.mageia.org//79e237b198412ffb4737d6990b0fe573f14568d2
Resolving binrepo.mageia.org (binrepo.mageia.org)... 2a02:2178:2:7::3, 212.85.158.147
Connecting to binrepo.mageia.org (binrepo.mageia.org)|2a02:2178:2:7::3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 856392 (836K) [text/plain]
Saving to: `/var/lib/schedbot/repsys/tmp/tmp39Wihs/SOURCES/yelp-3.3.4.tar.xz'

     0K .......... .......... .......... .......... ..........  5%  240M 0s
    50K .......... .......... .......... .......... .......... 11%  492M 0s
   100K .......... .......... .......... .......... .......... 17%  543M 0s
   150K .......... .......... .......... .......... .......... 23%  565M 0s
   200K .......... .......... .......... .......... .......... 29%  545M 0s
   250K .......... .......... .......... .......... .......... 35%  566M 0s
   300K .......... .......... .......... .......... .......... 41%  538M 0s
   350K .......... .......... .......... .......... .......... 47%  554M 0s
   400K .......... .......... .......... .......... .......... 53%  403M 0s
   450K .......... .......... .......... .......... .......... 59%  303M 0s
   500K .......... .......... .......... .......... .......... 65%  709M 0s
   550K .......... .......... .......... .......... .......... 71%  733M 0s
   600K .......... .......... .......... .......... .......... 77%  707M 0s
   650K .......... .......... .......... .......... .......... 83%  751M 0s
   700K .......... .......... .......... .......... .......... 89%  719M 0s
   750K .......... .......... .......... .......... .......... 95%  727M 0s
   800K .......... .......... .......... ......               100%  553M=0.002s

2012-03-19 14:22:48 (515 MB/s) - `/var/lib/schedbot/repsys/tmp/tmp39Wihs/SOURCES/yelp-3.3.4.tar.xz' saved [856392/856392]

--2012-03-19 14:22:48--  http://binrepo.mageia.org//ecd8907e3e603c55398c420015f5a882de5c1471
Resolving binrepo.mageia.org (binrepo.mageia.org)... 2a02:2178:2:7::3, 212.85.158.147
Connecting to binrepo.mageia.org (binrepo.mageia.org)|2a02:2178:2:7::3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4683 (4.6K) [text/plain]
Saving to: `/var/lib/schedbot/repsys/tmp/tmp39Wihs/SOURCES/yelp.png'

     0K ....                                                  100%  383M=0s

2012-03-19 14:22:48 (383 MB/s) - `/var/lib/schedbot/repsys/tmp/tmp39Wihs/SOURCES/yelp.png' saved [4683/4683]

warning: /usr/share/repsys/default.chlog not found. using built-in template.
error: Failed to upload svn://svn.mageia.org/svn/packages/cauldron/yelp:
Executing perl -I/usr/share/mga-youri-submit/lib /usr/share/mga-youri-submit/bin/youri-submit --config /etc/youri/submit-todo.conf --define user=ovitters --define sid=2179b54e-b809-481f-932b-b05e7883e77e cauldron /var/lib/schedbot/repsys/srpms/@213551:yelp-3.3.4-1.mga2.src.rpm (sudo_user ovitters)
UNIVERSAL->import is deprecated and will be removed in a future perl at /usr/lib/perl5/vendor_perl/5.12.2/YAML/AppConfig.pm line 5
Deprecated method, use as_string now at /usr/share/mga-youri-submit/lib/Youri/Submit/Check/ACL.pm line 32
Deprecated method, use as_file() now at /usr/share/mga-youri-submit/lib/Youri/Submit/Check/Host.pm line 32
Initializing repository
Deprecated method, use as_string now at /usr/lib/perl5/vendor_perl/5.12.3/Youri/Repository/Mageia.pm line 457
Submission errors, aborting:
- yelp-3.3.4-1.mga2.src:
 - Current or newer revision(s) already exists in core/release for cauldron: yelp-3.3.4-1.mga2.src
Manuel Hiebel 2012-03-19 17:02:56 CET

Assignee: bugsquad => boklm

Comment 1 Marja Van Waes 2012-07-06 15:04:50 CEST
Please look at the bottom of this mail to see whether you're the assignee of this  bug, if you don't already know whether you are.


If you're the assignee:

We'd like to know for sure whether this bug was assigned correctly. Please change status to ASSIGNED if it is, or put OK on the whiteboard instead.

If you don't have a clue and don't see a way to find out, then please put NEEDHELP on the whiteboard.

Please assign back to Bug Squad or to the correct person to solve this bug if we were wrong to assign it to you, and explain why.

Thanks :)

**************************** 

@ the reporter and persons in the cc of this bug:

If you have any new information that wasn't given before (like this bug being valid for another version of Mageia, too, or it being solved) please tell us.

@ the reporter of this bug

If you didn't reply yet to a request for more information, please do so within two weeks from now.

Thanks all :-D
Comment 2 Manuel Hiebel 2012-10-20 22:04:13 CEST
boklm leave Mageia

Assignee: boklm => bugsquad

Comment 3 Manuel Hiebel 2012-11-05 16:52:43 CET
This message is a reminder that Mageia 1 is nearing its end of life. 
In approximately 25 days from now, Mageia will stop maintaining and issuing 
updates for Mageia 1. At that time this bug will be closed as WONTFIX (EOL) if it 
remains open with a Mageia 'version' of '1'.

Package Maintainer: If you wish for this bug to remain open because you plan to 
fix it in a currently maintained version, simply change the 'version' to a later 
Mageia version prior to Mageia 1's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not 
be able to fix it before Mageia 1 is end of life.  If you would still like to see 
this bug fixed and are able to reproduce it against a later version of Mageia, 
you are encouraged to click on "Version" and change it against that version 
of Mageia.

Although we aim to fix as many bugs as possible during every release's lifetime, 
sometimes those efforts are overtaken by events. Often a more recent Mageia 
release includes newer upstream software that fixes bugs or makes them obsolete.

--
Mageia Bugsquad
Comment 4 Manuel Hiebel 2012-12-02 14:32:12 CET
Mageia 1 changed to end-of-life (EOL) status on ''1st December''. Mageia 1 is no 
longer maintained, which means that it will not receive any further security or 
bug fix updates. As a result we are closing this bug. 

If you can reproduce this bug against a currently maintained version of Mageia 
please feel free to click on "Version" change it against that version of Mageia and reopen this bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

--
Mageia Bugsquad

Status: NEW => RESOLVED
Resolution: (none) => WONTFIX


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