bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ia64 GNU/Linux pwd-long test failure in CVS coreutils


From: Jim Meyering
Subject: Re: ia64 GNU/Linux pwd-long test failure in CVS coreutils
Date: Sun, 18 Jun 2006 15:12:57 +0200

address@hidden (Bob Proulx) wrote:
> Trying to build today's CVS version of coreutils on an ia64 machine
> running Debian GNU/Linux Sarge/stable I get the following assertion
> failure from pwd-long.  This is using Debian's stock stable release of
> glibc 2.3.2 and gcc 3.3.5 running a linux 2.6.12 kernel.
...
> pwd: ../sysdeps/unix/sysv/linux/getcwd.c:130: __getcwd: Assertion 
> `__libc_errno != 34 || buf != ((void *)0) || size != 0' failed.
> pwd-long: 
> /usr/local/build-coreutils/ia64-gnu-linux-coreutils/build/tests/misc/pwd-long.tmp/16565/zzzzzzzz
>
> FAIL: pwd-long

Hi Bob!

As noted, this is due to a bug in glibc on at least ia64,
so I've gone ahead and written a new run test to detect it.
Bob, would you please compile and run this and tell me what
it does on your ia64 system?

I expect it to abort and leave behind the deep tree.
If that's what it does, then I'll change all exit calls to
always exit 0, and just let the abort trigger the test failure.

#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>

/* Don't get link errors because mkdir is redefined to rpl_mkdir.  */
#undef mkdir

#ifndef S_IRWXU
# define S_IRWXU 0700
#endif

int
main ()
{
  size_t buf_len = 16 * 1024;
  char const *dir_name = "confdir-14B---";
  char *buf;
  char *cwd;
  size_t initial_cwd_len;
  int fail = 0;
  size_t desired_depth;
  size_t d;

  buf = malloc (buf_len);
  if (buf == NULL)
    exit (1);

  cwd = getcwd (buf, buf_len);
  if (cwd == NULL)
    exit (2);

  initial_cwd_len = strlen (cwd);
  desired_depth = ((buf_len - 1 - initial_cwd_len) / (1 + strlen (dir_name)));
  for (d = 0; d < desired_depth; d++)
    {
      if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0)
        {
          fail = 3; /* Unable to construct deep hierarchy.  */
          break;
        }
    }

  cwd = getcwd (buf, buf_len);
  if (cwd == NULL)
    fail = 4; /* getcwd failed.  This is ok, and expected.  */
  free (buf);

  /* Call rmdir first, in case the above chdir failed.  */
  rmdir (dir_name);
  while (0 < d--)
    {
      if (chdir ("..") < 0)
        break;
      rmdir (dir_name);
    }

  exit (fail);
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]