This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Directory named "." created at /: seems to have happened during update


On Mar  1 14:05, Corinna Vinschen wrote:
> On Mar  1 13:11, Corinna Vinschen wrote:
> > On Mar  1 13:05, Corinna Vinschen wrote:
> > > On Mar  1 12:32, Corinna Vinschen wrote:
> > > > On Mar  1 11:08, Fergus wrote:
> > > > > My Cygwin [1.7] is located at the root of a mobile hard drive and a
> > > > > simple DOS dir command now shows a directory named . as in
> > > > > [...]
> > > > 
> > > > Oh boy.  I didn't even know that NT allows that.
> > > > 
> > > > That's two bugs in one.  The lilypond package has paths with leading
> > > > "./" in it, and setup.exe does not recognize that and remove the dot
> > > > path.
> > > > 
> > > > For now I have removed the latest lilypond package from the distro.
> > > > Jan, can you please fix your package not to have leading ./ in the path?
> > > > 
> > > > As for setup.exe, I have to have a look how to avoid that.
> > > 
> > > The problem is, I can't reproduce it.  I created two test packages,
> > > one with a file "./file" in it, the other with a file "tmp/./file".
> > > In both cases, setup.exe failed to create the file and showed a
> > > message "unable to extract ...".
> > > 
> > > This was on Windows 7.  What Windows are you using?  Maybe an older
> > > version allows it.  Unless I can create the "." directory myself,
> > > I can't fix it.
> > 
> > On Windows XP I can't reproduce it either.  Hmm.
> 
> Are you sure the directory name is really "."?  Could you please have
> a look if the directory isn't called ". " with one or more trailing
> spaces?  Creating such directories is no problem and removing isn't
> a problem either:
> 
>   $ rmdir ". "

And, just for completeness, I tested to create a file and a directory
with the name ".", using the native NT function NtCreateFile(*), as
setup and Cygwin do.  Both tests resulted in the status code 0xC0000033,
STATUS_OBJECT_NAME_INVALID.  So I'm pretty sure the name of the
directory is not ".".  Alternatively, you have some software running
which installs a filesystem filter driver, and that filter driver
overrides or skips these sanity checks in the OS.


Corinna


(*)
==== SNIP ====
#include <windows.h>
#include <ntsecapi.h>
#include <ddk/ntifs.h>
#include <ddk/winddk.h>
#include <stdio.h>

#define FNAME L"\\??\\C:\\cygwin\\tmp\\dot\\."

int
main (int argc, char **argv)
{
  UNICODE_STRING fname;
  OBJECT_ATTRIBUTES attr;
  NTSTATUS stat;
  HANDLE fh;
  IO_STATUS_BLOCK io;

  printf ("Full NT path: %ls\n", FNAME);
  RtlInitUnicodeString (&fname, FNAME);
  InitializeObjectAttributes (&attr, &fname, OBJ_CASE_INSENSITIVE, NULL, NULL);
  stat = NtCreateFile (&fh, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE,
		       &attr, &io, NULL, 0, FILE_SHARE_VALID_FLAGS,
		       FILE_CREATE,
#if 0
		       FILE_DIRECTORY_FILE |
#else
		       FILE_NON_DIRECTORY_FILE |
#endif
		       FILE_SYNCHRONOUS_IO_NONALERT,
		       NULL, 0);
  if (!NT_SUCCESS (stat)) {
    printf ("Unable to create %ls, status = 0x%08X\n", FNAME, stat);
    return 1;
  }
  NtClose(fh);
  NtDeleteFile (&attr);
  return 0;
}
==== SNAP ====

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]