"undo" utility patch (second [-t transaction-id] argument was ignored)

Joel Pettersson joelkpettersson at gmail.com
Sun Mar 22 08:14:54 PDT 2009

Hello (from a user you've never heard of or from before),

I noticed when poking around in src/usr.bin/undo/undo.c that while
something is read and stored from the second [-t transaction-id]
argument, it is not actually used subsequently. Man page says:

             A second -t specification may be given when the -d or -D option
             is used, to provide two end-points for the diff.  The file as-of
             the second -t is used instead of the current version of the file.

But this does not happen, since ts2.tid is never used after being set
in main() - ts1 is passed on to doiterate, but not ts2. Subsequently,
another ts2 comes of use in the doiterate function.

As a result, for example, using "undo -d" followed by two identical -t
arguments for a file does not result in an empty diff, but rather the
exact same diff as with one instance of the transaction id. This
simple patch fixes that.

 -  Joel K. Pettersson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin00000.bin
Type: application/octet-stream
Size: 1224 bytes
Desc: "Description: Binary data"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20090322/67a36e1b/attachment-0018.bin>

More information about the Submit mailing list