Bug in require("../foo")

2 views
Skip to first unread message

Jason Davies

unread,
Dec 19, 2009, 6:42:26 AM12/19/09
to nodejs
Hi all,

I noticed a bug introduced in 3b8e47755a16c72d7b3509685a89c834c42a9342
whereby require("../foo") fails to work. The problem is that paths
like "foo/bar/../baz" get turned into "foobaz" instead of "foo/baz".

My fix is here: http://github.com/jasondavies/node/commit/79efd868c460df001b2602e133e6f3f57c337356

If someone can take a look and let me know if it's kosher, that would
be useful.

Thanks,

Jason

Micheil Smith

unread,
Dec 19, 2009, 6:54:35 AM12/19/09
to nod...@googlegroups.com
Hi Jason,

Thanks for posting that fix, however, to paraphrase Ryan, bugs will be fixed quicker during his holidays if you write up a simple test case using /tests/mjsunit/.

Also, open up a ticket over at http://github.com/ry/node/issues

- Micheil.

> --
>
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
>

Isaac Z. Schlueter

unread,
Dec 19, 2009, 8:49:36 PM12/19/09
to nodejs
Jason,

I just combed through this, adding some tests and making them pass,
including a more thorough fix that doesn't rely on regexps for this.

Fixed now on my master (isaacs/node), or you can apply the patch
yourself if you prefer:

http://groups.google.com/group/nodejs/browse_thread/thread/1aa0146b92582679#msg_9822c03998cb4064
http://gist.github.com/260278

--i

On Dec 19, 3:54 am, Micheil Smith <mich...@brandedcode.com> wrote:
> Hi Jason,
>
> Thanks for posting that fix, however, to paraphrase Ryan, bugs will be fixed quicker during his holidays if you write up a simple test case using /tests/mjsunit/.
>

> Also, open up a ticket over athttp://github.com/ry/node/issues


>
> - Micheil.
>
> On 19/12/2009, at 10:42 PM, Jason Davies wrote:
>
> > Hi all,
>
> > I noticed a bug introduced in 3b8e47755a16c72d7b3509685a89c834c42a9342
> > whereby require("../foo") fails to work.  The problem is that paths
> > like "foo/bar/../baz" get turned into "foobaz" instead of "foo/baz".
>

> > My fix is here:http://github.com/jasondavies/node/commit/79efd868c460df001b2602e133e...

Felix Geisendörfer

unread,
Dec 20, 2009, 6:50:05 AM12/20/09
to nodejs
> I just combed through this, adding some tests and making them pass,
> including a more thorough fix that doesn't rely on regexps for this.
>
> http://gist.github.com/260278

I just applied the patch locally and all tests are passing for me
again. Looks good otherwise as well.

--fg

On Dec 20, 2:49 am, "Isaac Z. Schlueter" <i...@foohack.com> wrote:
> Jason,
>
> I just combed through this, adding some tests and making them pass,
> including a more thorough fix that doesn't rely on regexps for this.
>
> Fixed now on my master (isaacs/node), or you can apply the patch
> yourself if you prefer:
>

> http://groups.google.com/group/nodejs/browse_thread/thread/1aa0146b92...http://gist.github.com/260278

Jason Davies

unread,
Dec 21, 2009, 8:37:32 AM12/21/09
to nodejs
Great, thanks a lot! I opened an issue here referencing your patch so
Ryan catches it: http://github.com/ry/node/issues/#issue/30

--
Jason Davies

www.jasondavies.com

On Dec 20, 1:49 am, "Isaac Z. Schlueter" <i...@foohack.com> wrote:
> Jason,
>
> I just combed through this, adding some tests and making them pass,
> including a more thorough fix that doesn't rely on regexps for this.
>
> Fixed now on my master (isaacs/node), or you can apply the patch
> yourself if you prefer:
>

> http://groups.google.com/group/nodejs/browse_thread/thread/1aa0146b92...http://gist.github.com/260278

Reply all
Reply to author
Forward
0 new messages