Subject: Pine 3.92 and user root : update .pinerc ? bug ?

From: [email-masked] (Christophe Caron)
Date: 22 Mar 1996 13:24:04 GMT

Hi,

On  HP/UX and Solaris 2.4 with pine 3.92

when user root uses pine , i have 
[Error saving configuration in file "/.pinerc": No such file or directory]

when pine try to update /.pinerc.

I have try to  create a null file /.pinerc or to copy my .pinerc under /
, without any success.

Whith chmod 666 on /.pinerc it's the same.

Any idea 
Thanks in advance

-- 

=========================================================
= Christophe Caron	Unite Informatique de Jouy	=
= I.N.R.A.		Domaine de Vilvert		=
= 78352 Jouy-en-Josas	email : [email-masked]	=
=========================================================

---

From: Steve Hubert <[email-masked]>
Date: Mon, 25 Mar 1996 14:47:37 -0800 (PST)

Yes, this is a bug.  I've attached a context diff for those who'd like to
fix it in the source, and, of course, it will be fixed in 3.93.  The
bug doesn't happen on all systems, so if you haven't seen it, don't
worry about fixing it.  Thanks for bringing it to our attention.

Steve Hubert <[email-masked]>
Networks and Distributed Computing, Univ. of Washington, Seattle

> when pine try to update /.pinerc.
*** tempnam.dist	Mon Mar 25 14:41:18 1996
--- tempnam.new	Mon Mar 25 14:41:43 1996
***************
*** 113,119 ****
  	for (start = ++trv; trv > as && *trv != '/'; --trv);
  	if (*trv == '/') {
  		*trv = '\0';
! 		if (stat(as, &sbuf) || !(sbuf.st_mode & S_IFDIR))
  			return(0);
  		*trv = '/';
  	}
--- 113,120 ----
  	for (start = ++trv; trv > as && *trv != '/'; --trv);
  	if (*trv == '/') {
  		*trv = '\0';
! 		if (stat(as==trv ? "/" : as, &sbuf)
! 		    || !(sbuf.st_mode & S_IFDIR))
  			return(0);
  		*trv = '/';
  	}

---

From: kremžská HOŘČICE <[email-masked]>
Date: Tue, 26 Mar 1996 06:54:36 +0200

On 25 Mar 1996, Steve Hubert wrote:

> fix it in the source, and, of course, it will be fixed in 3.93.

    I have applied this patch and recompiled the binary for SGI IRIX5.3,
and this is available, with PGP signature, from...
ftp://ftp.radio.cz/mail/pine/unix-bin/pine-bin.sgi         or compressed,
ftp://ftp.radio.cz/mail/pine/unix-bin-compressed/pine-bin.sgi.gz   or ....Z
...in case anyone has need to run this particular bugfix on their SGI.

PGP public key can be found with finger [email-masked] .

Barry Bouwsma, Radio PraHAW!! HAW!@! HAW!1! I GET IT!!@@!@

---

From: [email-masked] (Kjell Hvgstrvm)
Date: 24 Mar 1996 11:49:05 GMT

In article <[email-masked]>,
Bernard MERLANT <[email-masked]> wrote:
>Christophe Caron ([email-masked]) wrote:
>
>: Hi,
>: On  HP/UX and Solaris 2.4 with pine 3.92
>: when user root uses pine , i have 
>: [Error saving configuration in file "/.pinerc": No such file or directory]
>
> I have the same behaviour on my system ( HP/UX 9.03 )

It's a problem with creating the name for the temporary file which is
used to for the new .pinerc before changing the name. The problem is in
_gettemp (pine/osdep/tempnam) and after a build placed in pine/os.c.

Pine generates a temporary file name like "/home/user/pinercXXXXXX"
there the X's gets replaced by the process ID.  In the code part below
"as" is the temporary name under construction and "trv" is a pointer in
that string placed just before the X which at this point is replaced
with PID. This code is part of a check to see if the directory is
writable.  This routine stats "/home/user" in the example above which
is ok, but if you are root (have / as home directory), the temporary
file will be "/pinercXXXXXX", which gives a stat on "", which is not
ok

        /*
         * check for write permission on target directory; if you have
         * six X's and you can't write the directory, this will run for
         * a *very* long time.
         */
        for (start = ++trv; trv > as && *trv != '/'; --trv);
        if (*trv == '/') {
                *trv = '\0';
                if (stat(as, &sbuf) || !(sbuf.st_mode & S_IFDIR))
                        return(0);
                *trv = '/';
        }
 
I have not tested this carefully but I think it will solve the
problem:

*** tempnam.orig        Sun Mar 24 12:41:03 1996
--- tempnam     Sun Mar 24 12:43:13 1996
***************
*** 112,117 ****
--- 112,119 ----
         */
        for (start = ++trv; trv > as && *trv != '/'; --trv);
        if (*trv == '/') {
+                 if (as == trv)
+                         trv++;
                *trv = '\0';
                if (stat(as, &sbuf) || !(sbuf.st_mode & S_IFDIR))
                        return(0);

/Kjell