bugrdiff-backup - Bugs: bug #26064, os.popen2 seems depricated in...


bug #26064: os.popen2 seems depricated in Python 2.6

Submitted by:  Andreas Olsson <andol>
Submitted on:  Wed Apr 1 23:07:04 2009  
Votes:  10  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Confirmed
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Mon Mar 14 10:59:03 2011, comment #9:

This error is also seen on Debian Squeeze.

Tue Jun 22 08:03:51 2010, comment #8:

I did a similar patch as http://savannah.nongnu.org/bugs/download.php?file_id=18349, but found that I had to set shell=True to allow custom commands via rdiff-backup --remote-schema - not sure how that will work on windows, though.

Sat Feb 20 14:18:57 2010, comment #7:

@John Khvatov

Thanks for the versioning info.

No, the Ubuntu patch won't work on NT systems, so it is really nothing which should be applied upstream. Yet, in the meantime I figured it would be a safe assumption that an Ubuntu systems wouldn't be a NT system :-)

How is your patch failing on Ubuntu? Trying to apply to the original rdiff-backup source? On which Ubuntu version? I just applied, and used, it cleanly from my devel 10.04 system.

Andreas Olsson <andol>
Sat Feb 20 09:28:31 2010, comment #6:

reply to comment https://bugs.launchpad.net/ubuntu/+source/rdiff-backup/+bug/436035/comments/3:

sys.version_info is a tuple of int numbers, which correctly compared with (2, 4)

>>> sys.version_info

(2, 6, 2, 'final', 0)

>>> sys.version_info > (2, 4)



(FYI, subprocess is available with 2.4.)

In my patch (in comment #2) shell=True for nix and shell=False for nt:
+ shell = os.name != "nt"
+ process = subprocess.Popen(remote_cmd, shell=shell, bufsize=0,

So, your patch doesn't work on nt. Right?

I don't understand why my patch fails on ubuntu..

John Khvatov <ivaxer>
Sat Feb 20 00:36:09 2010, comment #5:

In Ubuntu 9.10, this fall, we introduced a patch similar to the one mentioned in comment #2. To my knowledge there have been no problems with it.

See also https://bugs.launchpad.net/bugs/436035

Andreas Olsson <andol>
Sun Jan 31 10:56:58 2010, comment #4:

+1 on this patch - worked for me on a bundle of my Gentoo based systems. x86 and and x86_64. Python 2.6.4 and was using rdiff 1.2.8. Thanks!

Sat Jan 2 21:13:06 2010, comment #3:

Any new news on this? The patch in comment #2 works here fine.

I can apply it to the Fedora package, but better would be to confirm this is the right fix and get it applied upstream. ;)

Kevin Fenzi <nirik>
Project Member
Wed Oct 14 14:44:17 2009, comment #2:

I think attached patch is not quite correct. On Unix remote_cmd should be executed throught shell (shell=True in Popen constructor), or remote_cmd changes needed.

This my patch:

P.S. I don't know why current code works on Windows. Is it really works?

John Khvatov <ivaxer>
Wed Apr 1 23:48:42 2009, comment #1:

Yes, and in fact, for the native Windows binary, we use Python 2.6 and had to add code to ignore some other deprecation warnings.

Thanks for the reminder about os.popen2 (I have it down in my Python 3 transition notes).

Andrew Ferguson <owsla>
Project Administrator
Wed Apr 1 23:07:04 2009, original submission:

Running rdiff-backup under Python 2.6 I get a warning about os.popen2 being deprecated. This happens both using rdiff-backup 1.2.8 and rdiff-backup 1.3.3.

andreas@pc13267v2:~$ rdiff-backup source/ pc13267v3::dest
/usr/local/lib/python2.6/dist-packages/rdiff_backup/SetConnections.py:148: DeprecationWarning: os.popen2 is deprecated. Use the subprocess module.
stdin, stdout = os.popen2(remote_cmd)
andreas@pc13267v3's password:

Besides the warning, rdiff-backup still behaves exactly as it should. The backup was completed without any problems.

I have no idea whatever it is feasible or not to have this fixed in 1.2.x. Yet, if nothing else, I guess it might be something to consider working on 1.3.x?

Both Ubuntu 9.04 and (if I'm not mistaken) Fedora 11 will be using Python 2.6.

Andreas Olsson <andol>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #18349:  subprocess_in_newer_python.patch added by None (748B - text/x-patch - Half-liner to use subprocess in Python 2.6 and above)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by nirik (Posted a comment)
  • -unavailable- added by donv (Voted in favor of this item)
  • -unavailable- added by ivaxer (Posted a comment)
  • -unavailable- added by owsla (Posted a comment)
  • -unavailable- added by andol (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 10 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Nov 30 22:46:47 2009donvCarbon-Copy-=>Added donv
    Wed Jul 1 07:24:15 2009NoneAttached File-=>Added subprocess_in_newer_python.patch, #18349
    Wed Apr 1 23:48:42 2009owslaStatusNone=>Confirmed

    Back to the top

    Powered by Savane 3.1-cleanup1