Note about --dry-run.
[rsync/rsync.git] / TODO
1 -*- indented-text -*-
2
3 BUGS ---------------------------------------------------------------
4
5 There seems to be a bug with hardlinks
6
7   mbp/2 build$ ls -l /tmp/a /tmp/b -i
8   /tmp/a:
9   total 32
10   2568307 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a1
11   2568307 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a2
12   2568307 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a3
13   2568310 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a4
14   2568310 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a5
15   2568310 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b1
16   2568310 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b2
17   2568310 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b3
18
19   /tmp/b:
20   total 32
21   2568309 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a1
22   2568309 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a2
23   2568309 -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a3
24   2568311 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a4
25   2568311 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a5
26   2568311 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b1
27   2568311 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b2
28   2568311 -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b3
29   mbp/2 build$ rm -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
30   building file list ... done
31   created directory /tmp/b
32   ./
33   a1
34   a4
35   a2 => a1
36   a3 => a2
37   wrote 350 bytes  read 52 bytes  804.00 bytes/sec
38   total size is 232  speedup is 0.58
39   mbp/2 build$ rm -r /tmp/b
40   mbp/2 build$ ls -l /tmp/b
41   ls: /tmp/b: No such file or directory
42   mbp/2 build$ rm -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
43   rm: cannot remove `/tmp/b': No such file or directory
44   mbp/2 build$ rm -f -r /tmp/b && ./rsync -avH /tmp/a/ /tmp/b
45   building file list ... done
46   created directory /tmp/b
47   ./
48   a1
49   a4
50   a2 => a1
51   a3 => a2
52   wrote 350 bytes  read 52 bytes  804.00 bytes/sec
53   total size is 232  speedup is 0.58
54   mbp/2 build$ ls -l /tmp/b
55   total 32
56   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a1
57   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a2
58   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a3
59   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a4
60   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a5
61   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b1
62   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b2
63   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b3
64   mbp/2 build$ ls -l /tmp/a
65   total 32
66   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a1
67   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a2
68   -rw-rw-r--    3 mbp      mbp            29 Mar 25 17:30 a3
69   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a4
70   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 a5
71   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b1
72   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b2
73   -rw-rw-r--    5 mbp      mbp            29 Mar 25 17:30 b3
74
75
76 IMPORTANT ------------------------------------------------------------
77
78
79 --dry-run is insufficiently dry
80
81   Mark Santcroos points out that -n fails to list files which have
82   only metadata changes, though it probably should.  
83
84   There may be a Debian bug about this as well.
85
86
87 use chroot
88
89   If the platform doesn't support it, then don't even try.
90
91   If running as non-root, then don't fail, just give a warning.
92   (There was a thread about this a while ago?)
93
94     http://lists.samba.org/pipermail/rsync/2001-August/thread.html
95     http://lists.samba.org/pipermail/rsync/2001-September/thread.html
96
97
98 --files-from
99
100   Avoids traversal.  Better option than a pile of --include statements
101   for people who want to generate the file list using a find(1)
102   command or a script.
103
104
105 File list structure in memory
106
107   Rather than one big array, perhaps have a tree in memory mirroring
108   the directory tree.  
109
110   This might make sorting much faster!  (I'm not sure it's a big CPU
111   problem, mind you.)  
112
113   It might also reduce memory use in storing repeated directory names
114   -- again I'm not sure this is a problem.
115
116 Performance
117
118   Traverse just one directory at a time.  Tridge says it's possible.
119
120   At the moment rsync reads the whole file list into memory at the
121   start, which makes us use a lot of memory and also not pipeline
122   network access as much as we could.
123
124
125 Handling duplicate names
126
127   We need to be careful of duplicate names getting into the file list.
128   See clean_flist().  This could happen if multiple arguments include
129   the same file.  Bad.
130
131   I think duplicates are only a problem if they're both flowing
132   through the pipeline at the same time.  For example we might have
133   updated the first occurrence after reading the checksums for the
134   second.  So possibly we just need to make sure that we don't have
135   both in the pipeline at the same time.  
136
137   Possibly if we did one directory at a time that would be sufficient.
138
139   Alternatively we could pre-process the arguments to make sure no
140   duplicates will ever be inserted.  There could be some bad cases
141   when we're collapsing symlinks.
142
143   We could have a hash table.
144
145   The root of the problem is that we do not want more than one file
146   list entry referring to the same file.  At first glance there are
147   several ways this could happen: symlinks, hardlinks, and repeated
148   names on the command line.
149
150   If names are repeated on the command line, they may be present in
151   different forms, perhaps by traversing directory paths in different
152   ways, traversing paths including symlinks.  Also we need to allow
153   for expansion of globs by rsync.
154
155   At the moment, clean_flist() requires having the entire file list in
156   memory.  Duplicate names are detected just by a string comparison.
157
158   We don't need to worry about hard links causing duplicates because
159   files are never updated in place.  Similarly for symlinks.
160
161   I think even if we're using a different symlink mode we don't need
162   to worry.
163
164   Unless we're really clever this will introduce a protocol
165   incompatibility, so we need to be able to accept the old format as
166   well.
167
168
169 Memory accounting
170
171   At exit, show how much memory was used for the file list, etc.
172
173   Also we do a wierd exponential-growth allocation in flist.c.  I'm
174   not sure this makes sense with modern mallocs.  At any rate it will
175   make us allocate a huge amount of memory for large file lists.
176
177
178 Hard-link handling
179
180   At the moment hardlink handling is very expensive, so it's off by
181   default.  It does not need to be so.  
182
183   Since most of the solutions are rather intertwined with the file
184   list it is probably better to fix that first, although fixing
185   hardlinks is possibly simpler.
186
187   We can rule out hardlinked directories since they will probably
188   screw us up in all kinds of ways.  They simply should not be used.
189
190   At the moment rsync only cares about hardlinks to regular files.  I
191   guess you could also use them for sockets, devices and other beasts,
192   but I have not seen them.
193
194   When trying to reproduce hard links, we only need to worry about
195   files that have more than one name (nlinks>1 && !S_ISDIR). 
196
197   The basic point of this is to discover alternate names that refer to
198   the same file.  All operations, including creating the file and
199   writing modifications to it need only to be done for the first name.
200   For all later names, we just create the link and then leave it
201   alone.
202
203   If hard links are to be preserved:
204
205     Before the generator/receiver fork, the list of files is received
206     from the sender (recv_file_list), and a table for detecting hard
207     links is built.
208
209     The generator looks for hard links within the file list and does
210     not send checksums for them, though it does send other metadata.
211
212     The sender sends the device number and inode with file entries, so
213     that files are uniquely identified.
214
215     The receiver goes through and creates hard links (do_hard_links)
216     after all data has been written, but before directory permissions
217     are set.
218
219   At the moment device and inum are sent as 4-byte integers, which
220   will probably cause problems on large filesystems.  On Linux the
221   kernel uses 64-bit ino_t's internally, and people will soon have
222   filesystems big enough to use them.  We ought to follow NFS4 in
223   using 64-bit device and inode identification, perhaps with a
224   protocol version bump.
225
226   Once we've seen all the names for a particular file, we no longer
227   need to think about it and we can deallocate the memory.
228
229   We can also have the case where there are links to a file that are
230   not in the tree being transferred.  There's nothing we can do about
231   that.  Because we rename the destination into place after writing,
232   any hardlinks to the old file are always going to be orphaned.  In
233   fact that is almost necessary because otherwise we'd get really
234   confused if we were generating checksums for one name of a file and
235   modifying another.
236
237   At the moment the code seems to make a whole second copy of the file
238   list, which seems unnecessary.
239
240   We should have a test case that exercises hard links.  Since it
241   might be hard to compare ./tls output where the inodes change we
242   might need a little program to check whether several names refer to
243   the same file.
244
245 IPv6
246
247   Implement suggestions from http://www.kame.net/newsletter/19980604/
248   and ftp://ftp.iij.ad.jp/pub/RFC/rfc2553.txt
249
250   If a host has multiple addresses, then listen try to connect to all
251   in order until we get through.  (getaddrinfo may return multiple
252   addresses.)  This is kind of implemented already.
253
254   Possibly also when starting as a server we may need to listen on
255   multiple passive addresses.  This might be a bit harder, because we
256   may need to select on all of them.  Hm.
257
258   Define a syntax for IPv6 literal addresses.  Since they include
259   colons, they tend to break most naming systems, including ours.
260   Based on the HTTP IPv6 syntax, I think we should use
261  
262      rsync://[::1]/foo/bar
263      [::1]::bar
264
265   which should just take a small change to the parser code.
266
267
268 Errors
269
270   If we hang or get SIGINT, then explain where we were up to.  Perhaps
271   have a static buffer that contains the current function name, or
272   some kind of description of what we were trying to do.  This is a
273   little easier on people than needing to run strace/truss.
274
275   "The dungeon collapses!  You are killed."  Rather than "unexpected
276   eof" give a message that is more detailed if possible and also more
277   helpful.  
278
279   If we get an error writing to a socket, then we should perhaps
280   continue trying to read to see if an error message comes across
281   explaining why the socket is closed.  I'm not sure if this would
282   work, but it would certainly make our messages more helpful.
283
284   What happens if a directory is missing -x attributes.  Do we lose
285   our load?  (Debian #28416)  Probably fixed now, but a test case
286   would be good.
287
288
289 File attributes
290
291   Device major/minor numbers should be at least 32 bits each.  See
292   http://lists.samba.org/pipermail/rsync/2001-November/005357.html
293
294   Transfer ACLs.  Need to think of a standard representation.
295   Probably better not to even try to convert between NT and POSIX.
296   Possibly can share some code with Samba.
297
298 Empty directories
299
300   With the current common --include '*/' --exclude '*' pattern, people
301   can end up with many empty directories.  We might avoid this by
302   lazily creating such directories.
303
304
305 zlib
306
307   Perhaps don't use our own zlib.  
308
309   Advantages:
310    
311     - will automatically be up to date with bugfixes in zlib
312
313     - can leave it out for small rsync on e.g. recovery disks
314
315     - can use a shared library
316
317     - avoids people breaking rsync by trying to do this themselves and
318       messing up
319
320   Should we ship zlib for systems that don't have it, or require
321   people to install it separately?
322
323   Apparently this will make us incompatible with versions of rsync
324   that use the patched version of rsync.  Probably the simplest way to
325   do this is to just disable gzip (with a warning) when talking to old
326   versions.
327
328
329 logging
330
331   Perhaps flush stdout after each filename, so that people trying to
332   monitor progress in a log file can do so more easily.  See
333   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=48108
334
335   At the connections that just get a list of modules are not logged,
336   but they should be.
337
338   If a child of the rsync daemon dies with a signal, we should notice
339   that when we reap it and log a message.
340
341   Keep stderr and stdout properly separated (Debian #23626)
342
343   Use a separate function for reporting errors; prefix it with
344   "rsync:" or "rsync(remote)", or perhaps even "rsync(local
345   generator): ".
346
347
348 rsyncd over ssh
349
350   There are already some patches to do this.
351
352 proxy authentication
353
354   Allow RSYNC_PROXY to be http://user:pass@proxy.foo:3128/, and do
355   HTTP Basic Proxy-Authentication.  
356
357   Multiple schemes are possible, up to and including the insanity that
358   is NTLM, but Basic probably covers most cases.
359
360 SOCKS
361
362   Add --with-socks, and then perhaps a command-line option to put them
363   on or off.  This might be more reliable than LD_PRELOAD hacks.
364
365 Better statistics:
366
367   <Rasmus> mbp: hey, how about an rsync option that just gives you the
368   summary without the list of files?  And perhaps gives more
369   information like the number of new files, number of changed,
370   deleted, etc. ?
371   <mbp> Rasmus: nice idea
372   <mbp> there is --stats
373   <mbp> but at the moment it's very tridge-oriented
374   <mbp> rather than user-friendly
375   <mbp> it would be nice to improve it
376   <mbp> that would also work well with --dryrun
377
378 TDB:
379
380   Rather than storing the file list in memory, store it in a TDB.
381
382   This *might* make memory usage lower while building the file list.
383
384   Hashtable lookup will mean files are not transmitted in order,
385   though... hm.
386
387   This would neatly eliminate one of the major post-fork shared data
388   structures.
389
390
391 chmod:
392
393   On 12 Mar 2002, Dave Dykstra <dwd@bell-labs.com> wrote:
394   > If we would add an option to do that functionality, I would vote for one
395   > that was more general which could mask off any set of permission bits and
396   > possibly add any set of bits.  Perhaps a chmod-like syntax if it could be
397   > implemented simply.
398
399   I think that would be good too.  For example, people uploading files   
400   to a web server might like to say
401
402   rsync -avzP --chmod a+rX ./ sourcefrog.net:/home/www/sourcefrog/
403
404   Ideally the patch would implement as many of the gnu chmod semantics
405   as possible.  I think the mode parser should be a separate function
406   that passes back something like (mask,set) description to the rest of
407   the program.  For bonus points there would be a test case for the  
408   parser.
409
410   (Debian #23628)
411
412
413 --diff
414
415   Allow people to specify the diff command.  (Might want to use wdiff,
416   gnudiff, etc.)
417
418   Just diff the temporary file with the destination file, and delete
419   the tmp file rather than moving it into place.
420
421   Interaction with --partial.
422
423   Security interactions with daemon mode?
424
425   (Suggestion from david.e.sewell)
426
427
428 Incorrect timestamps (Debian #100295)
429
430   A bit hard to believe, but apparently it happens.
431
432
433 Check "refuse options works"
434
435   We need a test case for this...
436
437   Was this broken when we changed to popt?
438
439
440 String area code
441
442   Test whether this is actually faster than just using malloc().  If
443   it's not (anymore), throw it out.
444           
445
446
447 PLATFORMS ------------------------------------------------------------
448
449 Win32
450
451   Don't detach, because this messes up --srvany.
452
453   http://sources.redhat.com/ml/cygwin/2001-08/msg00234.html
454
455   According to "Effective TCP/IP Programming" (??) close() on a socket
456   has incorrect behaviour on Windows -- it sends a RST packet to the
457   other side, which gives a "connection reset by peer" error.  On that
458   platform we should probably do shutdown() instead.  However, on Unix
459   we are correct to call close(), because shutdown() discards
460   untransmitted data.
461
462 DEVELOPMENT ----------------------------------------------------------
463
464 Splint
465
466   Build rsync with SPLINT to try to find security holes.  Add
467   annotations as necessary.  Keep track of the number of warnings
468   found initially, and see how many of them are real bugs, or real
469   security bugs.  Knowing the percentage of likely hits would be
470   really interesting for other projects.
471
472 Torture test
473
474   Something that just keeps running rsync continuously over a data set
475   likely to generate problems.
476
477 Cross-testing
478
479   Run current rsync versions against significant past releases.
480
481 Memory debugger
482
483   jra recommends Valgrind:
484
485     http://devel-home.kde.org/~sewardj/
486
487 TESTING --------------------------------------------------------------
488
489 Cross-test versions
490
491   Part of the regression suite should be making sure that we don't
492   break backwards compatibility: old clients vs new servers and so
493   on.  Ideally we would test the cross product of versions.  
494
495   It might be sufficient to test downloads from well-known public
496   rsync servers running different versions of rsync.  This will give
497   some testing and also be the most common case for having different
498   versions and not being able to upgrade.
499
500 Test large files
501
502   Sparse and non-sparse
503
504 Mutator program
505
506   Insert bytes, delete bytes, swap blocks, ...
507
508 configure option to enable dangerous tests
509
510 If tests are skipped, say why.
511
512 Test daemon feature to disallow particular options.
513
514 Pipe program that makes slow/jerky connections.
515
516 Versions of read() and write() that corrupt the stream, or abruptly fail
517
518 Separate makefile target to run rough tests -- or perhaps just run
519 them every time?
520
521
522 DOCUMENTATION --------------------------------------------------------
523
524 Update README
525
526 Keep list of open issues and todos on the web site
527
528 Update web site from CVS
529
530 BUILD FARM -----------------------------------------------------------
531
532 Add machines
533
534   AMDAHL UTS (Dave Dykstra)
535
536   Cygwin (on different versions of Win32?)
537
538   HP-UX variants (via HP?)
539
540   SCO
541
542 NICE -----------------------------------------------------------------
543
544 --no-detach and --no-fork options
545
546   Very useful for debugging.  Also good when running under a
547   daemon-monitoring process that tries to restart the service when the
548   parent exits.
549
550 hang/timeout friendliness
551
552 verbose output
553   
554   Indicate whether files are new, updated, or deleted
555
556   At end of transfer, show how many files were or were not transferred
557   correctly.
558
559 internationalization
560
561   Change to using gettext().  Probably need to ship this for platforms
562   that don't have it.  
563
564   Solicit translations.
565
566   Does anyone care?
567
568 rsyncsh 
569
570    Write a small emulation of interactive ftp as a Pythonn program
571    that calls rsync.  Commands such as "cd", "ls", "ls *.c" etc map
572    fairly directly into rsync commands: it just needs to remember the
573    current host, directory and so on.  We can probably even do
574    completion of remote filenames.