🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #1088

Changed names in POSIX directory access library

#1088
From: John Gilmore
Date: Sat, 08 Aug 1987 09:58
56 lines
3450 bytes
Cc: gwyn@brl.arpa, utzoo.UUCP!henry@cgl.ucsf.edu
From: gnu@hoptoad.UUCP (John Gilmore)

I just ran across the first use of the Posix directory access library
and was disappointed that it is not source-code compatible with the
Unix BSD library, or with the public domain directory access library
that has been widely used on non-BSD systems.

For some reason the ***&%^$ standard changed the names of the include
file and the struct!

The old #include <sys/dir.h>	is now	#include <dirent.h>
  "	struct direct			struct dirent

My problem arose when Richard Todd ported my PD tar to Minix.  This
tar program has been ported and run on many, many Unix variants.  All
these versions compile from the same sources.  Minix lacks a directory
access library (and a lot of other library routines), so Richard used
the package posted to mod.sources by Doug Gwyn.  Unfortunately, it's
not compatible with Unix, and I wouldn't change tar; I'd rather have it
break on Richard's modified Minix than break on every Unix in existence.
So his Minix tar sources must remain slightly different from the master,
portable sources I keep.

Somehow when you read these standards on paper, they don't mean much.
When people implement it and your 'proven portable' programs break, the
little meddling changes get a lot more important.

From the NOTES file in Doug's package:
>One annoying compatibility problem has arisen along the way, namely that the
>original Berkeley interface used the same name, struct direct, for the new data
>structure as had been used for the original UNIX filesystem directory record
>structure.  This name was changed by the IEEE 1003.1 (POSIX) Working Group to
>"struct dirent" and was picked up for SVR3 under the new name; it is also the
>name used in this portable package.  I believe it is necessary to bite the
>bullet and adopt the new non-conflicting name.  Code using a 4.2BSD-compatible
>package needs to be slightly revised to work with this new package...

Why POSIX changed it I'll probably never know, but it's clear why SVR3
adopted the change.  They have been resisting incorporating the
directory library for years and years, apparently because it was a good
idea.  When POSIX mangled it, AT&T jumped at the chance to adopt a
version incompatible with all the code written for BSD Unix.  So call
me a cynic.

No portable application program should be including a struct defining
the internal format of old Unix file system entries, so I can't see any
theoretical problem created by using the name "struct direct" for the
result of Posix readdir().  There is certainly no practical problem
with it either, since we have been doing it for the last 5 years.

I'm curious why Doug thinks "it is necessary to bite the bullet".  How about
the obvious alternative of changing the standard to match all existing
applications?

Volume-Number: Volume 12, Number 5
Technical Details
Message-ID: <842@uunet.UU.NET>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!std-unix

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!std-unix
From: gnu@hoptoad.UUCP (John Gilmore)
Newsgroups: comp.std.unix
Subject: Changed names in POSIX directory access library
Message-ID: <842@uunet.UU.NET>
Date: Sat, 8-Aug-87 05:58:30 EDT
Article-I.D.: uunet.842
Posted: Sat Aug  8 05:58:30 1987
Date-Received: Wed, 12-Aug-87 01:39:02 EDT
Sender: std-unix@uunet.UU.NET
Reply-To: gnu@hoptoad.UUCP (John Gilmore)
Lines: 56
Approved: jsq@uunet (Moderator, John Quarterman)