[PATCH] scriptreplay: new implementation is out-of-sync

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reproduction steps:

1. Run "script -t 2>timing".
2. When the prompt comes up, hit return.
3. New prompt. Wait several seconds, then type "true" and hit return.
4. Repeat (3) as desired, then exit scripted shell.
5. Run "scriptreplay timing".

You'll find on the replay that, rather than waiting several seconds
between the prompt and true, the wait will actually occur after the
first "t" of true.

Reported-by: Micah Cowan <micah@xxxxxxxxxx>
Signed-off-by: Karel Zak <kzak@xxxxxxxxxx>
---
 misc-utils/scriptreplay.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/misc-utils/scriptreplay.c b/misc-utils/scriptreplay.c
index 6c351a3..8a254de 100644
--- a/misc-utils/scriptreplay.c
+++ b/misc-utils/scriptreplay.c
@@ -121,6 +121,7 @@ main(int argc, char *argv[])
 	double divi;
 	int c;
 	unsigned long line;
+	size_t oldblk = 0;
 
 	/* Because we use space as a separator, we can't afford to use any
 	 * locale which tolerates a space in a number.  In any case, script.c
@@ -170,7 +171,9 @@ main(int argc, char *argv[])
 		if (delay > SCRIPT_MIN_DELAY)
 			delay_for(delay);
 
-		emit(sfile, sname, blk);
+		if (oldblk)
+			emit(sfile, sname, oldblk);
+		oldblk = blk;
 	}
 
 	fclose(sfile);
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux