[Bug 1029621] Re: os.stat() and os.lstat() returnst_dev = 5 for all devices

Matthias Klose doko at ubuntu.com
Mon Sep 10 11:11:20 UTC 2012

look at the st_mode attribute, not st_dev

** Changed in: python3.2 (Ubuntu)
       Status: New => Invalid

You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python3.2 in Ubuntu.

  os.stat() and os.lstat() returnst_dev = 5 for all devices

Status in “python3.2” package in Ubuntu:

Bug description:
  Using Python 3.2 on Xubuntu 12.04 on AMD64
  When calling os.stat() or os.lstat() on with a path to a device file, stat.st_dev is always 5.   This in turn casues os.major() and os.minor() to return incorrect values for the particular device file.

  Python 3.2.3 (default, May  3 2012, 15:51:42) 
  [GCC 4.6.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import os
  >>> os.stat('/dev/sda')
  posix.stat_result(st_mode=25008, st_ino=6887, st_dev=5, st_nlink=1, st_uid=0, st_gid=6, st_size=0, st_atime=1343317745, st_mtime=1343317744, st_ctime=1343317744)
  >>> os.stat('/dev/nvram')
  posix.stat_result(st_mode=8608, st_ino=7816, st_dev=5, st_nlink=1, st_uid=0, st_gid=15, st_size=0, st_atime=1343317740, st_mtime=1343317740, st_ctime=1343317740)
  >>> os.stat('/dev/tty1')
  posix.stat_result(st_mode=8624, st_ino=1044, st_dev=5, st_nlink=1, st_uid=0, st_gid=5, st_size=0, st_atime=1343317740, st_mtime=1343317805, st_ctime=1343317805)

  ProblemType: Bug
  DistroRelease: Ubuntu 12.04
  Package: python3.2 3.2.3-0ubuntu3
  ProcVersionSignature: Ubuntu 3.2.0-27.43-generic 3.2.21
  Uname: Linux 3.2.0-27-generic x86_64
  ApportVersion: 2.0.1-0ubuntu11
  Architecture: amd64
  Date: Thu Jul 26 15:11:35 2012
  InstallationMedia: Xubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
  SourcePackage: python3.2
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:

More information about the foundations-bugs mailing list