[comp.unix.questions] Long /etc/group

wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) (03/05/91)

I have a long group in my /etc/group file, with over 512 caracters in the
line. Editor ed does not support longer lines, but I can continue to
extend the line with vi. 

So my question: is there any limit for the system in the length of a
/etc/group entry? Is yes, how long, and how could I solve this? Create
a second entry for the same group? or... ?

-- 
Christophe Wolfhugel (on irc: Zolf)   |  Email: wolf@grasp1.univ-lyon1.fr
INSA Lyon - Departement Informatique  |  IRC'admin at node grasp1.univ-lyon1.fr
69621 Villeurbanne Cedex, France      |  Fax: (+33) 72 44 08 00

frechett@spot.Colorado.EDU (-=Runaway Daemon=-) (03/06/91)

In article <26192@adm.brl.mil> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes:
|>I have a long group in my /etc/group file, with over 512 caracters in the
|>line. Editor ed does not support longer lines, but I can continue to
|>extend the line with vi. 
|>
|>So my question: is there any limit for the system in the length of a
|>/etc/group entry? Is yes, how long, and how could I solve this? Create
|>a second entry for the same group? or... ?
I don't know if anything relating to the use of the /etc/group file is going to
object but you will find that since vi is a "visual" editor it gets really 
upset if you try to edit a line that won't fit on the screen.  I have done it
before and it is quite a mess.  It resulted in numerous core dumpings and such.
The way to get around this at that point is to make a little perl script
because as we all know by now, perl can do anything. ;)  Actually, it is just
that perl care how long a single line is and in many cases it is benficail to
turn a whole file into one line so that perl can do something special to it.

|>
|>-- 
|>Christophe Wolfhugel (on irc: Zolf)   |  Email: wolf@grasp1.univ-lyon1.fr
|>INSA Lyon - Departement Informatique  |  IRC'admin at node grasp1.univ-lyon1.fr
|>69621 Villeurbanne Cedex, France      |  Fax: (+33) 72 44 08 00

	ian
--
Ian Frechette *UNIXOPS* University of Colorado at Boulder

tchrist@convex.COM (Tom Christiansen) (03/07/91)

From the keyboard of frechett@spot.Colorado.EDU (-=Runaway Daemon=-):
:In article <26192@adm.brl.mil> wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes:
:|>I have a long group in my /etc/group file, with over 512 caracters in the
:|>line. Editor ed does not support longer lines, but I can continue to
:|>extend the line with vi. 
:|>
:|>So my question: is there any limit for the system in the length of a
:|>/etc/group entry? Is yes, how long, and how could I solve this? Create
:|>a second entry for the same group? or... ?
:I don't know if anything relating to the use of the /etc/group file is going to
:object but you will find that since vi is a "visual" editor it gets really 
:upset if you try to edit a line that won't fit on the screen.  I have done it
:before and it is quite a mess.  It resulted in numerous core dumpings and such.

Well, I never got coredumps, but I did have some problems. This is
one of those constants I added a zero (order of magnitude) to in 
my copy of vi.  I can now handle 16k lines.  Again, a stupid
way to do things, but easier than making it infinit.

You've a bigger problem with long groups though:
YP's brain-dead 1k dbm-enforced data limit.

:The way to get around this at that point is to make a little perl script
:because as we all know by now, perl can do anything. ;)  Actually, it is just
:that perl care how long a single line is and in many cases it is benficail to
:turn a whole file into one line so that perl can do something special to it.

You mean perl DOESN'T care.  But yes, I've done that to.

--tom
--
	I get so tired of utilities with arbitrary, undocumented,
	compiled-in limits.  Don't you?

Tom Christiansen		tchrist@convex.com	convex!tchrist

jik@athena.mit.edu (Jonathan I. Kamens) (03/07/91)

In article <26192@adm.brl.mil>, wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel) writes:
|> So my question: is there any limit for the system in the length of a
|> /etc/group entry? Is yes, how long, and how could I solve this? Create
|> a second entry for the same group? or... ?

  Well, the code I'm looking at right now uses a buffer of length BUFSIZ to
hold each line in the /etc/group file.  So yes, there is a limit on most
systems, and it's probably going to be 512 or 1024 characters.

  The 4.3reno code also appears to have a limit -- 1024 characters.  It
explicily discards anything after that many characters on a line (the older
routines simply assume that everything is less than the maximum line length,
so they get very confused when a line is too long).

  I don't know of any way to solve this, other than not having groups with
that many people in them :-).

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

nto0302@dsacg3.dsac.dla.mil (Bob Fisher) (03/07/91)

From article <26192@adm.brl.mil>, by wolf@grasp1.univ-lyon1.fr (Christophe Wolfhugel):
> I have a long group in my /etc/group file, with over 512 caracters in the
> line. Editor ed does not support longer lines, but I can continue to
> extend the line with vi. 
> 
> So my question: is there any limit for the system in the length of a
> /etc/group entry? Is yes, how long, and how could I solve this? Create
> a second entry for the same group? or... ?

This may be dependent on your flavor of UNIX.  On our BSD 4.3 system,
the system reads a single buffer of 1023 bytes.  No way to have a
continuation record.  Also, if we used a program to build a record longer
than 1023, the record was truncated and the next record trashed.

Our work-around for this was to create a another group with the same
group number but a different name.

		users:*:123:user1,user2,...usern
		users2:*:123:usern+1,....

Since privileges are based on GID, this seems to work well.  We have
had no problems with this and can have any number of users able to
be associated with a single GID.
-- 
Bob Fisher
US Defense Logistics Agency Systems Automation Center
DSAC-TOL, Box 1605, Columbus, OH 43216-5002     614-238-9071 (AV 850-9071)
bfisher@dsac.dla.mil		osu-cis!dsacg1!bfisher