Spawing external diff fails with 'Bad file descriptor'

Bug #54651 reported by John A Meinel
4
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
John A Meinel

Bug Description

For an unknown reason, when running

'bzr diff --diff-options -b'

We get this error:
=== modified file 'bzrlib/transport/sftp.py'
diff: standard output: Bad file descriptor
bzr: ERROR: external diff failed with 2; command: ['diff', '--label', u'bzrlib/transport/sftp.py\t2006-07-28 16:52:19 +0000', '/tmp/bzr-diff-old-hA9Pci', '--label', u'bzrlib/transport/sftp.py\t2006-07-30 13:38:00 +0000', '/tmp/bzr-diff-new-SCWKi9', '--binary', '-u', '-b']

Looking closer, I can tell we are passing stdout as the file descriptor (fileno() == 1).
It seems we have to be doing something weird to stdout to cause it to complain that it is a bad file descriptor.

This probably should block 0.9, since it means external diff support is broken.

Related branches

Revision history for this message
John A Meinel (jameinel) wrote :
Changed in bzr:
importance: Untriaged → High
status: Unconfirmed → Confirmed
Revision history for this message
John A Meinel (jameinel) wrote :

There is a bug in subprocess where it closes the original stdin/stdout/etc if you pass in an alternative one.
So if you pass in the real stdin, it gets closed.
Found by Adeodato Simó.

Changed in bzr:
assignee: nobody → jameinel
Revision history for this message
John A Meinel (jameinel) wrote :

Adding a patch to subprocess.py that seems to fix the python module. (Written by Adeodato Simó)

Revision history for this message
John A Meinel (jameinel) wrote :

A possible patch against bzr, which works around the bug by passing in None, if it detects that it would otherwise pass in stdout. Also written by Adeodato Simó.

Revision history for this message
John A Meinel (jameinel) wrote :

The associated branch contains a test and a fix

Changed in bzr:
status: Confirmed → Fix Committed
John A Meinel (jameinel)
Changed in bzr:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.