Skip to content

fix(ddev): strip CRLF from parsed ddev hostnames, fixes #46 - #53

Merged
steffenmaechtel merged 2 commits into
masterfrom
feature/issue-46
Sep 2, 2026
Merged

fix(ddev): strip CRLF from parsed ddev hostnames, fixes #46#53
steffenmaechtel merged 2 commits into
masterfrom
feature/issue-46

Conversation

@steffenmaechtel

Copy link
Copy Markdown
Owner

Problem

opk status reported missing Windows hosts entries with garbled output
(.localosts (win), .localdd: instead of ⚠ hosts (win) /
add:), and users reported additional hostnames without their tld
(e.g. meister-der-elemente instead of meister-der-elemente.local).

Root cause

A Windows-edited .ddev/config.yaml carries CRLF line endings. The awk
list parser in _ddev_hosts_yaml_list kept the \r on block-list items,
so an additional_hostnames entry came out as name\r.local:

  • Garbled display: the terminal executes the \r mid-line — the
    .local tail is printed at column 0 and overwrites the line start
    ( ⚠ hosts.localosts, add:.localdd:). The tld was
    appended correctly all along; it just jumped visually.
  • Eternal "missing": the hosts-file grep pattern became
    name\r.local(...) and never matched — a hostname stayed "missing"
    forever even after the user added it.

name: / project_tld: were unaffected (their sed pipeline runs
tr -d '[:space:]'), which is why the primary URL always showed clean.

Fix

Strip \r per record in the awk parser of ddev-hosts.sh (one-line CRLF
guard). Fixes status output, the ddev() hook hint, opk ddev-hosts-check
and opk ddev-hosts-add argument passing in one place.

Tests

  • CRLF config.yaml yields clean hostnames (exact-match + no-CR-byte check)
  • CRLF-parsed hostnames match clean and CRLF Windows hosts entries
  • make test and make lint green; e2e unaffected (LF fixtures)

Also bumps VERSION to 0.0.28.

Fixes #46

A Windows-edited .ddev/config.yaml carries \r line endings; block-list
items (additional_hostnames/additional_fqdns) kept theirs, so a hostname
came out as "name\r.tld": the terminal renders the .local tail at
column 0 (".localosts (win)", ".localdd:") and the hosts-file grep
never matches — an added hostname stayed "missing" forever. Strip \r
per record in the awk list parser; regression tests cover list output
and missing detection against clean and CRLF hosts files.

@steffenmaechtel steffenmaechtel left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@steffenmaechtel
steffenmaechtel merged commit b5d9aec into master Sep 2, 2026
3 checks passed
@steffenmaechtel
steffenmaechtel deleted the feature/issue-46 branch September 2, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ddev missing host output text flows into each other.

1 participant