unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Wolfgang Jaehrling <pro-linux@gmx.de>
Cc: guile-devel@gnu.org
Subject: Re: gethostname max len
Date: Mon, 22 Mar 2004 02:34:14 +0100	[thread overview]
Message-ID: <20040322013414.GB235@gmx.de> (raw)
In-Reply-To: <87fzc1n16o.fsf@zip.com.au>

On Mon, Mar 22, 2004 at 11:02:55AM +1000, Kevin Ryde wrote:
> Wolfgang Jaehrling <pro-linux@gmx.de> writes:
> > Which is what Guile probably also should do, otherwise it won't work
> > correctly on the GNU system, which has no limit on the length of host
> > names;
> 
> Oh, is that how the -1 is to be understood?  Nosing around the glibc
> sources it looked only like it didn't have an implementation for
> HOST_NAME_MAX yet.

The GNU system deliberately defines no such limits, following the
spirit of the GNU coding standards, which say (node "Semantics"):

  "Avoid arbitrary limits on the length of _any_ data structure,
  including file names, lines, files, and symbols, by allocating all
  data structures dynamically.  In most Unix utilities, "long lines
  are silently truncated."  This is not acceptable in a GNU utility."

I'm personally quite happy if programs at least try to use constants
like PATH_MAX, so that we can find these places and fix them.  I
really don't want to know how many programs just use arrays of size
1024 for file names.  There are even manual pages out there (like
realpath(3) on my GNU/Linux system) that contain examples like:

  #ifdef PATH_MAX
    path_max = PATH_MAX;
  #else
    path_max = pathconf (path, _PC_PATH_MAX);
    if (path_max <= 0)
      path_max = 4096;
  #endif

which tries to do the right thing, but ends up doing nonsense on the
GNU system (as pathconf() behaves like sysconf(), returning -1 to
indicate the absence of any limit).  Though I have to admit that doing
the right thing in a portable way is probably more work than it should
be.  But that's what you get for using C instead of Scheme. :-)

Cheers,
Wolfgang

-- 
Repeating false statements makes them true.
Repeating false statements makes them true.
Repeating false statements makes them true.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2004-03-22  1:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-21 22:22 gethostname max len Kevin Ryde
2004-03-22  1:05 ` Wolfgang Jaehrling
2004-03-22  1:02   ` Kevin Ryde
2004-03-22  1:34     ` Wolfgang Jaehrling [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-26 14:47 Nelson H. F. Beebe
2004-03-27 22:48 ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040322013414.GB235@gmx.de \
    --to=pro-linux@gmx.de \
    --cc=guile-devel@gnu.org \
    --cc=wolfgang@pro-linux.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).