From nobody@FreeBSD.org  Thu Mar 21 23:51:23 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 31DE3E18
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Mar 2013 23:51:23 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 24182220
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Mar 2013 23:51:23 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r2LNpMbp061079
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 21 Mar 2013 23:51:22 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r2LNpMrT061072;
	Thu, 21 Mar 2013 23:51:22 GMT
	(envelope-from nobody)
Message-Id: <201303212351.r2LNpMrT061072@red.freebsd.org>
Date: Thu, 21 Mar 2013 23:51:22 GMT
From: hiren panchasara <hiren.panchasara@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Issue with r241826 - Covert to python 3
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         177214
>Category:       kern
>Synopsis:       [patch] Issue with r241826 - Covert to python 3
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    hiren
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 22 00:00:02 UTC 2013
>Closed-Date:    Mon May 13 20:01:11 UTC 2013
>Last-Modified:  Mon May 13 20:01:11 UTC 2013
>Originator:     hiren panchasara
>Release:        current
>Organization:
>Environment:
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
>Description:
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.

cheers,
Hiren
>How-To-Repeat:
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 # ./pmctest.py -p ls
#         p/CLOCK.HARD 
                     2 
pmctest.py

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

>Fix:
Index: tools/test/hwpmc/pmctest.py
===================================================================
--- tools/test/hwpmc/pmctest.py (revision 248555)
+++ tools/test/hwpmc/pmctest.py (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 @@
         print(result)
         if (options.wait == True):
             try:
-                value = input("next?")
+                value = raw_input("next?")
             except EOFError:
                 sys.exit()


>Release-Note:
>Audit-Trail:

From: hiren panchasara <hiren.panchasara@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Cc: Eitan Adler <eadler@freebsd.org>
Subject: Re: kern/177214: [patch] Issue with r241826 - Covert to python 3
Date: Thu, 21 Mar 2013 17:05:28 -0700

 +eadler as he is wrote r241826
 
 On Thu, Mar 21, 2013 at 5:00 PM,  <FreeBSD-gnats-submit@freebsd.org> wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `kern/177214'.
 > The individual assigned to look at your
 > report is: freebsd-bugs.
 >
 > You can access the state of your problem report at any time
 > via this link:
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=177214
 >
 >>Category:       kern
 >>Responsible:    freebsd-bugs
 >>Synopsis:       [patch] Issue with r241826 - Covert to python 3
 >>Arrival-Date:   Fri Mar 22 00:00:02 UTC 2013
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Fri Mar 22 00:25:00 UTC 2013 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=177214 
Responsible-Changed-From-To: eadler->hiren 
Responsible-Changed-By: hiren 
Responsible-Changed-When: Mon May 13 18:13:31 UTC 2013 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=177214 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/177214: commit references a PR
Date: Mon, 13 May 2013 19:53:28 +0000 (UTC)

 Author: hiren
 Date: Mon May 13 19:53:19 2013
 New Revision: 250612
 URL: http://svnweb.freebsd.org/changeset/base/250612
 
 Log:
   As python3 does not have raw_input(), convert it to input() when we
   are using python3.
   
   PR:	177214
   Reviewed by:	gnn
   Approved by:	sbruno (mentor)
 
 Modified:
   head/tools/test/hwpmc/pmctest.py
 
 Modified: head/tools/test/hwpmc/pmctest.py
 ==============================================================================
 --- head/tools/test/hwpmc/pmctest.py	Mon May 13 19:52:35 2013	(r250611)
 +++ head/tools/test/hwpmc/pmctest.py	Mon May 13 19:53:19 2013	(r250612)
 @@ -51,6 +51,10 @@ import sys
  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 +91,7 @@ def main():
          print(result)
          if (options.wait == True):
              try:
 -                value = input("next?")
 +                value = raw_input("next?")
              except EOFError:
                  sys.exit()
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: hiren 
State-Changed-When: Mon May 13 20:00:30 UTC 2013 
State-Changed-Why:  
Fixed in r250612 

http://www.freebsd.org/cgi/query-pr.cgi?pr=177214 
>Unformatted:
