[PATCH] Fix strace -fF regression

Dmitry V. Levin ldv at altlinux.org
Wed Jul 23 21:30:10 UTC 2008


On Thu, Jul 17, 2008 at 05:25:28PM -0700, Roland McGrath wrote:
> I put this in.

This change unintentionally breaks backwards compatibility:
-fF now means the same as -ff, and my scripts no longer work.

To fix it, I suggest to handle -F option a bit differently.
If -f option is specified, then -F should be ignored, otherwise
any number of specified -F options should be treated as one -f option.

OK to commit?


-- 
ldv
-------------- next part --------------
2008-07-24  Dmitry V. Levin <ldv at altlinux.org>

	* strace.c (main): Fix -F option backwards compatibility.

--- strace/strace.c
+++ strace/strace.c
@@ -622,6 +622,7 @@ main(int argc, char *argv[])
 	extern char *optarg;
 	struct tcb *tcp;
 	int c, pid = 0;
+	int optF = 0;
 	struct sigaction sa;
 
 	static char buf[BUFSIZ];
@@ -660,7 +661,8 @@ main(int argc, char *argv[])
 			debug++;
 			break;
 		case 'F':
-			/* Obsoleted, acts as `-f'.  */
+			optF = 1;
+			break;
 		case 'f':
 			followfork++;
 			break;
@@ -757,6 +759,9 @@ main(int argc, char *argv[])
 	if ((optind == argc) == !pflag_seen)
 		usage(stderr, 1);
 
+	if (!followfork)
+		followfork = optF;
+
 	if (followfork > 1 && cflag) {
 		fprintf(stderr,
 			"%s: -c and -ff are mutually exclusive options\n",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20080724/960eba27/attachment.bin>


More information about the Strace-devel mailing list