lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

September 2024

  • 1 participants
  • 1983 discussions
[M] Change in pysim[master]: filesystem: pass total_len to construct of when encoding file contents
by dexter 19 Sep '24

19 Sep '24
Attention is currently required from: laforge. dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38195?usp=email ) Change subject: filesystem: pass total_len to construct of when encoding file contents ...................................................................... Patch Set 2: (2 comments) File pySim/filesystem.py: https://gerrit.osmocom.org/c/pysim/+/38195/comment/8217c92e_3554c5d8?usp=em… : PS1, Line 1043: __get_rec_len > I'm not following your argument here. […] I have put the double underscore to make the method as private. Also I don't think that the double underscore is exclusively reserved for python internal stuff. At least I haven't read that anywhere yet. I found an interesting article about the underscore topic: https://medium.com/python-explainers/single-and-double-underscores-in-pytho… https://gerrit.osmocom.org/c/pysim/+/38195/comment/ca762fc4_fa7dd7f5?usp=em… : PS1, Line 1266: return b2h(filter_dict(build_construct(self._construct, abstract_data, self._get_size(total_len)))) > TransRecEF registeres the cdm2 command-set form TransparentEF, yes. It will call lchan. […] I still not seeing entirely through here. I thought TransRecEF were transparent files with multiple fixed length records. But its actually the other way around? I was expected to get the record oriented command set but I get the command set for transparent files but with multiple records in the JSON struct. In any case, I have tested it and it seems to work fine. The files get updated properly. Also the unittests seem to have coverage, so I think everything should be ok here. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b Gerrit-Change-Number: 38195 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 19 Sep 2024 09:51:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
[XS] Change in ...pyosmocom[master]: osmocom.utils: Return hexstr type form argparse helpers
by laforge 19 Sep '24

19 Sep '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38203?usp=email ) Change subject: osmocom.utils: Return hexstr type form argparse helpers ...................................................................... osmocom.utils: Return hexstr type form argparse helpers Change-Id: Ide9f3c6b364d867f2dfc1b7dfda40dbab03c5130 --- M src/osmocom/utils.py 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/03/38203/1 diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py index 6c91783..a218e1b 100644 --- a/src/osmocom/utils.py +++ b/src/osmocom/utils.py @@ -203,16 +203,16 @@ raise ValueError('Input must be [hexa]decimal') if len(instr) & 1: raise ValueError('Input has un-even number of hex digits') - return instr + return hexstr(instr) -def is_hexstr(instr: str) -> str: +def is_hexstr(instr: str) -> hexstr: """Method that can be used as 'type' in argparse.add_argument() to validate the value consists of an even sequence of hexadecimal digits only.""" if not all(c in string.hexdigits for c in instr): raise ValueError('Input must be hexadecimal') if len(instr) & 1: raise ValueError('Input has un-even number of hex digits') - return instr + return hexstr(instr) def is_decimal(instr: str) -> str: """Method that can be used as 'type' in argparse.add_argument() to validate the value consists of -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38203?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: Ide9f3c6b364d867f2dfc1b7dfda40dbab03c5130 Gerrit-Change-Number: 38203 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org>
1 0
0 0
[XS] Change in ...pyosmocom[master]: osmocom.utils: Make 'hexstr' type hashable
by laforge 19 Sep '24

19 Sep '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38204?usp=email ) Change subject: osmocom.utils: Make 'hexstr' type hashable ...................................................................... osmocom.utils: Make 'hexstr' type hashable otherwise we couldn't use hexstr values as dict keys, for example Change-Id: Ic9e1f8af1db436af5456fe5964133a144c9e066b --- M src/osmocom/utils.py 1 file changed, 4 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/04/38204/1 diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py index a218e1b..009eb04 100644 --- a/src/osmocom/utils.py +++ b/src/osmocom/utils.py @@ -41,6 +41,10 @@ # make sure comparison is done case-insensitive return str(self) == other.lower() + def __hash__(self): + # having a custom __eq__ method will make the type unhashable by default, lets fix that + return hash(str(self)) + def __getitem__(self, val) -> 'hexstr': # make sure slicing a hexstr will return a hexstr return hexstr(super().__getitem__(val)) -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38204?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: Ic9e1f8af1db436af5456fe5964133a144c9e066b Gerrit-Change-Number: 38204 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in ...pyosmocom[master]: osmocom.utils: Make b2h/i2h/swap_nibbles return hexstr type
by laforge 19 Sep '24

19 Sep '24
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38202?usp=email ) Change subject: osmocom.utils: Make b2h/i2h/swap_nibbles return hexstr type ...................................................................... osmocom.utils: Make b2h/i2h/swap_nibbles return hexstr type Change-Id: I4c72c33baf6e4b3a39fb28d72ad66fbd3e957e95 --- M src/osmocom/utils.py 1 file changed, 40 insertions(+), 38 deletions(-) git pull ssh://gerrit.osmocom.org:29418/python/pyosmocom refs/changes/02/38202/1 diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py index 183bbb8..6c91783 100644 --- a/src/osmocom/utils.py +++ b/src/osmocom/utils.py @@ -27,7 +27,39 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -# just to differentiate strings of hex nibbles from everything else +class hexstr(str): + """Class derived from 'str', represeting a string of hexadecimal digits. It differs in that + comparisons are case-insensitive, and it offers encoding-free conversion from hexstr to bytes + and vice-versa.""" + def __new__(cls, s: str): + if not all(c in string.hexdigits for c in s): + raise ValueError('Input must be hexadecimal digits only') + # store as lower case digits + return super().__new__(cls, s.lower()) + + def __eq__(self, other: str) -> bool: + # make sure comparison is done case-insensitive + return str(self) == other.lower() + + def __getitem__(self, val) -> 'hexstr': + # make sure slicing a hexstr will return a hexstr + return hexstr(super().__getitem__(val)) + + def to_bytes(self) -> bytes: + """return hex-string converted to bytes""" + s = str(self) + if len(s) & 1: + raise ValueError('Cannot convert hex string with odd number of digits') + return h2b(s) + + @classmethod + def from_bytes(cls, bt: bytes) -> 'hexstr': + """instantiate hex-string from bytes""" + return cls(b2h(bt)) + +# just to differentiate strings of hex nibbles from everything else; only used for typing +# hints. New code should typically use the 'class hexstr' type above to get the benefit +# of case-insensitive comparison. Hexstr = NewType('Hexstr', str) def h2b(s: Hexstr) -> bytearray: @@ -35,9 +67,9 @@ return bytearray.fromhex(s) -def b2h(b: bytearray) -> Hexstr: +def b2h(b: bytearray) -> hexstr: """convert from a sequence of bytes to a string of hex nibbles""" - return ''.join(['%02x' % (x) for x in b]) + return hexstr(''.join(['%02x' % (x) for x in b])) def h2i(s: Hexstr) -> List[int]: @@ -45,9 +77,9 @@ return [(int(x, 16) << 4)+int(y, 16) for x, y in zip(s[0::2], s[1::2])] -def i2h(s: List[int]) -> Hexstr: +def i2h(s: List[int]) -> hexstr: """convert from a list of integers to a string of hex nibbles""" - return ''.join(['%02x' % (x) for x in s]) + return hexstr(''.join(['%02x' % (x) for x in s])) def h2s(s: Hexstr) -> str: @@ -56,7 +88,7 @@ if int(x + y, 16) != 0xff]) -def s2h(s: str) -> Hexstr: +def s2h(s: str) -> hexstr: """convert from an ASCII string to a string of hex nibbles""" b = bytearray() b.extend(map(ord, s)) @@ -68,9 +100,9 @@ return ''.join([chr(x) for x in s]) -def swap_nibbles(s: Hexstr) -> Hexstr: +def swap_nibbles(s: Hexstr) -> hexstr: """swap the nibbles in a hex string""" - return ''.join([x+y for x, y in zip(s[1::2], s[0::2])]) + return hexstr(''.join([x+y for x, y in zip(s[1::2], s[0::2])])) def rpad(s: str, l: int, c='f') -> str: @@ -138,36 +170,6 @@ except: return False -class hexstr(str): - """Class derived from 'str', represeting a string of hexadecimal digits. It differs in that - comparisons are case-insensitive, and it offers encoding-free conversion from hexstr to bytes - and vice-versa.""" - def __new__(cls, s: str): - if not all(c in string.hexdigits for c in s): - raise ValueError('Input must be hexadecimal digits only') - # store as lower case digits - return super().__new__(cls, s.lower()) - - def __eq__(self, other: str) -> bool: - # make sure comparison is done case-insensitive - return str(self) == other.lower() - - def __getitem__(self, val) -> 'hexstr': - # make sure slicing a hexstr will return a hexstr - return hexstr(super().__getitem__(val)) - - def to_bytes(self) -> bytes: - """return hex-string converted to bytes""" - s = str(self) - if len(s) & 1: - raise ValueError('Cannot convert hex string with odd number of digits') - return h2b(s) - - @classmethod - def from_bytes(cls, bt: bytes) -> 'hexstr': - """instantiate hex-string from bytes""" - return cls(b2h(bt)) - ######################################################################### # ARGPARSE HELPERS ######################################################################### -- To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38202?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: python/pyosmocom Gerrit-Branch: master Gerrit-Change-Id: I4c72c33baf6e4b3a39fb28d72ad66fbd3e957e95 Gerrit-Change-Number: 38202 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org>
1 0
0 0
[M] Change in pysim[master]: utils: get rid of enc_msisdn and dec_msisdn
by laforge 19 Sep '24

19 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38118?usp=email ) Change subject: utils: get rid of enc_msisdn and dec_msisdn ...................................................................... Patch Set 8: Code-Review-1 (1 comment) Patchset: PS8: as the tests indicate it also changes the output of the tests with real cards. I'd vote to simply move the {enc,dec}_msisdn to pySim.legacy and not change anything except the import statements in legacy tools. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38118?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I19ec8ba14551ec282fc0cc12ae2f6d528bdfc527 Gerrit-Change-Number: 38118 Gerrit-PatchSet: 8 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Thu, 19 Sep 2024 04:39:37 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in pysim[master]: utils: get rid of enc_msisdn and dec_msisdn
by laforge 18 Sep '24

18 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38118?usp=email ) Change subject: utils: get rid of enc_msisdn and dec_msisdn ...................................................................... Patch Set 8: (1 comment) Patchset: PS8: I wouldn't have bothered, sorry. Why invest time in changing pySim.legacy.* at all, unless there's a clear bug that needs fixing? Likewiese, the same applies to pySim-{read,prog}. Those tools are designated legacy for a reason. Any change will just invest time in something that is scheduled for removal - and at the same time it risks breaking something in a suble way. So the question to me is: Is this fixing a bug? If yes, then let's merge it. If not, then my suggestion would be to move {enc,dec}_msisdn from pySim.utils to pySim.legacy.utils which means it will be removed when we remove all of the legacy. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38118?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I19ec8ba14551ec282fc0cc12ae2f6d528bdfc527 Gerrit-Change-Number: 38118 Gerrit-PatchSet: 8 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 18 Sep 2024 17:37:09 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
1 0
0 0
[XS] Change in pysim[master]: ts_102_221: se _test_de_encode instead of _test_decode in EF.DIR unit...
by laforge 18 Sep '24

18 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38201?usp=email ) Change subject: ts_102_221: se _test_de_encode instead of _test_decode in EF.DIR unittest ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38201?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: If459073c6ff927c1cc1790d506e3979243b1fb4c Gerrit-Change-Number: 38201 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 18 Sep 2024 17:33:28 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: ts_51_011: use _test_de_encode instead of _test_decode in EF.CFIS uni...
by laforge 18 Sep '24

18 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38200?usp=email ) Change subject: ts_51_011: use _test_de_encode instead of _test_decode in EF.CFIS unittest ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38200?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: Ib876fd799f871fe64ced2a7b64847ffd09e16ed9 Gerrit-Change-Number: 38200 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 18 Sep 2024 17:33:17 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[XS] Change in pysim[master]: ts_51_011: fix unittest for EF.ADN
by laforge 18 Sep '24

18 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38199?usp=email ) Change subject: ts_51_011: fix unittest for EF.ADN ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38199?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I241792e66ee6167be6ddc076453344b6307d6265 Gerrit-Change-Number: 38199 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 18 Sep 2024 17:33:03 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes
1 0
0 0
[M] Change in pysim[master]: filesystem: pass total_len to construct of when encoding file contents
by laforge 18 Sep '24

18 Sep '24
Attention is currently required from: dexter. laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38195?usp=email ) Change subject: filesystem: pass total_len to construct of when encoding file contents ...................................................................... Patch Set 2: (2 comments) File pySim/filesystem.py: https://gerrit.osmocom.org/c/pysim/+/38195/comment/11de1800_b42b75ff?usp=em… : PS1, Line 1043: __get_rec_len > I thought I could re-use _get_size() in TransRecEf, that is why _get_size only has one underscore. I'm not following your argument here. In general, I think double-underscores in python are (should be?) reserved for python internal stuff like __str__ __init__, etc. As we do not have a _get_rec_len with one underscore, why should we add one with two? https://gerrit.osmocom.org/c/pysim/+/38195/comment/4de91a69_da1076d8?usp=em… : PS1, Line 1266: return b2h(filter_dict(build_construct(self._construct, abstract_data, self._get_size(total_len)))) > I see, we can not use _get_size here. […] TransRecEF registeres the cdm2 command-set form TransparentEF, yes. It will call lchan.update_binary_dec() which in turn will call TransparentEF.encode_hex() which will call self._encode_bin() which is TransRecEF._encode_bin() which iterates over self.encode_record_bin() for all the given records in the input data. So I don't understand the question about "how to test". Any update on a TransRecEF should exercise the above-mentioned methods, as long as the speicifc TransRecEF derived class only provides a _construct and does not override the _encode_{hex,bin} inherited from TransRecordEF. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b Gerrit-Change-Number: 38195 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 18 Sep 2024 17:31:40 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • ...
  • 199
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.