test_osutils fails because /dev/null may be a symlink

Bug #832257 reported by Igor Pashev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned
Breezy
Fix Released
Medium
Jelmer Vernooij

Bug Description

test_osutils.py check whether /dev/null is a character device, but /dev/null can be a symlink [to character device] as in Illumos (aka OpenSolaris).

http://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev/view/head:/bzrlib/tests/test_osutils.py#L303

Related branches

Revision history for this message
Martin Pool (mbp) wrote :

Thanks, I think that accounts for a previously known failure.

This test wants to examine something that is not a regular file, directory, or symlink. Of course we can't create device nodes from a non-root test.

What should we do?
 - skip this test if /dev/null is a symlink? the test is not super important but this report shows it's good to catch portability bugs.
 - assert there is at least one device file in /dev?
 - if /dev/null is a symlink, follow it, and check the ultimate target is a device

I think I like the last best. If you want to try a patch, please do.

tags: added: solaris test-failure
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
summary: - /dev/null may be a symlink
+ test_osutils fails because /dev/null may be a symlink
Revision history for this message
Igor Pashev (pashev-igor) wrote :

Now I use this patch. It makes one more step it /dev/null is symlink.
Maybe make a loop "while symlink read target"?

Revision history for this message
Igor Pashev (pashev-igor) wrote :

But there two questions:

1. What if symlink is dangled
2. What if symlinks are cycled :-)

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 832257] Re: test_osutils fails because /dev/null may be a symlink

On 24 August 2011 19:09, ip1981 <email address hidden> wrote:
> But there two questions:
>
> 1. What if symlink is dangled
> 2. What if symlinks are cycled :-)

won't other unix things be sad if /dev/null doesn't exist at all?

os.path.realpath should cope with cycles safely.

m

Revision history for this message
Igor Pashev (pashev-igor) wrote :

Patch with realpath()

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in bzr:
status: Confirmed → Fix Committed
status: Fix Committed → Confirmed
Changed in brz:
status: New → Fix Committed
importance: Undecided → Medium
tags: removed: check-for-breezy
Jelmer Vernooij (jelmer)
Changed in brz:
status: Fix Committed → Fix Released
assignee: nobody → Jelmer Vernooij (jelmer)
milestone: none → 3.0.0
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.