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: Odd, is it not? mkdir 'e:\' cannot be undone by rmdir 'e:\' ...


On Thu, 19 Sep 2019 18:04:47, Ken Brown  wrote:
> On 9/1/2019 1:38 PM, Houder wrote:
> > On Fri, 30 Aug 2019 11:54:27, Houder  wrote:
> 
> [...]
> 
> > As the directory "/foo" had been correctly created, I turned to
> > path_conv::check(), which is called when build_fhname() creates
> > the path_conv object (also called pc) -- see dtable.cc.
> >
> > Examining this (obsure) method in path.cc, I corrected the code
> > in 2 places:
> >
> > ---
> >        if (dev.isfs ())
> >          {
> >            //if (strncmp (path, "\\\\.\\", 4)) <==== 1171
> >            if ( ! strncmp (path, "\\\\.\\", 4)) // <==== [1]
> >              {
> >                if (!tail || tail == path)
> >                  /* nothing */;
> >                else if (tail[-1] != '\\')
> >                  *tail = '\0'; <==== Ah! (you should not do that!)
> >                else
> >                  {
> >                    error = ENOENT;
> >                    return;
> >                  }
> >              }
> >
> > [1] this code should be executed only if path == '\\.\' !!

Sorry Ken, for not being correct ... Of course, the statement above tests
whether or not the string *** starts with *** \\.\

> I don't agree with your analysis here.

Analysis of what? No Ken, I did not _analyze_ what this piece of code is
good for.

I only discovered that it "mutilates" the code if one exexutes

    mkdir /foo, where foo is a nonexisting directory

So, in general this piece of code should NOT be executed. And I doubt if
it is ever reached in case of a device path, like \\.\e: (did not check).

Btw, do not pay attention to the second correction (hack) that I made in
this method; I dropped it.

That said, my modifications to mkdir_2 and rmdir_2 are more relevant.

Currently, rmdir_2 is not in agreement with Posix (and Linux).

Currently I am running the modified code (including the above correction
in "path resolution" -- i.c. path_conv::check).

Found no problems. And my tests show that rmdir_2 is now in agreement w/
Posix (and Linux).

Oh sorry, mkdir_2 and rmdir_2 should be read as mkdir(2) and rmdir(2).

(the syscalls in dir.cc, not the functions in fhandler_disk_file.cc)

Henri


--
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]