From owner-freebsd-bugs Sat Mar 16 23:20:04 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA27232 for bugs-outgoing; Sat, 16 Mar 1996 23:20:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA27222 Sat, 16 Mar 1996 23:20:02 -0800 (PST) Resent-Date: Sat, 16 Mar 1996 23:20:02 -0800 (PST) Date: Sat, 16 Mar 1996 23:20:02 -0800 (PST) From: GNU GNATS Resent-Message-Id: <199603170720.XAA27222@freefall.freebsd.org> Message-Id: <199603170720.XAA27222@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, Received:"from perki.connect.com.au (perki.connect.com.au [192.189.54.5]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id XAA26739 for" ; Sat, 16 Mar 1996 23:11:08.-0800 (PST) Received: (from uucp@localhost) by perki.connect.com.au id SAA17771 (8.6.12/IDA-1.6 for FreeBSD-gnats-submit@freebsd.org); Sun, 17 Mar 1996 18:11:04 +1100 Subject: bin/1084: gethostname.pl returns trailing \0 character To: undisclosed-recipients:; Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1084 >Category: bin >Synopsis: gethostname.pl returns trailing \0 character >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 16 23:20:01 PST 1996 >Last-Modified: >Originator: Giles Lean >Organization: Giles Lean Nemeton Pty Ltd phone: +61 3 480 2118 >Release: -current (since the introduction of gethostname.pl) >Environment: FreeBSD-2.1.0 with gethostname.pl brought in from -current. >Description: The gethostname.pl library is a good idea, but it doesn't trim the trailing \0 character. The perl5 module Sys::Hostname does trim the \0. >How-To-Repeat: perl -e "require \"gethostname.pl\"; print &gethostname'gethostname" | od -c >Fix: Apply the following diff: *** gethostname.pl-old Sun Mar 17 17:21:54 1996 --- gethostname.pl Sun Mar 17 17:22:03 1996 *************** *** 31,37 **** die "Cannot get hostname via sysctl(2), errno = $!\n"; ($len) = unpack("L", $oldlen); ! return substr($oldval, 0, $len); } 1; --- 31,37 ---- die "Cannot get hostname via sysctl(2), errno = $!\n"; ($len) = unpack("L", $oldlen); ! return substr($oldval, 0, $len - 1); } 1; >Audit-Trail: >Unformatted: >Received: from topaz.nemeton.com.au (topaz.nemeton.com.au [203.8.3.18]) by nemeton.com.au (8.6.12/8.6.9) with ESMTP id RAA23390; Sun, 17 Mar 1996 17:26:40 +1100 Received: from topaz.nemeton.com.au (topaz.nemeton.com.au [203.8.3.18]) by nemeton.com.au (8.6.12/8.6.9) with ESMTP id RAA23390; Sun, 17 Mar 1996 17:26:40 +1100 Received: (from giles@localhost) by topaz.nemeton.com.au (8.6.12/8.6.12) id RAA16017; Sun, 17 Mar 1996 17:23:17 +1100 Date: Sun, 17 Mar 1996 17:23:17 +1100 From: Giles Lean Message-Id: <199603170623.RAA16017@topaz.nemeton.com.au> To: FreeBSD-gnats-submit@freebsd.org cc: giles@nemeton.com.au Subject: gethostname.pl returns trailing \0 character Reply-To: giles@topaz.nemeton.com.au X-send-pr-version: 3.2 Content-Type: text