This is the mail archive of the cygwin-patches@cygwin.com 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: [Patch]: mkdir -p and network drives


Pierre A. Humblet <pierre <at> phumblet.no-ip.org> writes:
> 
> Here is a patch to allow mkdir -p to easily work with network
> drives and to allow future enumeration of computers and of
> network drives by ls -l.
> 
> It works by defining a new FH_NETDRIVE virtual handler for
> names such as // and //machine.
> This also makes chdir work without additional change.

I've just downloaded the 20050508 snapshot to play with this, and it still 
needs some work before coreutils-5.3.0-6 can be released.  But it is an 
improvement!

First, `ls -ld // //machine' show that these directories are mode 111 
(searchable, but not readable).  Yet opendir("//") and opendir("//machine") 
succeed, although POSIX requires that opendir(2) fail with EACCESS if the 
directory to be opened is not readable.

Second, the sequence chdir("//"), mkdir("machine") creates machine in the 
current directory.

$ cd //eblake/share
$ ls
$ ~/coreutils-cvs/src/mkdir -p //eblake/share/dir
$ ls -F
dir/  eblake/  share/

A relevant portion of the strace is included below.  Basically, mkdir
("//machine") (or chdir("//"), mkdir("machine")) needs to fail with EEXIST 
(because it is always assumed that //machine already exists) or with EACCESS 
(because there is no write access in //), rather than create a directory by 
that name somewhere else.

   69 4745479 [main] mkdir 10204 chdir: dir '//'
   62 4745541 [main] mkdir 10204 normalize_posix_path: src //
   66 4745607 [main] mkdir 10204 normalize_posix_path: // = normalize_posix_path
 (//)
   62 4745669 [main] mkdir 10204 mount_info::conv_to_win32_path: conv_to_win32_p
ath (//)
   61 4745730 [main] mkdir 10204 set_flags: flags: binary (0x2)
   74 4745804 [main] mkdir 10204 mount_info::conv_to_win32_path: src_path //, ds
t \\, flags 0x2, rc 0
   77 4745881 [main] mkdir 10204 build_fh_pc: fh 0x61831710
   67 4745948 [main] mkdir 10204 chdir: 0 = chdir() cygheap->cwd.posix '//' nati
ve '\\'
   67 4746015 [main] mkdir 10204 normalize_posix_path: src eblake
   61 4746076 [main] mkdir 10204 cwdstuff::get: posix //
   60 4746136 [main] mkdir 10204 cwdstuff::get: (//) = cwdstuff::get (0x22EAC0, 
260, 1, 0), errno 2
  132 4746268 [main] mkdir 10204 normalize_posix_path: //eblake = normalize_posi
x_path (eblake)
   67 4746335 [main] mkdir 10204 mount_info::conv_to_win32_path: conv_to_win32_p
ath (//eblake)
   67 4746402 [main] mkdir 10204 set_flags: flags: binary (0x2)
   61 4746463 [main] mkdir 10204 mount_info::conv_to_win32_path: src_path //ebla
ke, dst \\eblake, flags 0x2, rc 0
   64 4746527 [main] mkdir 10204 build_fh_pc: fh 0x61831710
   68 4746595 [main] mkdir 10204 cwdstuff::get: posix //
   72 4746667 [main] mkdir 10204 cwdstuff::get: (\\) = cwdstuff::get (0x22E4E0, 
260, 0, 0), errno 2
 1561 4748228 [main] mkdir 10204 mkdir: 0 = mkdir (eblake, 511)



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