Code Monkey home page Code Monkey logo

dutree's People

Contributors

wdoekes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

leonzhao2020

dutree's Issues

dutree attempts to read special files like /proc/kcore

$ sudo python dutree/dutree.py / 
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/task/14532/fd/3'
  warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/task/14532/fdinfo/3'
  warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/fd/3'
  warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 2] No such file or directory: '/proc/14532/fdinfo/3'
  warnings.warn(str(e))
dutree/dutree.py:262: UserWarning: [Errno 13] Permission denied: '/run/user/1000/gvfs'
  warnings.warn(str(e))
 128.0 T  /proc/kcore
  17.0 G  /*
   -----
 128.0 T  TOTAL (140755721649795)

Should we blacklist /proc? Should we stay on the same filesystem? We might be able to use st_dev or st_rdev for this.

UserWarning default output is 2 (long) lines

/usr/local/lib/python3.5/dist-packages/dutree/dutree.py:291: UserWarning: [Errno 13] Permission denied: '/dev/.lxd-mounts'
  warnings.warn(str(e))

Change to:

dutree.py:291: UserWarning: [Errno 13] Permission denied: '/dev/.lxd-mounts'

?

listdir can also give EPERM, also warn and allow..

    def _scan(self, path, parent_node):
        fraction = self._subtotal // 20  # initialize fraction
        children = []               # large separate child nodes
        mixed_total = 0             # "rest of the dir", add to this node

        try:
            files = listdir(path or '/')
        except OSError:   # <--- here
            # warn, and /sys/kernel/debug
            files = []

        for file_ in files:

Sometimes *-dirs are leftover without any any other dir

 755.0 M  invoice/renderedinvoices/2012/
   1.1 G  invoice/renderedinvoices/2013/
   1.5 G  invoice/renderedinvoices/2014/
   1.9 G  invoice/renderedinvoices/2015/*
   3.2 G  invoice/renderedinvoices/2016/
   4.2 G  invoice/renderedinvoices/2017/*
   1.1 G  invoice/renderedinvoices/*
 801.9 M  invoice/*
   -----
  14.5 G  TOTAL (15551665153)

dutree dies if a file is removed during scan race

# dutree /somewhere
Traceback (most recent call last):
  File "/usr/local/bin/dutree", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 331, in main
    tree = scanner.scan()
  File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 230, in scan
    self._tree, self._path, 0)
  File "/usr/local/lib/python2.7/dist-packages/dutree/dutree.py", line 248, in _scan
    st = lstat(fn)
OSError: [Errno 2] No such file or directory: '/somewhere/.pytree.py.4.swp'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.