'errno' bug in cygwin+samba

Rolf Campbell Endlisnis@mailc.net
Sun Feb 8 23:13:00 GMT 2004


First of all, learn to include the correct headers, and to write valid 
C-code.  Here's what you meant to type.

#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main() {
   if(mkdir("test", 0777) < 0)
     perror("mkdir1");
   if(mkdir("test", 0777) < 0)
     perror("mkdir2");
   return 0;
}


2nd of all, I get:
mkdir2: File exists

3rd of all:
http://cygwin.com/problems.html


W.J. van der Laan wrote:
> Hello,
> 
> Today I stumbled on a really strange bug in Cygwin and Samba: errno 2 is
> returned when attempting to create a file or directory that already
> exists.
> 
> #include <stdlib.h>
> #include <unistd.h>
> void main() {
>         if(mkdir("test", 0777) < 0)
>                 perror("mkdir1");
>         if(mkdir("test", 0777) < 0)
>                 perror("mkdir2");
> }
> 
> Gives a  "mkdir2: No such file or directory." huh?
> 
> This happens on more occasions; execute this on a mounted samba filesystem
> under windows, like /cygdrive/p/...
> 
> 
>>>>import shelve
>>>>shelve.open("test", flag='c')
>>>>shelve.open("test", flag='c')
> 
> Traceback (most recent call last):
>   File "./test.py", line 3, in ?
>     shelve.open("test", flag='c');
>   File "/usr/lib/python2.3/shelve.py", line 231, in open
>     return DbfilenameShelf(filename, flag, protocol, writeback, binary)
>   File "/usr/lib/python2.3/shelve.py", line 212, in __init__
>     Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback,
> binary)
>   File "/usr/lib/python2.3/anydbm.py", line 83, in open
>     return mod.open(file, flag, mode)
>   File "/usr/lib/python2.3/dbhash.py", line 16, in open
>     return bsddb.hashopen(file, flag, mode)
>   File "/tmp/python.2664/usr/lib/python2.3/bsddb/__init__.py", line 192,
> in hashopen
> bsddb._db.DBNoSuchFileError: (2, 'No such file or directory')
> Exception exceptions.AttributeError: "DbfilenameShelf instance has no
> attribute 'writeback'" in  ignored
> 
> It gives an 'No such file or directory' the second time, while the shelve
> is succesfully created. It seems to produce this error when a file already
> exists.
> This essentially makes shelve useless under cygwin.
> 
> Greetings,
> Wladimir
> 


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



More information about the Cygwin mailing list