[OpenAFS] weird behaviour of pts source

Andrew Deason zeroguy@verizon.net
Fri, 10 Aug 2007 21:35:51 -0400


This is a multi-part message in MIME format.

--Multipart=_Fri__10_Aug_2007_21_35_51_-0400_d3G88RoUh3Z8/2lA
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Fri, 10 Aug 2007 19:48:43 -0500
"Christopher D. Clausen" <cclausen@acm.org> wrote:

> Jason Edgecombe <jason@rampaginggeek.com> wrote:
> > Hi,
> >
> > I compiled 1.4.4 on Mac OS X ppc Tiger with the supergroups option.
> > I seem to be getting weird behaviour from pts source. It seems to be
> > acting just like pts interactive. Am I doing something wrong?
> >
> > Here is a log:
> > ### I logged into afs as a regular user.
> > %cat /tmp/commands.txt
> > examine admin
> > quit
> > %./pts source -file /tmp/commands.txt
> > pts> quit
> > %./pts in < /tmp/commands.txt
> > Name: admin, id: 1, owner: system:administrators, creator:
> > anonymous, membership: 2, flags: S----, group quota: 20.
> > %
> >
> > Can someone shed some light on this? Does my ptserver have to be
> > compiled with supergroups in order for pts source to work? I
> > stumbled over this while trying out the command so that I could
> > write the man page for it.
> 
> I can confirm this behavior on 1.4.2 and 1.4.4 on i386_linux26.  My 
> ptservers have supergroups enabled.
> 
> The command doesn't seem to exist in the Windows pts binaries.

Appears to be a bug in pts.c. `source' is set to stdin after
cmd_Dispatch is run, blowing away any file specified on the command
line. Looks like it's just supposed to be a default, and moving it up
four lines does indeed produce the expected output.

A diff against CVS HEAD is attached. Works on my i386_linux26 box.

Bcc'd to openafs-bugs

-- 
Andrew Deason
zeroguy@verizon.net

--Multipart=_Fri__10_Aug_2007_21_35_51_-0400_d3G88RoUh3Z8/2lA
Content-Type: text/x-diff;
 name="openafs-pts-source-stdin.patch"
Content-Disposition: attachment;
 filename="openafs-pts-source-stdin.patch"
Content-Transfer-Encoding: 7bit

Index: src/ptserver/pts.c
===================================================================
RCS file: /cvs/openafs/src/ptserver/pts.c,v
retrieving revision 1.16
diff -u -r1.16 pts.c
--- src/ptserver/pts.c	10 Apr 2007 18:36:23 -0000	1.16
+++ src/ptserver/pts.c	11 Aug 2007 01:32:00 -0000
@@ -1162,11 +1162,11 @@
 
 #if defined(SUPERGROUPS)
     finished = 1;
+    source = stdin;
     if (code = cmd_Dispatch(argc, argv)) {
 	CleanUp(NULL, NULL);
 	exit(1);
     }
-    source = stdin;
     while (!finished) {
 	if (isatty(fileno(source)))
 	    fprintf(stderr, "pts> ");

--Multipart=_Fri__10_Aug_2007_21_35_51_-0400_d3G88RoUh3Z8/2lA--