test_osutils fails because /dev/null may be a symlink

Bug #832257 reported by Igor Pashev on 2011-08-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone
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).


Related branches

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
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"?

Igor Pashev (pashev-igor) wrote :

But there two questions:

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

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.


Igor Pashev (pashev-igor) wrote :

Patch with realpath()

Jelmer Vernooij (jelmer) on 2017-11-09
tags: added: check-for-breezy
Jelmer Vernooij (jelmer) on 2018-09-18
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) on 2018-09-23
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  Edit
Everyone can see this information.

Other bug subscribers