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 01 Apr 2009 11:07:04 PM UTC  
Votes:  10  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

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


( Jump to the original submission)

Mon 24 Feb 2020 10:17:47 AM UTC, comment #10: 

Quite obsolete with the move to Python3.

Eric L. <ericzolf>
Project Administrator
Mon 14 Mar 2011 10:59:03 AM UTC, comment #9: 

This error is also seen on Debian Squeeze.

Tue 22 Jun 2010 08:03:51 AM UTC, 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 20 Feb 2010 02:18:57 PM UTC, 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 20 Feb 2010 09:28:31 AM UTC, 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 20 Feb 2010 12:36:09 AM UTC, 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 31 Jan 2010 10:56:58 AM UTC, 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 02 Jan 2010 09:13:06 PM UTC, 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 14 Oct 2009 02:44:17 PM UTC, 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 01 Apr 2009 11:48:42 PM UTC, 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 01 Apr 2009 11:07:04 PM UTC, 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 Files:

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
  • -email is unavailable- added by ericzolf (Posted a comment)
  • -email is unavailable- added by nirik (Posted a comment)
  • -email is unavailable- added by donv (Voted in favor of this item)
  • -email is unavailable- added by ivaxer (Posted a comment)
  • -email is unavailable- added by owsla (Posted a comment)
  • -email is unavailable- added by andol (Submitted the item)

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

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-24 ericzolf StatusConfirmed => Works For Me
        Open/ClosedOpen => Closed
    2009-11-30 donv Carbon-Copy- => Added donv
    2009-07-01 None Attached File- => Added subprocess_in_newer_python.patch, #18349
    2009-04-01 owsla StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.5