kern/177214: [patch] Issue with r241826 - Covert to python 3

hiren panchasara hiren.panchasara at
Fri Mar 22 00:00:02 UTC 2013

>Number:         177214
>Category:       kern
>Synopsis:       [patch] Issue with r241826 - Covert to python 3
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 22 00:00:02 UTC 2013
>Originator:     hiren panchasara
>Release:        current
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
r241826 removed raw_input() as its not available in python3.

But with python 2.7.3, this change is causing an interesting failure where its not picking newline char. My python foo is not good but I _think_ the patch attached will handle this case.

Please modify the patch if/as needed.

You should be able to run through all the counters by just pressing return but with raw_input() taken away, thats not happening. It fails right after first counter.

/usr/src/tools/test/hwpmc # ./ -p ls
#         p/CLOCK.HARD 

Traceback (most recent call last):
  File "./", line 98, in <module>
  File "./", line 90, in main
    value = input("next?")
  File "<string>", line 0
SyntaxError: unexpected EOF while parsing
root at testhaswell:/usr/src/tools/test/hwpmc # 

Index: tools/test/hwpmc/
--- tools/test/hwpmc/ (revision 248555)
+++ tools/test/hwpmc/ (working copy)
@@ -51,6 +51,9 @@
 import subprocess
 from subprocess import PIPE

+# Use input() for Python version 3 
+if sys.version_info[0] == 3:
+    raw_input = input
 # A list of strings that are not really counters, just
 # name tags that are output by pmccontrol -L
 notcounter = ["IAF", "IAP", "TSC", "UNC", "UCF", "UCP", "SOFT" ]
@@ -87,7 +90,7 @@
         if (options.wait == True):
-                value = input("next?")
+                value = raw_input("next?")
             except EOFError:


More information about the freebsd-bugs mailing list