bug-coreutils
[Top][All Lists]
Advanced

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

Re: Problem with Hostname


From: Benjamin Monjoie
Subject: Re: Problem with Hostname
Date: Sat, 11 Jul 2009 16:39:08 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

   Bob Proulx a écrit :

Benjamin Monjoie wrote:
  

   I'm having an issue with hostname and "hostname --help" told me to report
   anomalies to this e-mail address so here i am.
    

You have reached the home of GNU hostname.  But that probably isn't
the same hostname as on your Ubuntu system.
  

   Thank you for your quick reply.

  

   My problem is that hostname does not accept options anymore.
...
   I'm running Ubuntu 9.04 and it's up to date. My hostname version
   is 2.95 and my coreutils version is 6.10-6ubuntu1.
    

The hostname command is a little bit of a problem.  It isn't covered
by any of the standards.  It was introduced by BSD and so the BSD
version would be the most authoritative.  But there are variations.
And *BSD systems have modified it over the years.

The GNU hostname command is a very traditional command.  The
traditional Unix hostname doesn't take any options.  If an program
argument is provided it *sets* the hostname to that argument.  Meaning
that on a traditional Unix system running "hostname -f" will set the
hostname to "-f"!  That is the way that it has always been.  The GNU
version at least produces a warning that it is a invalid option.

But there is a different hostname command that some GNU/Linux
distributions have been using.  This command takes several options one
of which is the -f option.  This command that accepts the -f option is
*not* the GNU hostname command.  It is usually in its own 'hostname'
package.  You say that your version of hostname is 2.95 and if so then
that is the *other* hostname that is not the one from GNU coreutils.
Normally you would probably not be using the GNU hostname but would
instead be using that other one.

Did you recently compile coreutils from source and perhaps install a
local GNU Coreutils hostname binary that is now overriding the one
provided by your system?
  

   I don't think so. The only thing i've done recently was to add a repository
   for VLC and it didn't contain coreutils or hostname. By the way, I removed
   this repository and reinstall the official coreutils and hostname (sudo
   apt-get install --reinstall)

What is the output of these commands?

  type -a hostname

  hostname --version

  dpkg -l hostname

  dpkg -L hostname | grep bin/hostname
  

address@hidden:~]$ type -a hostname
hostname is /usr/local/bin/hostname
hostname is /bin/hostname

address@hidden:~]$   hostname --version
hostname (GNU coreutils) 6.9
Copyright © 2007 Free Software Foundation, Inc.
Ce programme est un logiciel libre. Vous pouvez en redistribuer des copies
selon les termes de la License Publique Générale de GNU, 
[1]<http://www.gnu.org/licenses/gpl.html>.
AUCUNE GARANTIE n'est fournie tel que permis selon la loi.
Écrit par Jim Meyering.

address@hidden:~]$   dpkg -l hostname
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| 
État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=att
end-traitement-déclenchements
|/ Err?=(aucune)/H=à garder/besoin Réinstallation/X=les deux (État,Err: 
majuscu
le=mauvais)
||/ Nom            Version        Description
+++-==============-==============-============================================
ii  hostname       2.95           utility to set/show the host name or domain
address@hidden:~]$   dpkg -L hostname | grep bin/hostname
/bin/hostname

I am expecting/hoping to see /bin/hostname is the _other_ hostname in
the system's hostname package and a /usr/local/bin/hostname that you
perhaps (?) just installed from a source compile of GNU Coreutils.

Please don't forget to reply-to-all to keep the bug-coreutils mailing
list in your follow-ups.

Bob

   I don't think i've installed the other hostname. It's probably my mistake
   but i don't see from where it came. But I've tried the following :
address@hidden:~]$ sudo mv /usr/local/bin/hostname{,.bak}
[sudo] password for benjamin:
address@hidden:~]$ hostname -f
bash: /usr/local/bin/hostname: Aucun fichier ou dossier de ce type
address@hidden:~]$ sudo ln -s /bin/hostname /usr/local/bin/hostname

address@hidden:~]$ hostname -f
localhost

   And it works. Although, it's not a very clean solution so if you have a
   better one, i'm interested.
   Thank you very much.

References

   1. http://www.gnu.org/licenses/gpl.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]