public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [BUG ?] Failed to rebuild Cygwin
Date: Wed, 31 Jul 2013 10:47:00 -0000	[thread overview]
Message-ID: <20130731102737.GW4166@calimero.vinschen.de> (raw)
In-Reply-To: <003401ce8dcb$a630b310$f2921930$%fedin@samsung.com>

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

  parent reply	other threads:[~2013-07-31 10:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 10:14 Pavel Fedin
2013-07-31 10:27 ` Corinna Vinschen
2013-07-31 10:28   ` JonY
2013-07-31 11:23     ` Corinna Vinschen
2013-07-31 11:32       ` Corinna Vinschen
2013-07-31 12:02         ` JonY
2013-07-31 12:06           ` Corinna Vinschen
2013-07-31 12:57             ` JonY
2013-07-31 10:47 ` Corinna Vinschen [this message]
2013-07-31 12:06   ` Pavel Fedin
2013-07-31 12:49     ` Corinna Vinschen
2013-07-31 14:12       ` Going back beyond the root (was: [BUG ?] Failed to rebuild Cygwin) Pavel Fedin
2013-07-31 14:24         ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130731102737.GW4166@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).