Skip to contentSkip to conversation

Question Print Formatting iproute2

PATCH Applied Briana Oursler 4 participants 11 messages Jul 27, 2020 – Jul 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I have a patch I've written to address a format specifier change that breaks some tests in tc-testing, but I wanted to ask about the change and for some guidance with respect to how formatters are approached in iproute2.

On a recent run of tdc tests I ran ./tdc.py -c qdisc and found:

1..91
not ok 1 8b6e - Create RED with no flags
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kb

not ok 2 342e - Create RED with adaptive flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbadaptive

not ok 3 2d4b - Create RED with ECN flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn

not ok 4 650f - Create RED with flags ECN, adaptive
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn adaptive

not ok 5 5f15 - Create RED with flags ECN, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop

not ok 6 53e8 - Create RED with flags ECN, nodrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn nodrop

ok 7 d091 - Fail to create RED with only nodrop flag
not ok 8 af8e - Create RED with flags ECN, nodrop, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop nodrop

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

- print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+ print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the patch under the scissors line.

I wanted to ask the ML if adding the space after the specifier is preferred usage. The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);

so I wanted to check with everyone.

Thanks

Quoted 1 line

8------------------------------------------------------------------------8<

From 1e7bee22a799a320bd230ad959d459b386bec26d Mon Sep 17 00:00:00 2001
Subject: [RFC iproute2-next] tc: Add space after format specifier

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/q_red.c +1 -1
index dfef1bf8..7106645a 100644
@@ -222,7 +222,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 

base-commit: 1ca65af1c5e131861a3989cca3c7ca8b067e0833

Signature · 1 line
2.27.0
#1 lore raw
Quoted 12 lines · Briana Oursler

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

(quoted diff) +1 -1
-       print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+       print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the patch under the scissors line.

Quoted 6 lines

I wanted to ask the ML if adding the space after the specifier is preferred usage. The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);

so I wanted to check with everyone.

Yeah, I outsmarted myself with those space changes. Those two chunks need reversing, and qevents need to have the space changed. This should work:

modified tc/q_red.c
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2)); print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
- print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+ print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));

tc_red_print_flags(qopt->flags);

if (show_details) {
- print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
if (max_P)
print_float(PRINT_ANY, "probability",
"probability %lg ", max_P / pow(2, 32));
modified tc/tc_qevent.c
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents, FILE *f)
}

open_json_object(NULL);
- print_string(PRINT_ANY, "kind", " qevent %s", qevents->id);
+ print_string(PRINT_ANY, "kind", "qevent %s", qevents->id);
qevents->print_qevent(qevents, f);
+ print_string(PRINT_FP, NULL, "%s", " ");
close_json_object();
}
}

Are you going to take care of this, or should I?

#2 lore raw
Quoted 54 lines · On Mon, 27 Jul 2020 21:31:36 +0200 Petr Machata <[email protected]> wrote:
Quoted 12 lines · Briana Oursler

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

(quoted diff) +1 -1
-       print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+       print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the patch under the scissors line.

Quoted 6 lines

I wanted to ask the ML if adding the space after the specifier is preferred usage. The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);

so I wanted to check with everyone.

Yeah, I outsmarted myself with those space changes. Those two chunks need reversing, and qevents need to have the space changed. This should work:

modified tc/q_red.c

tc/q_red.c +2 -2
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 
 	if (show_details) {
-		print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+		print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
 		if (max_P)
 			print_float(PRINT_ANY, "probability",
 				    "probability %lg ", max_P / pow(2, 32));

modified tc/tc_qevent.c

(quoted diff) +2 -1
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents, FILE *f)
 			}
 
 			open_json_object(NULL);
-			print_string(PRINT_ANY, "kind", " qevent %s", qevents->id);
+			print_string(PRINT_ANY, "kind", "qevent %s", qevents->id);
 			qevents->print_qevent(qevents, f);
+			print_string(PRINT_FP, NULL, "%s", " ");
 			close_json_object();
 		}
 	}
Quoted 1 line

Are you going to take care of this, or should I?

Missing spaces makes it impossible to read adding extra spaces is annoying, From a long term perspective it is better if anything that is trying to parse output pro grammatically should use JSON output format. With JSON it is easier to handle new data and not as dependent on ordering. Plus if some tests used JSON, maybe the issues would be found sooner.

#4 lore raw
In reply to Briana Oursler
Quoted 87 lines · On Sun, 26 Jul 2020 21:46:16 -0700 Briana Oursler <[email protected]>…

I have a patch I've written to address a format specifier change that breaks some tests in tc-testing, but I wanted to ask about the change and for some guidance with respect to how formatters are approached in iproute2.

On a recent run of tdc tests I ran ./tdc.py -c qdisc and found:

1..91
not ok 1 8b6e - Create RED with no flags
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kb

not ok 2 342e - Create RED with adaptive flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbadaptive

not ok 3 2d4b - Create RED with ECN flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn

not ok 4 650f - Create RED with flags ECN, adaptive
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn adaptive

not ok 5 5f15 - Create RED with flags ECN, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop

not ok 6 53e8 - Create RED with flags ECN, nodrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn nodrop

ok 7 d091 - Fail to create RED with only nodrop flag
not ok 8 af8e - Create RED with flags ECN, nodrop, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop nodrop

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

(quoted diff) +1 -1
-       print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
+       print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the patch under the scissors line.

I wanted to ask the ML if adding the space after the specifier is preferred usage. The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);

so I wanted to check with everyone.

Thanks

Quoted 1 line

8------------------------------------------------------------------------8<

From 1e7bee22a799a320bd230ad959d459b386bec26d Mon Sep 17 00:00:00 2001
Subject: [RFC iproute2-next] tc: Add space after format specifier

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/q_red.c +1 -1
index dfef1bf8..7106645a 100644
@@ -222,7 +222,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 
Quoted 1 line

base-commit: 1ca65af1c5e131861a3989cca3c7ca8b067e0833

Looks fine, please resend a normal patch targeted at current iproute2 not next.

#3 lore raw
In reply to Petr Machata
Quoted 23 lines · Petr Machata
Quoted 21 lines · Briana Oursler

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

- print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt-

Quoted 1 line

qth_max, b3));

+ print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt-

Quoted 1 line

qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the
patch under the scissors line.

I wanted to ask the ML if adding the space after the specifier is preferred usage.
The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt-

Quoted 1 line

Wlog);

+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt-

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Wlog);

so I wanted to check with everyone.

Yeah, I outsmarted myself with those space changes. Those two chunks need reversing, and qevents need to have the space changed. This should
work:

Thank you for the response. I see what you are saying. I had not seen the qevents, I'll put all 3 in.

Quoted 37 lines

modified tc/q_red.c

(quoted diff) +2 -2
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu,
 FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt-
 >qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt-
 >qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt-
 >qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 
 	if (show_details) {
-		print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+		print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
 		if (max_P)
 			print_float(PRINT_ANY, "probability",
 				    "probability %lg ", max_P / pow(2,

32));
modified tc/tc_qevent.c

(quoted diff) +2 -1
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents,
 FILE *f)
 			}
 
 			open_json_object(NULL);
-			print_string(PRINT_ANY, "kind", " qevent %s",
 qevents->id);
+			print_string(PRINT_ANY, "kind", "qevent %s",
 qevents->id);
 			qevents->print_qevent(qevents, f);
+			print_string(PRINT_FP, NULL, "%s", " ");
(quoted diff) +0 -0
 			close_json_object();
 		}
 	}
Quoted 1 line

Are you going to take care of this, or should I?

I will, I'll amend the commit I included so it will have the other changes you suggest and send as a regular patch.

#5 lore raw
In reply to Stephen Hemminger
Quoted 105 lines · Stephen Hemminger
Quoted 102 lines · On Sun, 26 Jul 2020 21:46:16 -0700 Briana Oursler <[email protected]>…

I have a patch I've written to address a format specifier change that
breaks some tests in tc-testing, but I wanted to ask about the change
and for some guidance with respect to how formatters are approached in
iproute2.

On a recent run of tdc tests I ran ./tdc.py -c qdisc and found:

1..91
not ok 1 8b6e - Create RED with no flags
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kb

not ok 2 342e - Create RED with adaptive flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbadaptive

not ok 3 2d4b - Create RED with ECN flag
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn

not ok 4 650f - Create RED with flags ECN, adaptive
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn adaptive

not ok 5 5f15 - Create RED with flags ECN, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop

not ok 6 53e8 - Create RED with flags ECN, nodrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn nodrop

ok 7 d091 - Fail to create RED with only nodrop flag not ok 8 af8e - Create RED with flags ECN, nodrop, harddrop
Could not match regex pattern. Verify command output:
qdisc red 1: root refcnt 2 limit 1Mb min 100Kb max 300Kbecn harddrop
nodrop

I git bisected and found d0e450438571("tc: q_red: Add support for qevents "mark" and "early_drop"), the commit that introduced the formatting change causing the break.

- print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt-

Quoted 1 line

qth_max, b3));

+ print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt-

Quoted 1 line

qth_max, b3));

I made a patch that adds a space after the format specifier in the iproute2 tc/q_red.c and tested it using: tdc.py -c qdisc. After the change, all the broken tdc qdisc red tests return ok. I'm including the
patch under the scissors line.

I wanted to ask the ML if adding the space after the specifier is preferred usage.
The commit also had:
- print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt-

Quoted 1 line

Wlog);

+ print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt-

Quoted 1 line

Wlog);

so I wanted to check with everyone.

Thanks

Quoted 2 lines

8-------------------------------------------------------------- ----------8<

From 1e7bee22a799a320bd230ad959d459b386bec26d Mon Sep 17 00:00:00 2001
Subject: [RFC iproute2-next] tc: Add space after format specifier

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/q_red.c +1 -1
index dfef1bf8..7106645a 100644
@@ -222,7 +222,7 @@ static int red_print_opt(struct qdisc_util *qu,
 FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt-
 >qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt-
 >qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt-
Quoted 1 line

qth_max, b3));

Quoted 8 lines
Quoted 4 lines

tc_red_print_flags(qopt->flags);

base-commit: 1ca65af1c5e131861a3989cca3c7ca8b067e0833

Looks fine, please resend a normal patch targeted at current iproute2 not next.

Will do, thank you.

#6 lore raw

PATCH 1/1 tc: Add space after format specifier

In reply to Stephen Hemminger

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite. Per suggestion from Petr Machata, remove a space and change spacing in tc/q_event.c to complete the fix.

Tested fix in tdc using:
./tdc.py -c qdisc

All qdisc RED tests return ok.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c     | 4 ++--
 tc/tc_qevent.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
tc/q_red.c +2 -2
index dfef1bf8..df788f8f 100644
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt->qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt->qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt->qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 
 	if (show_details) {
-		print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+		print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
 		if (max_P)
 			print_float(PRINT_ANY, "probability",
 				    "probability %lg ", max_P / pow(2, 32));
tc/tc_qevent.c +2 -1
index 2c010fcf..34568070 100644
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents, FILE *f)
 			}
 
 			open_json_object(NULL);
-			print_string(PRINT_ANY, "kind", " qevent %s", qevents->id);
+			print_string(PRINT_ANY, "kind", "qevent %s", qevents->id);
 			qevents->print_qevent(qevents, f);
+			print_string(PRINT_FP, NULL, "%s", " ");
 			close_json_object();
 		}
 	}
Signature · 1 line
2.27.0
#7 lore raw

Re: [PATCH iproute2] tc: Add space after format specifier

Quoted 59 lines · Briana Oursler

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite. Per suggestion from Petr Machata,
remove a space and change spacing in tc/q_event.c to complete the fix.

Tested fix in tdc using:
./tdc.py -c qdisc

All qdisc RED tests return ok.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c     | 4 ++--
 tc/tc_qevent.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)
tc/q_red.c +2 -2
index dfef1bf8..df788f8f 100644
@@ -222,12 +222,12 @@ static int red_print_opt(struct qdisc_util *qu,
 FILE *f, struct rtattr *opt)
 	print_uint(PRINT_JSON, "min", NULL, qopt->qth_min);
 	print_string(PRINT_FP, NULL, "min %s ", sprint_size(qopt-
 >qth_min, b2));
 	print_uint(PRINT_JSON, "max", NULL, qopt->qth_max);
-	print_string(PRINT_FP, NULL, "max %s", sprint_size(qopt-
 >qth_max, b3));
+	print_string(PRINT_FP, NULL, "max %s ", sprint_size(qopt-
 >qth_max, b3));
 
 	tc_red_print_flags(qopt->flags);
 
 	if (show_details) {
-		print_uint(PRINT_ANY, "ewma", " ewma %u ", qopt->Wlog);
+		print_uint(PRINT_ANY, "ewma", "ewma %u ", qopt->Wlog);
 		if (max_P)
 			print_float(PRINT_ANY, "probability",
 				    "probability %lg ", max_P / pow(2,

32));

tc/tc_qevent.c +2 -1
index 2c010fcf..34568070 100644
@@ -82,8 +82,9 @@ void qevents_print(struct qevent_util *qevents,
 FILE *f)
 			}
 
 			open_json_object(NULL);
-			print_string(PRINT_ANY, "kind", " qevent %s",
 qevents->id);
+			print_string(PRINT_ANY, "kind", "qevent %s",
 qevents->id);
 			qevents->print_qevent(qevents, f);
+			print_string(PRINT_FP, NULL, "%s", " ");

tc/tc_qevent.c void qevents_print(struct qevent_util *qevents, FILE *f) · line 90

Quoted 3 lines
tc/tc_qevent.c +0 -0
 			close_json_object();
 		}
 	}

I made the subject PATCH iproute2 after the question discussion with everyone, but I realized that the patch it fixes is in iproute2-next but not yet in iproute2. Sorry about the confusion. Should I resend to iproute2-next?

Tested-by on v1 1/1
#9 lore raw

Re: [PATCH iproute2] tc: Add space after format specifier

In reply to Briana Oursler
Quoted 7 lines · Briana Oursler

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite. Per suggestion from Petr Machata, remove a space and change spacing in tc/q_event.c to complete the fix.

Tested fix in tdc using:
./tdc.py -c qdisc

Quoted 6 lines

All qdisc RED tests return ok.

Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

Thanks for taking care of this!

#8 lore raw

Re: [PATCH iproute2] tc: Add space after format specifier

In reply to Briana Oursler
Quoted 4 lines · Briana Oursler

I made the subject PATCH iproute2 after the question discussion with everyone, but I realized that the patch it fixes is in iproute2-next but not yet in iproute2. Sorry about the confusion. Should I resend to iproute2-next?

no, it is fine.

Applied
#10 lore raw

Re: [PATCH iproute2] tc: Add space after format specifier

In reply to Briana Oursler
Quoted 9 lines · Briana Oursler

Add space after format specifier in print_string call. Fixes broken qdisc tests within tdc testing suite. Per suggestion from Petr Machata, remove a space and change spacing in tc/q_event.c to complete the fix.

Tested fix in tdc using:
./tdc.py -c qdisc

All qdisc RED tests return ok.

Quoted 9 lines
Fixes d0e450438571("tc: q_red: Add support for

qevents "mark" and "early_drop")

---
 tc/q_red.c     | 4 ++--
 tc/tc_qevent.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Applied to iproute2-next after fixing the 'Fixes' line. It should be a single line before the Signed-off-by