All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
@ 2018-04-26  6:45 Xiao Yang
  2018-04-26  6:45 ` [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure Xiao Yang
  2018-04-26  7:03 ` [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
  0 siblings, 2 replies; 13+ messages in thread
From: Xiao Yang @ 2018-04-26  6:45 UTC (permalink / raw)
  To: ltp

If we install python3 in specific path(/usr/local/bin) rather than the
default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
interpreter python code due to wrong path.  We should use env to
search the correct path of python3 dynamically.

Test it by running datafiles/in.py:
-----------------------------------
/usr/local/bin/python3
-bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
-----------------------------------

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 execltp.in                                                | 2 +-
 testcases/commands/file/datafiles/in.py                   | 2 +-
 testcases/kernel/power_management/lib/pm_sched_mc.py      | 2 +-
 testcases/kernel/power_management/pm_cpu_consolidation.py | 2 +-
 testcases/kernel/power_management/pm_ilb_test.py          | 2 +-
 testcases/kernel/power_management/pm_sched_domain.py      | 2 +-
 testcases/network/nfsv4/acl/cleangroups.py                | 2 +-
 testcases/network/nfsv4/acl/cleanusers.py                 | 2 +-
 testcases/network/nfsv4/acl/create_users.py               | 2 +-
 testcases/network/nfsv4/acl/random_gen.py                 | 2 +-
 testcases/network/nfsv4/acl/setacl_stress.py              | 2 +-
 testcases/network/nfsv4/acl/test_acl.py                   | 2 +-
 testcases/network/nfsv4/acl/test_long_acl.py              | 2 +-
 testcases/network/nfsv4/locks/locktests.py                | 2 +-
 testcases/realtime/func/pi-tests/parse-testpi1.py         | 2 +-
 testcases/realtime/func/pi-tests/parse-testpi2.py         | 2 +-
 testcases/realtime/scripts/parser.py                      | 2 +-
 testcases/realtime/tools/ftqviz.py                        | 2 +-
 testscripts/build/ltp-missing-install-files.py            | 2 +-
 tools/pounder21/src/time_tests/drift-test.py              | 2 +-
 20 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/execltp.in b/execltp.in
index 57e9c45..4b647cd 100755
--- a/execltp.in
+++ b/execltp.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 """
     An LTP [execution and] parsing wrapper.
 
diff --git a/testcases/commands/file/datafiles/in.py b/testcases/commands/file/datafiles/in.py
index 802e7bf..5fd48ce 100755
--- a/testcases/commands/file/datafiles/in.py
+++ b/testcases/commands/file/datafiles/in.py
@@ -1,3 +1,3 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 print("This is a test.")
diff --git a/testcases/kernel/power_management/lib/pm_sched_mc.py b/testcases/kernel/power_management/lib/pm_sched_mc.py
index 3574330..743b6de 100755
--- a/testcases/kernel/power_management/lib/pm_sched_mc.py
+++ b/testcases/kernel/power_management/lib/pm_sched_mc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ''' Reusable functions related to sched mc FVT are put together
 '''
 
diff --git a/testcases/kernel/power_management/pm_cpu_consolidation.py b/testcases/kernel/power_management/pm_cpu_consolidation.py
index ecd2e4f..a01db00 100755
--- a/testcases/kernel/power_management/pm_cpu_consolidation.py
+++ b/testcases/kernel/power_management/pm_cpu_consolidation.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ''' This Python script interprets various sched stats values.
     Validates cpu consolidation for given sched_mc_power_saving value
 '''
diff --git a/testcases/kernel/power_management/pm_ilb_test.py b/testcases/kernel/power_management/pm_ilb_test.py
index 920c4e3..f207170 100755
--- a/testcases/kernel/power_management/pm_ilb_test.py
+++ b/testcases/kernel/power_management/pm_ilb_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ''' This Python script interprets interrupt values.
     Validates Ideal load balancer runs in same package where workload is running
 '''
diff --git a/testcases/kernel/power_management/pm_sched_domain.py b/testcases/kernel/power_management/pm_sched_domain.py
index d5cd327..dddc481 100755
--- a/testcases/kernel/power_management/pm_sched_domain.py
+++ b/testcases/kernel/power_management/pm_sched_domain.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 ''' This Python script validates sched domain information in dmesg
     with information in sysfs topology
 '''
diff --git a/testcases/network/nfsv4/acl/cleangroups.py b/testcases/network/nfsv4/acl/cleangroups.py
index 11f8045..3c06478 100755
--- a/testcases/network/nfsv4/acl/cleangroups.py
+++ b/testcases/network/nfsv4/acl/cleangroups.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 from random_gen import *
 from optparse import OptionParser
 import subprocess
diff --git a/testcases/network/nfsv4/acl/cleanusers.py b/testcases/network/nfsv4/acl/cleanusers.py
index f2597d2..3e652c5 100755
--- a/testcases/network/nfsv4/acl/cleanusers.py
+++ b/testcases/network/nfsv4/acl/cleanusers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 from random_gen import *
 from optparse import OptionParser
 import subprocess
diff --git a/testcases/network/nfsv4/acl/create_users.py b/testcases/network/nfsv4/acl/create_users.py
index 0dcaecb..3203aff 100755
--- a/testcases/network/nfsv4/acl/create_users.py
+++ b/testcases/network/nfsv4/acl/create_users.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 '''
 	Access Control Lists testing based on newpynfs framework
 	Aurelien Charbon - Bull SA
diff --git a/testcases/network/nfsv4/acl/random_gen.py b/testcases/network/nfsv4/acl/random_gen.py
index 37cb179..4b6ba96 100755
--- a/testcases/network/nfsv4/acl/random_gen.py
+++ b/testcases/network/nfsv4/acl/random_gen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 import subprocess
 import random
 import re
diff --git a/testcases/network/nfsv4/acl/setacl_stress.py b/testcases/network/nfsv4/acl/setacl_stress.py
index 68a4932..c93ac8b 100755
--- a/testcases/network/nfsv4/acl/setacl_stress.py
+++ b/testcases/network/nfsv4/acl/setacl_stress.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 '''
 	Access Control Lists stressing script
 	To lauch on the first client
diff --git a/testcases/network/nfsv4/acl/test_acl.py b/testcases/network/nfsv4/acl/test_acl.py
index 612b9e4..8699b02 100755
--- a/testcases/network/nfsv4/acl/test_acl.py
+++ b/testcases/network/nfsv4/acl/test_acl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 '''
 	Access Control Lists testing based on newpynfs framework
 	Aurelien Charbon - Bull SA
diff --git a/testcases/network/nfsv4/acl/test_long_acl.py b/testcases/network/nfsv4/acl/test_long_acl.py
index 79e3a96..893855b 100755
--- a/testcases/network/nfsv4/acl/test_long_acl.py
+++ b/testcases/network/nfsv4/acl/test_long_acl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 '''
 	Access Control Lists testing based on newpynfs framework
 	Aurelien Charbon - Bull SA
diff --git a/testcases/network/nfsv4/locks/locktests.py b/testcases/network/nfsv4/locks/locktests.py
index 80d8c20..9876a86 100755
--- a/testcases/network/nfsv4/locks/locktests.py
+++ b/testcases/network/nfsv4/locks/locktests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # This script aims to help to run locktests with several clients.
 #
 # Report bugs to Vincent ROQUETA : vincent.roqueta@ext.bull.net
diff --git a/testcases/realtime/func/pi-tests/parse-testpi1.py b/testcases/realtime/func/pi-tests/parse-testpi1.py
index 0631cce..740e7d1 100644
--- a/testcases/realtime/func/pi-tests/parse-testpi1.py
+++ b/testcases/realtime/func/pi-tests/parse-testpi1.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 ################################################################################
diff --git a/testcases/realtime/func/pi-tests/parse-testpi2.py b/testcases/realtime/func/pi-tests/parse-testpi2.py
index f11ff8a..69b2748 100644
--- a/testcases/realtime/func/pi-tests/parse-testpi2.py
+++ b/testcases/realtime/func/pi-tests/parse-testpi2.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 ################################################################################
diff --git a/testcases/realtime/scripts/parser.py b/testcases/realtime/scripts/parser.py
index bc4512f..85226de 100644
--- a/testcases/realtime/scripts/parser.py
+++ b/testcases/realtime/scripts/parser.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
 ################################################################################
diff --git a/testcases/realtime/tools/ftqviz.py b/testcases/realtime/tools/ftqviz.py
index f331d33..5ac094c 100644
--- a/testcases/realtime/tools/ftqviz.py
+++ b/testcases/realtime/tools/ftqviz.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 #      Filename: ftqviz.py
 #        Author: Darren Hart <dvhltc@us.ibm.com>
diff --git a/testscripts/build/ltp-missing-install-files.py b/testscripts/build/ltp-missing-install-files.py
index 232028b..0f9d81c 100755
--- a/testscripts/build/ltp-missing-install-files.py
+++ b/testscripts/build/ltp-missing-install-files.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 #
 #    Script for determining items missing from LTP install based on the output
 #    log provided by runltp[lite.sh].
diff --git a/tools/pounder21/src/time_tests/drift-test.py b/tools/pounder21/src/time_tests/drift-test.py
index 0c25756..3fe8ba5 100755
--- a/tools/pounder21/src/time_tests/drift-test.py
+++ b/tools/pounder21/src/time_tests/drift-test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 
 # Time Drift Script
 #		Periodically checks and displays time drift
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure
  2018-04-26  6:45 [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
@ 2018-04-26  6:45 ` Xiao Yang
  2018-04-26 12:15   ` Petr Vorel
  2018-04-26  7:03 ` [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
  1 sibling, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2018-04-26  6:45 UTC (permalink / raw)
  To: ltp

On some distros(e.g. RHEL6.9GA), we got the mismatched
output by running 'file in.py':
----------------------------------------------
in.py: a /usr/bin/env python3 script text executable
----------------------------------------------

We just match both python and python3 to fix this issue.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/commands/file/file01.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/commands/file/file01.sh b/testcases/commands/file/file01.sh
index e04b32e..5a81b3b 100755
--- a/testcases/commands/file/file01.sh
+++ b/testcases/commands/file/file01.sh
@@ -84,8 +84,8 @@ do_test()
 	 7) file_test in.pl "[pP]erl script, ASCII text executable" \
 			    "[pP]erl script text executable" \
 			    "a /usr/bin/perl script text";;
-	 8) file_test in.py "[pP]ython script, ASCII text executable" \
-			    "[pP]ython script text executable";;
+	 8) file_test in.py "[pP]ython3\{0,1\} script, ASCII text executable" \
+			    "[pP]ython3\{0,1\} script text executable";;
 	 9) file_test in.m4 "M4 macro processor script, ASCII text" \
 			    "ASCII M4 macro language pre-processor text";;
 	10) file_test in "ELF .*-bit $TEST_ARCH executable, .*" \
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  6:45 [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
  2018-04-26  6:45 ` [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure Xiao Yang
@ 2018-04-26  7:03 ` Xiao Yang
  2018-04-26  8:06   ` Petr Vorel
  1 sibling, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2018-04-26  7:03 UTC (permalink / raw)
  To: ltp

On 2018/04/26 14:45, Xiao Yang wrote:
> If we install python3 in specific path(/usr/local/bin) rather than the
> default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
> interpreter python code due to wrong path.  We should use env to
> search the correct path of python3 dynamically.
>
> Test it by running datafiles/in.py:
> -----------------------------------
> /usr/local/bin/python3
> -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
> -----------------------------------
Hi,

Sorry, the above output is not complete, please see the following output:
----------------------------------------------------------------------------
# which python3
/usr/local/bin/python3
# ./in.py
-bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
----------------------------------------------------------------------------

Thanks,
Xiao Yang

> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  execltp.in                                                | 2 +-
>  testcases/commands/file/datafiles/in.py                   | 2 +-
>  testcases/kernel/power_management/lib/pm_sched_mc.py      | 2 +-
>  testcases/kernel/power_management/pm_cpu_consolidation.py | 2 +-
>  testcases/kernel/power_management/pm_ilb_test.py          | 2 +-
>  testcases/kernel/power_management/pm_sched_domain.py      | 2 +-
>  testcases/network/nfsv4/acl/cleangroups.py                | 2 +-
>  testcases/network/nfsv4/acl/cleanusers.py                 | 2 +-
>  testcases/network/nfsv4/acl/create_users.py               | 2 +-
>  testcases/network/nfsv4/acl/random_gen.py                 | 2 +-
>  testcases/network/nfsv4/acl/setacl_stress.py              | 2 +-
>  testcases/network/nfsv4/acl/test_acl.py                   | 2 +-
>  testcases/network/nfsv4/acl/test_long_acl.py              | 2 +-
>  testcases/network/nfsv4/locks/locktests.py                | 2 +-
>  testcases/realtime/func/pi-tests/parse-testpi1.py         | 2 +-
>  testcases/realtime/func/pi-tests/parse-testpi2.py         | 2 +-
>  testcases/realtime/scripts/parser.py                      | 2 +-
>  testcases/realtime/tools/ftqviz.py                        | 2 +-
>  testscripts/build/ltp-missing-install-files.py            | 2 +-
>  tools/pounder21/src/time_tests/drift-test.py              | 2 +-
>  20 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/execltp.in b/execltp.in
> index 57e9c45..4b647cd 100755
> --- a/execltp.in
> +++ b/execltp.in
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  """
>      An LTP [execution and] parsing wrapper.
>  
> diff --git a/testcases/commands/file/datafiles/in.py b/testcases/commands/file/datafiles/in.py
> index 802e7bf..5fd48ce 100755
> --- a/testcases/commands/file/datafiles/in.py
> +++ b/testcases/commands/file/datafiles/in.py
> @@ -1,3 +1,3 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  
>  print("This is a test.")
> diff --git a/testcases/kernel/power_management/lib/pm_sched_mc.py b/testcases/kernel/power_management/lib/pm_sched_mc.py
> index 3574330..743b6de 100755
> --- a/testcases/kernel/power_management/lib/pm_sched_mc.py
> +++ b/testcases/kernel/power_management/lib/pm_sched_mc.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  ''' Reusable functions related to sched mc FVT are put together
>  '''
>  
> diff --git a/testcases/kernel/power_management/pm_cpu_consolidation.py b/testcases/kernel/power_management/pm_cpu_consolidation.py
> index ecd2e4f..a01db00 100755
> --- a/testcases/kernel/power_management/pm_cpu_consolidation.py
> +++ b/testcases/kernel/power_management/pm_cpu_consolidation.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  ''' This Python script interprets various sched stats values.
>      Validates cpu consolidation for given sched_mc_power_saving value
>  '''
> diff --git a/testcases/kernel/power_management/pm_ilb_test.py b/testcases/kernel/power_management/pm_ilb_test.py
> index 920c4e3..f207170 100755
> --- a/testcases/kernel/power_management/pm_ilb_test.py
> +++ b/testcases/kernel/power_management/pm_ilb_test.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  ''' This Python script interprets interrupt values.
>      Validates Ideal load balancer runs in same package where workload is running
>  '''
> diff --git a/testcases/kernel/power_management/pm_sched_domain.py b/testcases/kernel/power_management/pm_sched_domain.py
> index d5cd327..dddc481 100755
> --- a/testcases/kernel/power_management/pm_sched_domain.py
> +++ b/testcases/kernel/power_management/pm_sched_domain.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  ''' This Python script validates sched domain information in dmesg
>      with information in sysfs topology
>  '''
> diff --git a/testcases/network/nfsv4/acl/cleangroups.py b/testcases/network/nfsv4/acl/cleangroups.py
> index 11f8045..3c06478 100755
> --- a/testcases/network/nfsv4/acl/cleangroups.py
> +++ b/testcases/network/nfsv4/acl/cleangroups.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  from random_gen import *
>  from optparse import OptionParser
>  import subprocess
> diff --git a/testcases/network/nfsv4/acl/cleanusers.py b/testcases/network/nfsv4/acl/cleanusers.py
> index f2597d2..3e652c5 100755
> --- a/testcases/network/nfsv4/acl/cleanusers.py
> +++ b/testcases/network/nfsv4/acl/cleanusers.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  from random_gen import *
>  from optparse import OptionParser
>  import subprocess
> diff --git a/testcases/network/nfsv4/acl/create_users.py b/testcases/network/nfsv4/acl/create_users.py
> index 0dcaecb..3203aff 100755
> --- a/testcases/network/nfsv4/acl/create_users.py
> +++ b/testcases/network/nfsv4/acl/create_users.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  '''
>  	Access Control Lists testing based on newpynfs framework
>  	Aurelien Charbon - Bull SA
> diff --git a/testcases/network/nfsv4/acl/random_gen.py b/testcases/network/nfsv4/acl/random_gen.py
> index 37cb179..4b6ba96 100755
> --- a/testcases/network/nfsv4/acl/random_gen.py
> +++ b/testcases/network/nfsv4/acl/random_gen.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  import subprocess
>  import random
>  import re
> diff --git a/testcases/network/nfsv4/acl/setacl_stress.py b/testcases/network/nfsv4/acl/setacl_stress.py
> index 68a4932..c93ac8b 100755
> --- a/testcases/network/nfsv4/acl/setacl_stress.py
> +++ b/testcases/network/nfsv4/acl/setacl_stress.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  '''
>  	Access Control Lists stressing script
>  	To lauch on the first client
> diff --git a/testcases/network/nfsv4/acl/test_acl.py b/testcases/network/nfsv4/acl/test_acl.py
> index 612b9e4..8699b02 100755
> --- a/testcases/network/nfsv4/acl/test_acl.py
> +++ b/testcases/network/nfsv4/acl/test_acl.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  '''
>  	Access Control Lists testing based on newpynfs framework
>  	Aurelien Charbon - Bull SA
> diff --git a/testcases/network/nfsv4/acl/test_long_acl.py b/testcases/network/nfsv4/acl/test_long_acl.py
> index 79e3a96..893855b 100755
> --- a/testcases/network/nfsv4/acl/test_long_acl.py
> +++ b/testcases/network/nfsv4/acl/test_long_acl.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  '''
>  	Access Control Lists testing based on newpynfs framework
>  	Aurelien Charbon - Bull SA
> diff --git a/testcases/network/nfsv4/locks/locktests.py b/testcases/network/nfsv4/locks/locktests.py
> index 80d8c20..9876a86 100755
> --- a/testcases/network/nfsv4/locks/locktests.py
> +++ b/testcases/network/nfsv4/locks/locktests.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  # This script aims to help to run locktests with several clients.
>  #
>  # Report bugs to Vincent ROQUETA : vincent.roqueta@ext.bull.net
> diff --git a/testcases/realtime/func/pi-tests/parse-testpi1.py b/testcases/realtime/func/pi-tests/parse-testpi1.py
> index 0631cce..740e7d1 100644
> --- a/testcases/realtime/func/pi-tests/parse-testpi1.py
> +++ b/testcases/realtime/func/pi-tests/parse-testpi1.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  # -*- coding: utf-8 -*-
>  
>  ################################################################################
> diff --git a/testcases/realtime/func/pi-tests/parse-testpi2.py b/testcases/realtime/func/pi-tests/parse-testpi2.py
> index f11ff8a..69b2748 100644
> --- a/testcases/realtime/func/pi-tests/parse-testpi2.py
> +++ b/testcases/realtime/func/pi-tests/parse-testpi2.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  # -*- coding: utf-8 -*-
>  
>  ################################################################################
> diff --git a/testcases/realtime/scripts/parser.py b/testcases/realtime/scripts/parser.py
> index bc4512f..85226de 100644
> --- a/testcases/realtime/scripts/parser.py
> +++ b/testcases/realtime/scripts/parser.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  # -*- coding: utf-8 -*-
>  
>  ################################################################################
> diff --git a/testcases/realtime/tools/ftqviz.py b/testcases/realtime/tools/ftqviz.py
> index f331d33..5ac094c 100644
> --- a/testcases/realtime/tools/ftqviz.py
> +++ b/testcases/realtime/tools/ftqviz.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  
>  #      Filename: ftqviz.py
>  #        Author: Darren Hart <dvhltc@us.ibm.com>
> diff --git a/testscripts/build/ltp-missing-install-files.py b/testscripts/build/ltp-missing-install-files.py
> index 232028b..0f9d81c 100755
> --- a/testscripts/build/ltp-missing-install-files.py
> +++ b/testscripts/build/ltp-missing-install-files.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  #
>  #    Script for determining items missing from LTP install based on the output
>  #    log provided by runltp[lite.sh].
> diff --git a/tools/pounder21/src/time_tests/drift-test.py b/tools/pounder21/src/time_tests/drift-test.py
> index 0c25756..3fe8ba5 100755
> --- a/tools/pounder21/src/time_tests/drift-test.py
> +++ b/tools/pounder21/src/time_tests/drift-test.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python3
> +#!/usr/bin/env python3
>  
>  # Time Drift Script
>  #		Periodically checks and displays time drift




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  7:03 ` [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
@ 2018-04-26  8:06   ` Petr Vorel
  2018-04-26  8:15     ` Xiao Yang
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Petr Vorel @ 2018-04-26  8:06 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> On 2018/04/26 14:45, Xiao Yang wrote:
> > If we install python3 in specific path(/usr/local/bin) rather than the
> > default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
> > interpreter python code due to wrong path.  We should use env to
> > search the correct path of python3 dynamically.

> ----------------------------------------------------------------------------
> # which python3
> /usr/local/bin/python3
> # ./in.py
> -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
> ----------------------------------------------------------------------------
Indeed RHEL6.9GA still doesn't have python3 as normal package [1].

Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
I'm not against changing schebang to using env, if causing troubles.
Cyril, what do you think?

It's funny that some distros already started removing python2 while still supported
versions haven't properly added python3 yet :(.

> Thanks,
> Xiao Yang


Kind regards,
Petr

[1] https://distrowatch.com/table.php?distribution=redhat&pkglist=true&version=rhel-6.9#pkglist

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  8:06   ` Petr Vorel
@ 2018-04-26  8:15     ` Xiao Yang
  2018-04-26  8:16     ` Petr Vorel
  2018-04-27 14:08     ` Cyril Hrubis
  2 siblings, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2018-04-26  8:15 UTC (permalink / raw)
  To: ltp

On 2018/04/26 16:06, Petr Vorel wrote:
> Hi Xiao,
>
>> On 2018/04/26 14:45, Xiao Yang wrote:
>>> If we install python3 in specific path(/usr/local/bin) rather than the
>>> default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
>>> interpreter python code due to wrong path.  We should use env to
>>> search the correct path of python3 dynamically.
>> ----------------------------------------------------------------------------
>> # which python3
>> /usr/local/bin/python3
>> # ./in.py
>> -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
>> ----------------------------------------------------------------------------
> Indeed RHEL6.9GA still doesn't have python3 as normal package [1].
Hi Petr,

Currently, both RHEL6 and RHEL7 don't have python3 as normal package.
I just install python3 on RHEL6 and RHEL7 manually.

Thanks,
Xiao Yang
> Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
> I'm not against changing schebang to using env, if causing troubles.
> Cyril, what do you think?
>
> It's funny that some distros already started removing python2 while still supported
> versions haven't properly added python3 yet :(.
>
>> Thanks,
>> Xiao Yang
>
> Kind regards,
> Petr
>
> [1] https://distrowatch.com/table.php?distribution=redhat&pkglist=true&version=rhel-6.9#pkglist
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  8:06   ` Petr Vorel
  2018-04-26  8:15     ` Xiao Yang
@ 2018-04-26  8:16     ` Petr Vorel
  2018-04-26  8:39       ` Xiao Yang
  2018-04-27 14:08     ` Cyril Hrubis
  2 siblings, 1 reply; 13+ messages in thread
From: Petr Vorel @ 2018-04-26  8:16 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> > On 2018/04/26 14:45, Xiao Yang wrote:
> > > If we install python3 in specific path(/usr/local/bin) rather than the
> > > default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
> > > interpreter python code due to wrong path.  We should use env to
> > > search the correct path of python3 dynamically.

> > ----------------------------------------------------------------------------
> > # which python3
> > /usr/local/bin/python3
> > # ./in.py
> > -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
> > ----------------------------------------------------------------------------
And is it really general RHEL6.9GA problem? Isn't it installable into standard path with
EPEL? [1]

> Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
> I'm not against changing schebang to using env, if causing troubles.
> Cyril, what do you think?

> It's funny that some distros already started removing python2 while still supported
> versions haven't properly added python3 yet :(.

> > Thanks,
> > Xiao Yang


Kind regards,
Petr

[1] https://unix.stackexchange.com/questions/343199/how-to-install-openvpn-client-on-rhel-7-3/343214#343214

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  8:16     ` Petr Vorel
@ 2018-04-26  8:39       ` Xiao Yang
  2018-04-26 10:54         ` Petr Vorel
  0 siblings, 1 reply; 13+ messages in thread
From: Xiao Yang @ 2018-04-26  8:39 UTC (permalink / raw)
  To: ltp

On 2018/04/26 16:16, Petr Vorel wrote:
> Hi Xiao,
>
>>> On 2018/04/26 14:45, Xiao Yang wrote:
>>>> If we install python3 in specific path(/usr/local/bin) rather than the
>>>> default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
>>>> interpreter python code due to wrong path.  We should use env to
>>>> search the correct path of python3 dynamically.
>>> ----------------------------------------------------------------------------
>>> # which python3
>>> /usr/local/bin/python3
>>> # ./in.py
>>> -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
>>> ----------------------------------------------------------------------------
> And is it really general RHEL6.9GA problem? Isn't it installable into standard path with
> EPEL? [1]
Hi Petr,

Neither, i just install python3 into /usr/local/bin by Python-3.6.5.tgz on purpose.  :-P

Thanks,
Xiao Yang

>> Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
>> I'm not against changing schebang to using env, if causing troubles.
>> Cyril, what do you think?
>> It's funny that some distros already started removing python2 while still supported
>> versions haven't properly added python3 yet :(.
>>> Thanks,
>>> Xiao Yang
>
> Kind regards,
> Petr
>
> [1] https://unix.stackexchange.com/questions/343199/how-to-install-openvpn-client-on-rhel-7-3/343214#343214
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  8:39       ` Xiao Yang
@ 2018-04-26 10:54         ` Petr Vorel
  2018-04-27  1:31           ` Xiao Yang
  0 siblings, 1 reply; 13+ messages in thread
From: Petr Vorel @ 2018-04-26 10:54 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> > > > On 2018/04/26 14:45, Xiao Yang wrote:
> > > > > If we install python3 in specific path(/usr/local/bin) rather than the
> > > > > default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
> > > > > interpreter python code due to wrong path.  We should use env to
> > > > > search the correct path of python3 dynamically.
> > > > ----------------------------------------------------------------------------
> > > > # which python3
> > > > /usr/local/bin/python3
> > > > # ./in.py
> > > > -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
> > > > ----------------------------------------------------------------------------
> > And is it really general RHEL6.9GA problem? Isn't it installable into standard path with
> > EPEL? [1]
> Hi Petr,

> Neither, i just install python3 into /usr/local/bin by Python-3.6.5.tgz on purpose.  :-P
And what prevent you to use either python34 from EPEL (which installs into standard
/usr/bin) or symlinking your compiled python3 into /usr/bin ?

Both are working solutions.

> Thanks,
> Xiao Yang


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure
  2018-04-26  6:45 ` [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure Xiao Yang
@ 2018-04-26 12:15   ` Petr Vorel
  0 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2018-04-26 12:15 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> On some distros(e.g. RHEL6.9GA), we got the mismatched
> output by running 'file in.py':
> ----------------------------------------------
> in.py: a /usr/bin/env python3 script text executable
> ----------------------------------------------

> We just match both python and python3 to fix this issue.

> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  testcases/commands/file/file01.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

> diff --git a/testcases/commands/file/file01.sh b/testcases/commands/file/file01.sh
> index e04b32e..5a81b3b 100755
> --- a/testcases/commands/file/file01.sh
> +++ b/testcases/commands/file/file01.sh
> @@ -84,8 +84,8 @@ do_test()
>  	 7) file_test in.pl "[pP]erl script, ASCII text executable" \
>  			    "[pP]erl script text executable" \
>  			    "a /usr/bin/perl script text";;
> -	 8) file_test in.py "[pP]ython script, ASCII text executable" \
> -			    "[pP]ython script text executable";;
> +	 8) file_test in.py "[pP]ython3\{0,1\} script, ASCII text executable" \
This one isn't needed, as problem is with file-5.04, which use the latter one, but let's
keep it.
> +			    "[pP]ython3\{0,1\} script text executable";;
>  	 9) file_test in.m4 "M4 macro processor script, ASCII text" \
>  			    "ASCII M4 macro language pre-processor text";;
>  	10) file_test in "ELF .*-bit $TEST_ARCH executable, .*" \

Merged, thanks!


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26 10:54         ` Petr Vorel
@ 2018-04-27  1:31           ` Xiao Yang
  0 siblings, 0 replies; 13+ messages in thread
From: Xiao Yang @ 2018-04-27  1:31 UTC (permalink / raw)
  To: ltp

On 2018/04/26 18:54, Petr Vorel wrote:
> Hi Xiao,
>
>>>>> On 2018/04/26 14:45, Xiao Yang wrote:
>>>>>> If we install python3 in specific path(/usr/local/bin) rather than the
>>>>>> default(/usr/bin), the standard shebang(#!/usr/bin/python3) cannot
>>>>>> interpreter python code due to wrong path.  We should use env to
>>>>>> search the correct path of python3 dynamically.
>>>>> ----------------------------------------------------------------------------
>>>>> # which python3
>>>>> /usr/local/bin/python3
>>>>> # ./in.py
>>>>> -bash: ./in.py: /usr/bin/python3: bad interpreter: No such file or directory
>>>>> ----------------------------------------------------------------------------
>>> And is it really general RHEL6.9GA problem? Isn't it installable into standard path with
>>> EPEL? [1]
>> Hi Petr,
>> Neither, i just install python3 into /usr/local/bin by Python-3.6.5.tgz on purpose.  :-P
> And what prevent you to use either python34 from EPEL (which installs into standard
> /usr/bin) or symlinking your compiled python3 into /usr/bin ?
>
> Both are working solutions.
Hi Petr,

Nothing prevent me to use either python34 or symlink.

In all kinds of cases, it is possible that python3 is not installed in 
the standard path.  I think
we should adapt python code to enviroment instead of changing  
enviroment to adapt to code.
Do you think so?

Thanks,
Xiao Yang
>> Thanks,
>> Xiao Yang
>
> Kind regards,
> Petr
>
>
> .
>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-26  8:06   ` Petr Vorel
  2018-04-26  8:15     ` Xiao Yang
  2018-04-26  8:16     ` Petr Vorel
@ 2018-04-27 14:08     ` Cyril Hrubis
  2018-04-30  6:38       ` Petr Vorel
  2 siblings, 1 reply; 13+ messages in thread
From: Cyril Hrubis @ 2018-04-27 14:08 UTC (permalink / raw)
  To: ltp

Hi!
> Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
> I'm not against changing schebang to using env, if causing troubles.
> Cyril, what do you think?

Well if it's causing problems for our users we should go ahead and
change the shebangs to /usr/bin/env python3.

> It's funny that some distros already started removing python2 while still supported
> versions haven't properly added python3 yet :(.

That is why I think that we should avoid using python in LTP...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-27 14:08     ` Cyril Hrubis
@ 2018-04-30  6:38       ` Petr Vorel
  2018-05-02 15:37         ` Petr Vorel
  0 siblings, 1 reply; 13+ messages in thread
From: Petr Vorel @ 2018-04-30  6:38 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> Hi!
> > Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
> > I'm not against changing schebang to using env, if causing troubles.
> > Cyril, what do you think?

> Well if it's causing problems for our users we should go ahead and
> change the shebangs to /usr/bin/env python3.
Simple linking solves that:
# ln -s /usr/local/bin/python3 /usr/bin
And this problem occurs only if you compile python3 from sources (and there are packages for
all major distros, including RHEL 6.9, which Xiao used - in his case it's EPEL repository).

Still want to me to change shebang to '/usr/bin/env python3' ?


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3'
  2018-04-30  6:38       ` Petr Vorel
@ 2018-05-02 15:37         ` Petr Vorel
  0 siblings, 0 replies; 13+ messages in thread
From: Petr Vorel @ 2018-05-02 15:37 UTC (permalink / raw)
  To: ltp

Hi Xiao,

> > > Couldn't it be solved by simple creating manually symlink python3 to /usr/bin ?
> > > I'm not against changing schebang to using env, if causing troubles.
> > > Cyril, what do you think?

> > Well if it's causing problems for our users we should go ahead and
> > change the shebangs to /usr/bin/env python3.
> Simple linking solves that:
> # ln -s /usr/local/bin/python3 /usr/bin
> And this problem occurs only if you compile python3 from sources (and there are packages for
> all major distros, including RHEL 6.9, which Xiao used - in his case it's EPEL repository).

> Still want to me to change shebang to '/usr/bin/env python3' ?

Acked by Cyril => merged.
Thanks for your time!

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-05-02 15:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26  6:45 [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
2018-04-26  6:45 ` [LTP] [PATCH 2/2] commands/file01: Fix "python3" match failure Xiao Yang
2018-04-26 12:15   ` Petr Vorel
2018-04-26  7:03 ` [LTP] [PATCH 1/2] *.py: Replace '#!/usr/bin/python3' with '#!/usr/bin/env python3' Xiao Yang
2018-04-26  8:06   ` Petr Vorel
2018-04-26  8:15     ` Xiao Yang
2018-04-26  8:16     ` Petr Vorel
2018-04-26  8:39       ` Xiao Yang
2018-04-26 10:54         ` Petr Vorel
2018-04-27  1:31           ` Xiao Yang
2018-04-27 14:08     ` Cyril Hrubis
2018-04-30  6:38       ` Petr Vorel
2018-05-02 15:37         ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.