scsh-users
[Top] [All Lists]

Re: bug in cwd? (follow-up)

To: scsh@martigny.ai.mit.edu
Subject: Re: bug in cwd? (follow-up)
From: sjenkins@iastate.edu (Steven L Jenkins)
Date: 26 Jul 1996 15:39:42 GMT
Organization: Iowa State University, Ames, Iowa USA
This 'error' is intentional -- ie, testing what scsh does in the face
of a 'lost' directory.  Here's what I did:  create a directory tmp,
cd into it, rm -r ../tmp, then the following little event below.  My
question is really "why does scsh not give a better error message, and
why does it produce a 'wrong' answer the second time I try it?".  FWIW,
the code for cwd is:

int scheme_cwd(const char **dirp)
{
  char *buf;
  int size = 100;

  buf = Malloc(char,size);
  if(!buf) goto lose;

  while( !getcwd(buf, size) )
    if( errno != ERANGE ) goto lose;
    else {
      /* Double the buf and retry. */
      char *nbuf = Realloc(char, buf, size += size);
      if( !nbuf ) goto lose;
      buf = nbuf;
    }

  *dirp = (const char*) buf;            /* win */
  return 0;

 lose:
  {int e = errno;
   Free(buf);
   *dirp = NULL;
   return e;}
}

Which *should* end up being a 'lose' (as the errno is not ERANGE, but
perhaps ENOTDIR, and especially not ETXTBSY).  In any case, it looks
like my OS (Ultrix 4.3) doesn't even set errno, so apparently it's a broken
getcwd() implementation..

Thanks to the several who responded..

In article <4t88es$s46@news.iastate.edu>,
Steven L Jenkins <sjenkins@iastate.edu> wrote:
>Rather than continue harrassing Olin mercilessly, I thought I'd give
>others a chance to answer this:
>
>vincent% pwd
>pwd: getwd: read error in ..
>vincent% scsh
>Scsh 0.4
>> (cwd)
>
>Error: 26
>       "Text file busy"
>       #{Procedure 8231 cwd}
>1> (cwd)
>"/afs/iastate.edu/project/vincent/experimental/sjenkins/scheme/mzscheme/mzscheme/dynsrc"
>1> 
>
>
>Eh?  What's going on here..



<Prev in Thread] Current Thread [Next in Thread>