Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: truncate Message-ID: <9023@jpl-devvax.JPL.NASA.GOV> Date: 6 Aug 90 17:42:51 GMT References: <46447@brunix.UUCP> <8977@jpl-devvax.JPL.NASA.GOV> <1990Aug4.154852.6468@robobar.co.uk> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 70 In article <1990Aug4.154852.6468@robobar.co.uk> ronald@robobar.co.uk (Ronald S H Khoo) writes: : In article <8977@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: : : >: Is it possible to truncate an open file in perl? (like truncate(2)). : > : >It will be after the next patch, if your machine supports it. : : I hope you won't forget those of us who pronounce "ftruncate" as : "chsize" and have to utter -lx to load it when hacking Configure ... Ok, it's in there, presuming chsize has the same arguments as ftruncate. You'll have utter -lx to Configure yourself. : BTW are you going to consider allowing limited setting of $< on systems : that don't set[re]uid as was suggested some time back ? I can't remember : who it was who suggested a nice way to hack that, but whoever you are, if you : did implement it, can you mail me your patch ? I'll buy you a few beers : at the next London Unix User Group meet you manage to attend :-) You'll be able to say $< = $> and $> = $<. The patch will look like this (This is not an offical patch!!! If you apply it, expect two rejected hunks on the next official patch!!!): *** /tmp/,RCSt1018459 Mon Aug 6 10:37:13 1990 --- stab.c Mon Aug 6 10:31:46 1990 *************** *************** *** 366,372 **** if (setreuid((UIDTYPE)uid, (UIDTYPE)-1) < 0) uid = (int)getuid(); #else ! fatal("setruid() not implemented"); #endif #endif break; --- 387,396 ---- if (setreuid((UIDTYPE)uid, (UIDTYPE)-1) < 0) uid = (int)getuid(); #else ! if (uid == euid) /* special case $< = $> */ ! setuid(uid); ! else ! fatal("setruid() not implemented"); #endif #endif break; *************** *** 386,392 **** if (setreuid((UIDTYPE)-1, (UIDTYPE)euid) < 0) euid = (int)geteuid(); #else ! fatal("seteuid() not implemented"); #endif #endif break; --- 410,419 ---- if (setreuid((UIDTYPE)-1, (UIDTYPE)euid) < 0) euid = (int)geteuid(); #else ! if (euid == uid) /* special case $> = $< */ ! setuid(euid); ! else ! fatal("seteuid() not implemented"); #endif #endif break; Can I trade the beers for airfare? :-) Larry