Validate --port, boolean environment variables and KOLIBRI_HOME
🙂 Looking for an issue? Welcome! This issue is open for contribution. If this is the first time you’re requesting an issue, please:
- Read Contributing guidelines carefully. Pay extra attention to Using generative AI. Pull requests and comments that don’t follow the guidelines won’t be answered.
- Confirm that you’ve read the guidelines in your comment.
Overview
Three startup inputs aren't validated: the --port options, boolean environment variables and KOLIBRI_HOME. Bad values crash with a traceback, leave a pid file that breaks later commands, or are silently read the opposite way.
Complexity: Low Target branch: develop
Context
On develop at fe298f5449:
kolibri start --port 70000(or-1) raisesOverflowError: connect(): port must be 0-65535and leavesserver.pidwith that port. After that,kolibri statusandkolibri stopraise the same error until the file is deleted by hand.cli.py#L237-L247declares the port as a plainint. Ports inoptions.iniare range-checked.- Boolean environment variables are true for any non-empty value.
KOLIBRI_DISABLE_REQUEST_LOGGING=Falsedisables request logging, andKOLIBRI_NO_FILE_BASED_LOGGING=0disables file logging.logger.py#L16-L17,conf.py#L29,env.py#L216. KOLIBRI_HOMEwith a missing parent raisesRuntimeError, and pointing at a file raisesNotADirectoryError, both with tracebacks.KOLIBRI_HOME=(empty) silently uses the current directory as the home.conf.py#L28-L43.
The Change
--portand--zip-portshould be range-checked like ports inoptions.ini.- Boolean environment variables should be parsed the way boolean options are.
KOLIBRI_HOMEshould be checked before anything is created in it.
Acceptance Criteria
- [ ]
--portand--zip-portoutside 1-65535 exit with an error message and write no pid file. - [ ] Boolean environment variables read
False,false,0andnoas false. - [ ] Each
KOLIBRI_HOMEcase under Context exits with an error message and no traceback.
AI usage
I had Claude Code sweep Kolibri's command-line tools and configuration handling for crashes on bad input and reproduce each one. I chose the grouping. Claude Code drafted the issue.
Hi! 👋
This issue is available for contribution and supports self-assignment. Here's how to get started:
- Comment
/assignto assign yourself to this issue - You can have up to 2 issues assigned at a time across all community repos
- Dropping an issue has a 7-day cooldown before the slot opens up
- Link your pull request to this issue when you submit it
📖 Read the Contributing guidelines before starting.
Are you preparing for Google Summer of Code? See our GSoC guidelines.
/assign
Hi! 👋
You've been assigned to this issue. Here's what to do next:
- Read the issue description carefully and make sure you understand the requirements
- Link your pull request to this issue when you submit it
- If you can no longer work on this, unassign yourself so others can pick it up
Good luck! 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.