fe0cb71bdf5011dbaf9fab781e2842a7b9f2645f
[sgt/agedu] / TODO
1 TODO list for agedu
2 ===================
3
4 Before it's non-embarrassingly releasable:
5
6 - more flexible running modes
7 + at least some ability to chain actions within the same run:
8 "agedu -s dirname -w" would seem handy.
9
10 - work out what to do about atimes on directories in the absence of
11 the Linux syscall magic
12 * one option is to read them during the scan and reinstate them
13 after each recursion pop. Race-condition prone.
14 * marking them in a distinctive colour in the reports is another
15 option.
16 * a third option is simply to ignore space taken up by
17 directories in the first place; inaccurate but terribly simple.
18 * incidentally, sometimes open(...,O_NOATIME) will fail, and
19 then we have to fall back to ordinary open. Be prepared to do
20 this, which probably means getting rid of the icky macro
21 hackery in du.c and turning it into a more sensible run-time
22 abstraction layer.
23
24 - polish the plain-text output to make it look more like du
25 + configurable recursive output depth
26 + show the right bits last
27
28 - figure out what to do about scans starting in the root directory
29 + Currently we end up with a double leading slash on the
30 pathnames, which is ugly, and we also get a zero-length href
31 in between those slashes which means the web interface doesn't
32 let you click back up to the top level at all.
33 + One big problem here is that a lot of the code assumes that
34 you can find the extent of a pathname by searching for "foo"
35 and "foo^A", trusting that anything inside the directory will
36 begin "foo/". So I'd need to consistently fix this everywhere
37 so that a trailing slash is disregarded while doing it, but
38 not actually removed.
39 + The text output gets it all wrong.
40 + The HTML output is fiddly even at the design stage: where
41 would I _ideally_ put the link to click on to get back to /?
42 It's unclear!
43
44 - cross-Unix portability:
45 + use autoconf
46 * configure use of stat64
47 * configure use of /proc/net/tcp
48 * configure use of /dev/random
49 * configure use of Linux syscall magic replacing readdir
50 + later glibcs have fdopendir, hooray! So we can use that
51 too, if it's available and O_NOATIME is too.
52 * what do we do elsewhere about _GNU_SOURCE?
53
54 - man page, licence.
55
56 Future directions:
57
58 - IPv6 support in the HTTP server
59
60 - run-time configuration in the HTTP server
61 * I think this probably works by having a configuration form, or
62 a link pointing to one, somewhere on the report page. If you
63 want to reconfigure anything, you fill in and submit the form;
64 the web server receives HTTP GET with parameters and a
65 referer, adjusts its internal configuration, and returns an
66 HTTP redirect back to the referring page - which it then
67 re-renders in accordance with the change.
68 * All the same options should have their starting states
69 configurable on the command line too.
70
71 - curses-ish equivalent of the web output
72 + try using xterm 256-colour mode. Can (n)curses handle that? If
73 not, try doing it manually.
74 + I think my current best idea is to bypass ncurses and go
75 straight to terminfo: generate lines of attribute-interleaved
76 text and display them, so we only really need the sequences
77 "go here and display stuff", "scroll up", "scroll down".
78 + I think the attribute-interleaved text might be possible to do
79 cunningly, as well: we autodetect a basically VT-style
80 terminal, and add 256-colour sequences on the end. So, for
81 instance, we might set ANSI-yellow foreground, set ANSI-red
82 background, _then_ set both foreground and background to the
83 appropriate xterm 256-colour, and then display some
84 appropriate character which would have given the right blend
85 of the ANSI-16 fore and background colours. Then the same
86 display code should gracefully degrade in the face of a
87 terminal which doesn't support xterm-256.
88 * current best plan is to simulate the xterm-256 shading from
89 0/5 to 5/5 by doing space, colon and hash in colour A on
90 colour B background, then hash, colon and space in B on A
91 background.
92 + Infrastructure work before doing any of this would be to split
93 html.c into two: one part to prepare an abstract data
94 structure describing an HTML-like report (in particular, all
95 the index lookups, percentage calculation, vector arithmetic
96 and line sorting), and another part to generate the literal
97 HTML. Then the former can be reused to produce very similar
98 reports in coloured plain text.
99
100 - http://msdn.microsoft.com/en-us/library/ms724290.aspx suggest
101 modern Windowses support atime-equivalents, so a Windows port is
102 possible in principle.
103 + For a full Windows port, would need to modify the current
104 structure a lot, to abstract away (at least) memory-mapping of
105 files, details of disk scan procedure, networking for httpd.
106 Unclear what the right UI would be on Windows, too;
107 command-line exactly as now might be considered just a
108 _little_ unfriendly. Or perhaps not.
109 + Alternatively, a much easier approach would be to write a
110 Windows version of just the --scan-dump mode, which does a
111 filesystem scan via the Windows API and generates a valid
112 agedu dump file on standard output. Then one would simply feed
113 that over the network connection of one's choice to the rest
114 of agedu running on Unix as usual.