Skip to content

The initial hosts file edit is destructive to commented out lines #3

@EHLOVader

Description

@EHLOVader

OS: Mac (Sonoma 14.4 (23E214))

Overview

If the user has used the hosts file in the past, and has commented out lines it will completely remove them.

Steps to reproduce

  1. Have an /etc/hosts file with sites that were commented out
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost

127.0.0.1 test.site

#127.0.0.1 inactive.site

  1. Open the Hosts Manager

  2. Save or change your hosts

Expected behavior

Because I had some sites, I thought it would append new or edits to the sites it did have alongside them, or it would have imported them in an inactive state.

Actual behavior

The hosts file was replaced with the new hosts file, which does contain wrappers on its managed content.

Resolution

I might expect it to append, or respect other possible applications that manipulate the hosts file. And after having it wipe out the contents of the existing file it would have been nice for it to have stashed a copy of it before taking control, either internally or alongside the hosts file.

It does seem to import active sites, so importing and recognizing other styles of commented lines to import other inactive sites might also resolve this.

I think it also wipes out any comments in the file, even if only for informational purposes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions