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: [BUG ?] Failed to rebuild Cygwin


On Jul 31 12:55, Pavel Fedin wrote:
>  Hello!
> 
>  I have occasionally found a little problem in path check code. Attempt to
> reference thing like '/..' fails, however at least under Linux this resolves
> to root, and you can actually attempt to go past-root as many times as you
> want, e. g. '/../../../..'. The bug was occasionally revealed by 'make' test
> suite.
>  [...]
>  P.S. I suggest that the way to fix the described path check bug is to undo
> your small optimization and move back setting check_parent flag to:
> --- cut ---
>       /* Strip runs of /'s.  */
>       if (!isslash (*src))
>         {
> 	  *tail++ = *src++;
> 	  check_parent = true;
> 	}
> --- cut ---

This works, but what bugs me a bit is setting a variable to true for
each non-slash character.  That happens a lot of time.

>  The idea behind this is that the check will take place only if we have
> actually got something to check (at least one non-slash character). In case
> of '/..' the first 'isslash(*src)' returns TRUE, consequently the loop will
> not run at all.
>  An alternative is to add a check against 'dst' being empty around the
> actual check:
> --- cut ---
> 		      path_conv head (dst);
> 		      if (!head.isdir())
> 		        return ENOENT;
> --- cut ---

I applied a patch which skips testing / or // when a /.. or //.. has
been encountered.  Can you please give it a try?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 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]