Closed yingxingcheng closed 1 year ago
Thanks for bringing this up. I'll take a look.
A workaround could be to change the conventions used for the arguments passed to the scripts, e.g. prefix with a few letters that would make your argument impossible to interpret as an integer, e.g. Y1_00
(I'm guessing your digits represent indexes of spherical harmonics.)
In principle, we could use less ambiguous representations of the arguments passed to rr-python-script
, e.g. with base64 encoded JSON.
For you example, that would mean base64.urlsafe_b64encode(json.dumps("1_00").encode("utf-8")).decode("ascii")
, which results in 'IjFfMDAi'
. This can be safely passed as a command-line argument in bash and ninja, and can be converted back to its original value. There are some downsides to this approach:
rr-python-script
directly, but that would not matter if one only uses rr
.rr
unreadable, because of the encoding, making it harder to detect where things go wrong in case of failures.I'm going to close this since the workaround seems to work. 1_00
is a valid integer in Python, so adding an exception for this would not be very robust.
https://github.com/reproducible-reporting/reprepbuild/blob/1375ed84c5f098f77b523cd12dae953d5eb93d8b/src/reprepbuild/pythonscript.py#L53-L60
The function potentially creates a problem if the user passes a script argument like
1_00
, and it will be converted to the integer 100.