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