aports/community/ceph/32-fix_ceph_thread_timeout.patch
Duncan Bellamy e25854682d community/ceph: upgrade to 15.2.8
add -fpic flag to aarch64 code

move -fpic into linker options

try cmake flag

remove checksum

try another flag

try rename define

fix checksum

disable native armv8 code as includes textrel

make 32-fix_ceph_thread_timeout.patch match upstream
2020-12-20 17:27:20 +00:00

75 lines
2.6 KiB
Diff

--- a/src/pybind/ceph_argparse.py
+++ b/src/pybind/ceph_argparse.py
@@ -564,11 +564,11 @@
raise ArgumentFormat("{0} not a hex integer".format(val))
try:
int(val)
- except:
+ except ValueError:
raise ArgumentFormat('can\'t convert {0} to integer'.format(val))
try:
int(bits)
- except:
+ except ValueError:
raise ArgumentFormat('can\'t convert {0} to integer'.format(bits))
self.val = s
@@ -1077,15 +1077,12 @@
# Have an arg; validate it
try:
validate_one(myarg, desc)
- valid = True
except ArgumentError as e:
- valid = False
-
# argument mismatch
if not desc.req:
# if not required, just push back; it might match
# the next arg
- save_exception = [ myarg, e ]
+ save_exception = [myarg, e]
myargs.insert(0, myarg)
break
else:
@@ -1171,9 +1168,9 @@
# (relies on a cmdsig being key,val where val is a list of len 1)
def grade(cmd):
- # prefer optional arguments over required ones
- sigs = cmd['sig']
- return sum(map(lambda sig: sig.req, sigs))
+ # prefer optional arguments over required ones
+ sigs = cmd['sig']
+ return sum(map(lambda sig: sig.req, sigs))
bestcmds_sorted = sorted(bestcmds, key=grade)
if verbose:
@@ -1227,7 +1224,6 @@
return valid_dict
-
def find_cmd_target(childargs):
"""
Using a minimal validation, figure out whether the command
@@ -1312,14 +1308,15 @@
def run_in_thread(func, *args, **kwargs):
- interrupt = False
timeout = kwargs.pop('timeout', 0)
if timeout == 0 or timeout == None:
# python threading module will just get blocked if timeout is `None`,
# otherwise it will keep polling until timeout or thread stops.
- # wait for INT32_MAX, as python 3.6.8 use int32_t to present the
- # timeout in integer when converting it to nanoseconds
- timeout = (1 << (32 - 1)) - 1
+ # timeout in integer when converting it to nanoseconds, but since
+ # python3 uses `int64_t` for the deadline before timeout expires,
+ # we have to use a safe value which does not overflow after being
+ # added to current time in microseconds.
+ timeout = 24 * 60 * 60
t = RadosThread(func, *args, **kwargs)
# allow the main thread to exit (presumably, avoid a join() on this