Debian bug report logs - #1094 Problem in reading the host name from file Package: hostname ; Reported by: sr1@irz301.inf.tu-dresden.de (Sven Rudolph); 111 days old . ----------------------------------------------------------------------- Message received at debian-bugs: From irz301.inf.tu-dresden.de!sr1 Wed Jul 12 09:08:04 1995 Return-Path: Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0sW4KS-00063ZC; Wed, 12 Jul 95 09:08 PDT Received: from irz301.inf.tu-dresden.de by pixar.com with SMTP id AA01979 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Wed, 12 Jul 1995 09:06:27 -0700 Received: by irz301.inf.tu-dresden.de (5.67b+/DEC-Ultrix/4.3) id AA09668; Wed, 12 Jul 1995 18:07:45 +0200 Date: Wed, 12 Jul 1995 18:07:45 +0200 From: sr1@irz301.inf.tu-dresden.de (Sven Rudolph) Message-Id: <199507121607.AA09668@irz301.inf.tu-dresden.de> To: debian-bugs@pixar.com Subject: Problem in reading the host name from file Package: hostname Version: 1.6-2 (I didn't find a non-debian maintainer for this program, therefore I report the bug here. Please forward this if necessary.) When I invoke 'hostname --file /etc/hostname' and the host name in /etc/hostname is not trerminated with '\n' , the hostname will not be set. System information : - Debian 0.93R5 - Linux 1.2.8, i386 How to repeat the bug: # hostname '' # hostname # od -ax /etc/hostname 0000000 i r s 2 1 2 7269 3273 3231 0000006 # hostname --file /etc/hostname # hostname # editing /etc/hostname ... # od -ax /etc/hostname 0000000 i r s 2 1 2 nl nul 7269 3273 3231 000a 0000007 # hostname --file /etc/hostname # hostname irs212 # How to fix the bug: *** hostname.c.original Sun Feb 5 17:14:18 1995 --- hostname.c Sun Feb 5 17:16:09 1995 *************** *** 146,158 **** char fline[MAXHOSTNAMELEN]; if ((fd = fopen(optarg, "r")) != NULL) { ! while (fgets(fline, sizeof(fline), fd) != NULL) if ((p = index(fline, '\n')) != NULL) { *p = '\0'; - if (fline[0] == '#') - continue; - sethname(fline); } (void) fclose(fd); } else { fprintf(stderr,"%s: can't open `%s'\n", --- 146,159 ---- char fline[MAXHOSTNAMELEN]; if ((fd = fopen(optarg, "r")) != NULL) { ! while (fgets(fline, sizeof(fline), fd) != NULL) { if ((p = index(fline, '\n')) != NULL) { *p = '\0'; } + if (fline[0] == '#') + continue; + sethname(fline); + } (void) fclose(fd); } else { fprintf(stderr,"%s: can't open `%s'\n", Sven -- Sven Rudolph (sr1@inf.tu-dresden.de); WWW : http://www.sax.de/~sr1/ ----------------------------------------------------------------------- Acknowledgement sent to sr1@irz301.inf.tu-dresden.de (Sven Rudolph) : New bug report received and forwarded. Full text available. ----------------------------------------------------------------------- Report forwarded to debian-devel@pixar.com : Bug#1094 ; Package hostname . Full text available. ----------------------------------------------------------------------- Ian Jackson / iwj10@thor.cam.ac.uk , with the debian-bugs tracking mechanism This page last modified 07:43:01 GMT Wed 01 Nov