Change the index file format to explicitly indicate the appropriate
[sgt/agedu] / TODO
CommitLineData
70322ae3 1TODO list for agedu
2===================
3
4Before it's non-embarrassingly releasable:
5
f2e52893 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.
70322ae3 13
9d0b9596 14 - work out what to do about atimes on directories in the absence of
15 the Linux syscall magic
70322ae3 16 * one option is to read them during the scan and reinstate them
17 after each recursion pop. Race-condition prone.
9d0b9596 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.
70322ae3 27
f2e52893 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:
373a02e5 59 + store the path separator character in the index file when
60 writing it, and load it back in when reading
f2e52893 61 + store literal byte sizes in all the size fields, instead of
62 Unixoid 512-byte sectors
70322ae3 63
f2e52893 64 - man page, licence.
9d0b9596 65
70322ae3 66Future directions:
67
1e8d78b9 68 - IPv6 support in the HTTP server
69
70322ae3 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
70322ae3 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.
f2e52893 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.
70322ae3 109
f2e52893 110 - http://msdn.microsoft.com/en-us/library/ms724290.aspx suggest
111 modern Windowses support atime-equivalents, so a Windows port is
373a02e5 112 possible in principle.
113 + For a full Windows port, would need to modify the current
114 structure a lot, to abstract away (at least) memory-mapping of
115 files, details of disk scan procedure, networking for httpd.
116 Unclear what the right UI would be on Windows, too;
117 command-line exactly as now might be considered just a
118 _little_ unfriendly. Or perhaps not.
119 + Alternatively, a much easier approach would be to write a
120 Windows version of just the --scan-dump mode, which does a
121 filesystem scan via the Windows API and generates a valid
122 agedu dump file on standard output. Then one would simply feed
123 that over the network connection of one's choice to the rest
124 of agedu running on Unix as usual.