Bug: manage_boot_params.sh fails to parse syslinux.cfg with Windows line endings (CRLF)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 253
- Forks
- 106
- Avg merge
- 6d 22h
- Merged PRs (30d)
- 12
Description
Problem
The manage_boot_params.sh script fails to correctly parse /boot/syslinux/syslinux.cfg when the file contains Windows-style (CRLF, \r\n).
Reproduction
Run the script:
OPERATION=read_config /usr/local/emhttp/plugins/dynamix/scripts/manage_boot_params.sh
returns broken JSON:
{
"nvme_disable": "0",
"acs_override": "",
"vfio_unsafe": "0",
"efifb_off": "0",
"vesafb_off": "0",
"simplefb_off": "0",
"sysfb_blacklist": "0",
"acpi_lax": "0",
"ghes_disable": "0",
"usb_autosuspend": "0",
"pcie_aspm_off": "0",
"pcie_port_pm_off": "0",
"pci_noaer": "0",
"pci_realloc": "0",
"custom_params": "",
"custom_params_comments": {},
"current_config": "",
"current_append_line": "",
" "timeout": "50
}
This can trigger Shell script returned invalid JSON. Please check configuration. of boot_params_handler.php.
Possible fixes
parse_append_line()
awk -v label="$label" '
/^label / {
gsub(/\r$/, "") # Remove trailing \r before matching
if ($0 ~ "^label " label "$") {
in_section=1
} else {
in_section=0
}
}
in_section && /^ append/ {
gsub(/\r$/, "") # Remove trailing \r
sub(/^ append /, "")
print
exit
}
' "$cfg_file"
extract_timeout()
grep "^timeout " "$cfg_file" | awk '{print $2}' | head -n 1 | tr -d '\r'
escape_json_string() and load_comments()
echo could be optionally replaced with echo -n or printf '%s', but not really a bug as $() automatically removes the trailing newline. Examples:
"custom_params": "$(escape_json_string "$custom_params")",
...
local all_comments=$(load_comments)
@SpaceinvaderOne
Should be an issue for you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in /usr/local/emhttp/plugins/dynamix/scripts/manage_boot_params.sh, focusing on parse_append_line(), extract_timeout(), escape_json_string(), and load_comments(). Reproduce the issue with OPERATION=read_config and a CRLF syslinux.cfg, then verify the script returns valid JSON with the expected timeout and append values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- awk, bash
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100