Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-04 Thread Igor Peshansky
On Sat, 4 Feb 2006, Christopher Faylor wrote:

 On Fri, Feb 03, 2006 at 11:44:22PM -0500, Igor Peshansky wrote:
 Yes.  Looks like Cygwin is too hasty in assigning the error number: Linux
 only returns ENOENT if the directory doesn't already exist, but Cygwin
 will always return it for a trailing dot argument.  The same with rmdir,
 where it would always return EINVAL, even if the directory doesn't exist
 (in which case Linux returns ENOENT).  FWIW, POSIX only specifies an
 action for rmdir() on a trailing dot (EINVAL).

 rmdir doesn't always return EINVAL.

   bash-3.00$ ./rmdir qwer
   -1 = rmdir (qwer)
   rmdir: No such file or directory
   bash-3.00$ ./rmdir qwer/.
   -1 = rmdir (qwer/.)
   rmdir: Invalid argument

I meant in the case of a trailing dot.  On Linux, if directory FOO doesn't
exist, rmdir FOO/. returns ENOENT.

The fix is pretty much the same as what you did for mkdir, except that
EEXIST is replaced by EINVAL...
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_Igor Peshansky, Ph.D. (name changed!)
 |,4-  ) )-,_. ,\ (  `'-'   old name: Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte.
But no -- you are no fool; you call yourself a fool, there's proof enough in
that! -- Rostand, Cyrano de Bergerac

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-04 Thread Sven Köhler
 I just checked in a fix to make cygwin return the correct error
 when trying to create a file with a trailing dot.
 
 It will be in the next snapshot.

Thank you!


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



cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Sven Köhler
Hi,

i'm trying to use cygwin's cvs in server-mode for another application
I get the following error, but on a linux-system, everything is fine!

  E cannot mkdir /tmp/cvs-serv784/.
  error  No such file or directory

Please note, that the error is: no such file or directory
So i tested mkdir on the console:

  # mkdir /tmp/cvs-serv784/.
  mkdir: cannot create directory `/tmp/cvs-serv784/.': No such file or
directory
  # file /tmp/cvs-serv784/.
  /tmp/cvs-serv784/.: directory

As you can see, the file-command returns, that the directory
/tmp/cvs-serv784/ exists, but mkdir fails with no such file or directory.

Well, you may say: that's OK, but it isn't! The correct error-message
should be something like file or directory already exists

I tested mkdir /tmp/. on a linux-system, and it returns:

  # mkdir /tmp/.
  mkdir: cannot create directory `/tmp/.': File exists


Of course, cvs isn't using the mkdir command i guess, but it's using
some mkdir()-call and i guess that cygwin returns the wrong return-code
and actually cvs would ignore the file exists error-code, but it gets
the no such file or directory error-code.
So that results in a broken cvs :-(


Is this a bug in cygwin?


Greetings
  Sven


How to reproduce:

# mkdir /tmp/cvs
# cvs -d /tmp/cvs init
# cvs server

This creates a repository in /tmp/cvs and then starts a cvs in
server-mode. Then feed the cvs-command with the following lines:

Root /tmp/cvs
Global_option -n
Argument -d
Directory .
/tmp/cvs/
Argument .
Directory .
/tmp/cvs/
update


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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Brian Dessent
Sven Köhler wrote:

 i'm trying to use cygwin's cvs in server-mode for another application
 I get the following error, but on a linux-system, everything is fine!
 
   E cannot mkdir /tmp/cvs-serv784/.
   error  No such file or directory

Already discussed:
http://www.cygwin.com/ml/cygwin/2006-01/threads.html#01207
http://www.cygwin.com/ml/cygwin/2006-01/msg01357.html

It's the trailing dot that is the problem, which it seems like cvs is
erroneously adding.  Previous versions of Cygwin accepted it, but the
change was made to reject such calls to mkdir() in order to more
linux-like.  I'm not sure about the errno returned, though.

A reported workaround is to use an earlier Cygwin (such as .18) but that
really isn't a great idea since you will also have to downgrade a
handful of other packages (coreutils, findutils, bash, libreadline,
others?)  Or someone may have tracked down the issue in cvs, I'm not
sure.

Brian

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Sven Köhler
 i'm trying to use cygwin's cvs in server-mode for another application
 I get the following error, but on a linux-system, everything is fine!

   E cannot mkdir /tmp/cvs-serv784/.
   error  No such file or directory
 
 Already discussed:
 http://www.cygwin.com/ml/cygwin/2006-01/threads.html#01207
 http://www.cygwin.com/ml/cygwin/2006-01/msg01357.html
 
 It's the trailing dot that is the problem, which it seems like cvs is
 erroneously adding.  Previous versions of Cygwin accepted it, but the
 change was made to reject such calls to mkdir() in order to more
 linux-like.  I'm not sure about the errno returned, though.

Right, the trailing dot is the problem _but_ the directory
/tmp/cvs-serv784 is created by cvs, but cvs then additionally tries to
create /tmp/cvs-serv784/.

As i demonstrated, my Linux returns the error file already exists
instead of cygwin's no such file or directory. So the problem is
perhaps gone, if cygwin becomes more Linux-like once again ;-)

 A reported workaround is to use an earlier Cygwin (such as .18) but that
 really isn't a great idea since you will also have to downgrade a
 handful of other packages (coreutils, findutils, bash, libreadline,
 others?)  Or someone may have tracked down the issue in cvs, I'm not
 sure.

yes, that really not a good idea.

I'm trying to develop a Eclipse-Plugin for local CVS without SSH. It
would be nice, if cvs would run in servermode - by either fixing CVS or
cygwin - well, one of the two has to be fixed.

Greetings
  Sven

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Christopher Faylor
On Sat, Feb 04, 2006 at 05:11:08AM +0100, Sven K?hler wrote:
As i demonstrated, my Linux returns the error file already exists
instead of cygwin's no such file or directory. So the problem is
perhaps gone, if cygwin becomes more Linux-like once again ;-)

I just checked in a fix to make cygwin return the correct error
when trying to create a file with a trailing dot.

It will be in the next snapshot.

cgf

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Igor Peshansky
On Sat, 4 Feb 2006, Sven Köhler wrote:

 i'm trying to use cygwin's cvs in server-mode for another application
 I get the following error, but on a linux-system, everything is fine!

   E cannot mkdir /tmp/cvs-serv784/.
   error  No such file or directory

As Brian said, this was already reported.  The ball is now in the CVS
maintainer's court: http://cygwin.com/ml/cygwin/2006-01/msg01383.html.

 Of course, cvs isn't using the mkdir command i guess, but it's using
 some mkdir()-call and i guess that cygwin returns the wrong return-code
 and actually cvs would ignore the file exists error-code, but it gets
 the no such file or directory error-code.
 So that results in a broken cvs :-(

That's exactly right (see line 1002 of server.c).

 Is this a bug in cygwin?

Yes.  Looks like Cygwin is too hasty in assigning the error number: Linux
only returns ENOENT if the directory doesn't already exist, but Cygwin
will always return it for a trailing dot argument.  The same with rmdir,
where it would always return EINVAL, even if the directory doesn't exist
(in which case Linux returns ENOENT).  FWIW, POSIX only specifies an
action for rmdir() on a trailing dot (EINVAL).

I didn't post earlier because I was trying to test a patch (a variant of
CGF's, though his is cleaner).  I'm glad this is fixed.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_Igor Peshansky, Ph.D. (name changed!)
 |,4-  ) )-,_. ,\ (  `'-'   old name: Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte.
But no -- you are no fool; you call yourself a fool, there's proof enough in
that! -- Rostand, Cyrano de Bergerac
--
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/

Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Igor Peshansky
On Fri, 3 Feb 2006, Christopher Faylor wrote:

 On Sat, Feb 04, 2006 at 05:11:08AM +0100, Sven K?hler wrote:
 As i demonstrated, my Linux returns the error file already exists
 instead of cygwin's no such file or directory. So the problem is
 perhaps gone, if cygwin becomes more Linux-like once again ;-)

 I just checked in a fix to make cygwin return the correct error
 when trying to create a file with a trailing dot.

 It will be in the next snapshot.

Thanks for doing this.  Care to also fix rmdir() to return ENOENT if the
directory doesn't exist (see
http://cygwin.com/ml/cygwin/2006-02/msg00172.html)?
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_Igor Peshansky, Ph.D. (name changed!)
 |,4-  ) )-,_. ,\ (  `'-'   old name: Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte.
But no -- you are no fool; you call yourself a fool, there's proof enough in
that! -- Rostand, Cyrano de Bergerac

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Christopher Faylor
On Fri, Feb 03, 2006 at 11:44:22PM -0500, Igor Peshansky wrote:
Yes.  Looks like Cygwin is too hasty in assigning the error number: Linux
only returns ENOENT if the directory doesn't already exist, but Cygwin
will always return it for a trailing dot argument.  The same with rmdir,
where it would always return EINVAL, even if the directory doesn't exist
(in which case Linux returns ENOENT).  FWIW, POSIX only specifies an
action for rmdir() on a trailing dot (EINVAL).

rmdir doesn't always return EINVAL.

Test program:

  #include stdlib.h
  #include unistd.h
  #include stdio.h

  int
  main (int argc, char **argv)
  {
printf (%d = rmdir (\%s\)\n, rmdir (*++argv), *argv);
perror (rmdir);
  }

Run it:

  bash-3.00$ ./rmdir qwer
  -1 = rmdir (qwer)
  rmdir: No such file or directory
  bash-3.00$ ./rmdir qwer/.
  -1 = rmdir (qwer/.)
  rmdir: Invalid argument

cgf

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



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-03 Thread Charles Wilson

Igor Peshansky wrote:

On Sat, 4 Feb 2006, Sven Köhler wrote:


i'm trying to use cygwin's cvs in server-mode for another application
I get the following error, but on a linux-system, everything is fine!

  E cannot mkdir /tmp/cvs-serv784/.
  error  No such file or directory


As Brian said, this was already reported.  The ball is now in the CVS
maintainer's court: http://cygwin.com/ml/cygwin/2006-01/msg01383.html.

That's exactly right (see line 1002 of server.c).


Is this a bug in cygwin?


Yes.  


I think I'd rather not add a hackish workaround in server.c (ignore the 
obvious bug in the dreck below)


if (status != 0
- status != EEXIST
+ (status != EEXIST)
+#ifdef __CYGWIN__
+ ((status != ENOENT)  (dir[strlen(dir)-2] == '/')  
(dir(strlen(dir)-1] == '.'))

+#endif
+)
  signal error...

and just say use a snapshot cygwin1.dll, or update to 1.5.20 when it is 
released.


--
Chuck

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