bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] [GNU tar 1.28] testsuite: 163 165 failed


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] [GNU tar 1.28] testsuite: 163 165 failed
Date: Wed, 11 Nov 2015 10:17:48 +0200

Hi Gianfranco,

I was able to reproduce the bug on FreeBSD.  It turns out that on that
system the unlinkat call fails if the pathname argument is a relative
file name (starting with "../") and the fd argument refers to a
directory that has been removed after openat.

Unfortunately I have not got any Hurd box.  Can you please compile and
run the attached file on gnu/hurd?

Regards,
Sergey

#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <stdio.h>

#define TESTDIR "t"

int
main ()
{
  int fd;
  int mode = 0700;
  struct stat st;

  if (access (TESTDIR, F_OK) == 0)
    {
      fprintf (stderr,
               "the directory \"%s\" exists: please remove it and retry\n",
               TESTDIR);
      return 2;
    }
  assert (mkdir (TESTDIR, mode) == 0);
  assert (mkdir (TESTDIR "/a", mode) == 0);
  assert (mkdir (TESTDIR "/b", mode) == 0);
  fd = openat (AT_FDCWD, TESTDIR "/a", O_DIRECTORY);
  assert (fd >= 0);
  assert (unlinkat (AT_FDCWD, TESTDIR "/a", AT_REMOVEDIR) == 0);
  if (fstatat (fd, "../b", &st, 0))
    perror ("fstatat");
  if (unlinkat (fd, "../b", AT_REMOVEDIR))
    {
      perror ("unlinkat");
      return 1;
    }
  rmdir (TESTDIR);
  return 0;
}



reply via email to

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