[mythtv-commits] Ticket #13401: [v30] configure script uses wrong logic operator on result of test is_python3

MythTV noreply at mythtv.org
Wed Feb 6 19:55:54 UTC 2019


#13401: [v30] configure script uses wrong logic operator on result of  test
is_python3
-------------------------------------------+-------------------------------
     Reporter:  jgmiller                   |      Owner:  Peter Bennett
         Type:  Bug Report - General       |     Status:  new
     Priority:  major                      |  Milestone:  30.1
    Component:  MythTV - configure script  |    Version:  v30-fixes
     Severity:  medium                     |   Keywords:  python version
Ticket locked:  0                          |  logic
-------------------------------------------+-------------------------------
 The configure script allows setting the python executable path with
 --python=path_to_specific_version

 The configure script tests the python executable at line 6956

 # Check for python dependencies
 if enabled bindings_python; then
     is_python3                 && python=python2

 The is_python3 function tests the python version with

     check_cmd $python << EOF
 import sys
 if sys.version_info > (3,0):
     sys.exit(0)
 else:
     sys.exit(1)
 EOF

 So if the python version is greater than (3,0) viz the python version is a
 pyhthon3 variant. the test function exits with 0 to return true/success.

 on return to the calling function

     is_python3                 && python=python2

 because is_python3 returns 0 ie is successful/true, the statement then
 sets python to python2 because of the "&&" operator.

 The operator "&&" should in fact be the OR operator, two vertical pipes,
 "\|\|" (without the backslashes) meaning if not true/not success, ie only
 set python to python2 if the python version is not 3.

 I think somebody forgot that in Bourne shell scripts, functions which
 return 0 are successful, other values are failure, as opposed to other
 scripting languages (eg PERL) where 0 is false.

-- 
Ticket URL: <https://code.mythtv.org/trac/ticket/13401>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list