Change in pysim[master]: pySim-shell: be sure that startup script file exists

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Apr 8 15:52:40 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23680 )


Change subject: pySim-shell: be sure that startup script file exists
......................................................................

pySim-shell: be sure that startup script file exists

When a startup script file is specified that does not exists pySim-shell
skips the script and starts normally. This is dangerous because if
pySim-shell is called by a shellscript with a nonexisting script file
the shellscript may hang forever because there is no script that exists
pySim-shell again

Change-Id: I4ff2226c8852727aa23357aa54d1e2d480bfaf2d
Related: OS#4963
---
M pySim-shell.py
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/80/23680/1

diff --git a/pySim-shell.py b/pySim-shell.py
index f1060de..53c8585 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -450,6 +450,12 @@
 	rs.mf.add_file(DF_TELECOM())
 	rs.mf.add_file(DF_GSM())
 
+	# If a script file is specified, be sure that it actually exists
+	if opts.script:
+		if not os.path.exists(opts.script) or not os.path.isfile(opts.script):
+			print("Invalid script file!")
+			sys.exit(2)
+
 	app = PysimApp(card, rs, opts.script)
 	rs.select('MF', app)
 

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/23680
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4ff2226c8852727aa23357aa54d1e2d480bfaf2d
Gerrit-Change-Number: 23680
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210408/77f42a11/attachment.htm>


More information about the gerrit-log mailing list