tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Why doesn't NetBSD recognize my entries in /etc/hosts?



On 2015-09-18 04:29, Eric Haszlakiewicz wrote:
On 9/17/2015 1:32 PM, Ottavio Caruso wrote:
On 16 September 2015 at 23:13, Matt Sporleder <msporleder%gmail.com@localhost>
wrote:
Show us a sample hosts entry and the full output of your ping, please.
Ok, this is not necessary now.

For some reasons, I have redone the whole process today and the
entries were correctly redirected to 0.0.0.0 as expected.

There must have been a file corruption when downloading the file from:
http://winhelp2002.mvps.org/hosts.txt

The first time I just downloaded it with wget.

Now I have selected all text and copied it into leafpad, then moved it
to /etc/hosts.

There might have been some extra line feed that could have prevented
the file from being parsed correctly.
Yep, there definitely are carriage returns (not line feeds), but it's
not file corruption, it's just a MS Windows style text file.
If you open it in vi you'll clearly see all the "^M"'s at the end of
each line.

Assuming you'll want to fetch an updated copy of that file in the
future, you can automatically trim those off with something like this:
ftp -o - http://winhelp2002.mvps.org/hosts.txt | tr -d '\r' > hosts.txt

(wget should work too, but NetBSD's ftp does what you need without any
extra packages)

Hum. That's what *text* mode in ftp is there for... :-)
The various conventions on how text files indicate newlines in different operating systems should not carry across. Someone running ftp in binary mode when they shouldn't? :-)

	Johnny



Home | Main Index | Thread Index | Old Index