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