GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — module: test for directories, fixes require with .. by robertkowalski · Pull Request #58 · nodejs/node

Conversation

@robertkowalski

@robertkowalski robertkowalski commented Dec 4, 2014

Copy link
Copy Markdown
Contributor

Given my home-directory is /Users/rocko - and I have a file named
npm.json in it and also a repository with name npm, which is a
folder for the node-module.

When try to require the /Users/rocko/npm/index.js two direcotry
levels down in the npm folder (e.g. /Users/rocko/npm/test/tap)
with require("../../") node will load /Users/rocko/npm/index.json.

When I use require("../..") node will load /Users/rocko/npm.json
which is fixed by this commit.

Original PR: nodejs/node-v0.x-archive#7094

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
rvagg
rvagg reviewed Dec 4, 2014
View reviewed changes
Comment thread lib/module.js Outdated

@rvagg rvagg Dec 4, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if I'm missing something, why is this done up here and not closer to where it's used, potentially skipping when trailingSlash==true?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@robertkowalski robertkowalski Dec 4, 2014

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point! no real reason for that, will fix that!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rvagg
rvagg force-pushed the v0.12 branch 4 times, most recently from d7e65ff to 185d11c Compare December 4, 2014 10:21
bnoordhuis
bnoordhuis reviewed Dec 4, 2014
View reviewed changes
Comment thread test/fixtures/json-with-directory-name-module/module-stub/test/tap/test.js Outdated

@bnoordhuis bnoordhuis Dec 4, 2014

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a second test that checks that ../../ has the same behavior.

Suggestion: change the file path to a more neutral one, e.g. test/fixtures/json-with-directory-name-module/module-stub/one/two/three.js. The tap/ directory suggests that tap is somehow involved when it's not.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bnoordhuis

bnoordhuis commented Dec 4, 2014

Copy link
Copy Markdown
Member

Left two comments but apart from that LGTM. Would be good to get more eyeballs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rvagg

rvagg commented Dec 4, 2014

Copy link
Copy Markdown
Member

lgtm, having reviewed the original discussion @ joyent/node I'm a big +1 on consistency and think holding off for some mythical future total rework of the module loader system is a bad idea, let's just land this and think about the future when the future happens

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rlidwka

rlidwka commented Dec 5, 2014

Copy link
Copy Markdown
Contributor

Require subsystem is locked in node.js. Are we changing it here or not?

If we are, I want to ask require('.') to be handled the same as require('./'), because the current behavior of require('.') is useless.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkowalski
module: test for directories, fixes require with ..
cfc1272
Given my home-directory is `/Users/rocko` - and I have a file named
`npm.json` in it and also a repository with name `npm`, which is a
folder for the node-module.

When try to require the `/Users/rocko/npm/index.js` two direcotry
levels down in the npm folder (e.g. `/Users/rocko/npm/test/tap`)
with require("../../") node will load `/Users/rocko/npm/index.json`.

When I use require("../..") node will load `/Users/rocko/npm.json`
which is fixed by this commit.
@robertkowalski

robertkowalski commented Dec 5, 2014

Copy link
Copy Markdown
Contributor Author

thanks for the feedback. I added the additional test and changed the directory of the fixture.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkowalski

robertkowalski commented Dec 5, 2014

Copy link
Copy Markdown
Contributor Author

some background info: my last status from joyent was that they want to merge it in an unstable version - they also were quite afraid that it could slow down application startup so i had to create all of these benchmarks in the original pr

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chrisdickinson

chrisdickinson commented Dec 6, 2014

Copy link
Copy Markdown
Contributor

Oh wow, that's weird behavior -- good catch & thanks for fixing it. I'm +1 on changing this behavior, it seems very much like a bug given the docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@robertkowalski

robertkowalski commented Dec 6, 2014

Copy link
Copy Markdown
Contributor Author

yes, it is a bug, as you can't reach a directory next to a {js,json}-file which has the same name - with the patch you are able to reach both the file and the directory (by adding the fileending to the require-argument to take the file - or leaving it off to take the directory)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnoordhuis pushed a commit that referenced this pull request Dec 7, 2014
@robertkowalski @bnoordhuis
module: test for directories, fix require with ..
36777d2
Given my home-directory is `/Users/rocko` - and I have a file named
`npm.json` in it and also a repository with name `npm`, which is a
folder for the node-module.

When try to require the `/Users/rocko/npm/index.js` two direcotry
levels down in the npm folder (e.g. `/Users/rocko/npm/test/tap`)
with require("../../") node will load `/Users/rocko/npm/index.json`.

When I use require("../..") node will load `/Users/rocko/npm.json`
which is fixed by this commit.

PR-URL: #58
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-by: Chris Dickinson <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
@bnoordhuis

bnoordhuis commented Dec 7, 2014

Copy link
Copy Markdown
Member

Thanks Robert, landed in 36777d2.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis bnoordhuis closed this Dec 7, 2014
@rvagg rvagg mentioned this pull request Jan 3, 2015
governance: Add new Collaborators #234
Closed
@joyeecheung joyeecheung mentioned this pull request Feb 20, 2020
repl: printing big strings results in OOM #25478
Closed
@wmertens wmertens mentioned this pull request Jun 19, 2020
uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed. #33966
Closed
This was referenced Jul 17, 2020
[Snyk] Security upgrade table from 3.8.3 to 4.0.3 s4sc/node#14
Open
[Snyk] Fix for 1 vulnerabilities pmq20/node#23
Open
[Snyk] Security upgrade table from 3.8.3 to 4.0.3 scality/node#8
Open
[Snyk] Security upgrade table from 3.8.3 to 4.0.3 solebox/node#15
Open
[Snyk] Fix for 1 vulnerabilities erdun/node#22
Open
[Snyk] Security upgrade table from 3.8.3 to 4.0.3 enterstudio/node#14
Open
@silverwind silverwind mentioned this pull request Aug 20, 2020
https/http2: random crashes on macOS with simple server #34854
Closed
targos added a commit to targos/node that referenced this pull request Apr 27, 2021
@targos
deps: V8: cherry-pick 5c6c99a8dc72
39627e6
Original commit message:

    Merged: [liftoff][arm] Release temp registers after use

    The {ParallelRegisterMove} at the end of {AtomicLoad} might need a
    temporary scratch register for spilling values to the stack. Make sure
    that one is available by giving up the scratch register used for the
    address of the atomic access.

    TBR=​[email protected]

    (cherry picked from commit 63166010061d2af4fef6a713d448ebf074a9d2cb)

    (cherry picked from commit 953f7a9dcb1425616e3be67fdfe6ef8d820f0daa)

    Bug: chromium:1153442
    Change-Id: Ie312b37857e226058581b300b5adb1f14476c155
    No-Try: true
    No-Presubmit: true
    No-Tree-Checks: true
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2584959
    Reviewed-by: Clemens Backes <[email protected]>
    Commit-Queue: Clemens Backes <[email protected]>
    Cr-Original-Commit-Position: refs/branch-heads/8.7@{nodejs#60}
    Cr-Original-Branched-From: 0d81cd72688512abcbe1601015baee390c484a6a-refs/heads/8.7.220@{#1}
    Cr-Original-Branched-From: 942c2ef85caef00fcf02517d049f05e9a3d4b440-refs/heads/master@{#70196}
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2656263
    Reviewed-by: Victor-Gabriel Savu <[email protected]>
    Commit-Queue: Artem Sumaneev <[email protected]>
    Cr-Commit-Position: refs/branch-heads/8.6@{nodejs#58}
    Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1}
    Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472}

Refs: v8/v8@5c6c99a
targos added a commit that referenced this pull request Apr 30, 2021
@targos
deps: V8: cherry-pick 5c6c99a8dc72
fdb4a0c
Original commit message:

    Merged: [liftoff][arm] Release temp registers after use

    The {ParallelRegisterMove} at the end of {AtomicLoad} might need a
    temporary scratch register for spilling values to the stack. Make sure
    that one is available by giving up the scratch register used for the
    address of the atomic access.

    TBR=​[email protected]

    (cherry picked from commit 63166010061d2af4fef6a713d448ebf074a9d2cb)

    (cherry picked from commit 953f7a9dcb1425616e3be67fdfe6ef8d820f0daa)

    Bug: chromium:1153442
    Change-Id: Ie312b37857e226058581b300b5adb1f14476c155
    No-Try: true
    No-Presubmit: true
    No-Tree-Checks: true
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2584959
    Reviewed-by: Clemens Backes <[email protected]>
    Commit-Queue: Clemens Backes <[email protected]>
    Cr-Original-Commit-Position: refs/branch-heads/8.7@{#60}
    Cr-Original-Branched-From: 0d81cd72688512abcbe1601015baee390c484a6a-refs/heads/8.7.220@{#1}
    Cr-Original-Branched-From: 942c2ef85caef00fcf02517d049f05e9a3d4b440-refs/heads/master@{#70196}
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2656263
    Reviewed-by: Victor-Gabriel Savu <[email protected]>
    Commit-Queue: Artem Sumaneev <[email protected]>
    Cr-Commit-Position: refs/branch-heads/8.6@{#58}
    Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1}
    Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472}

Refs: v8/v8@5c6c99a

PR-URL: #38275
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Shelley Vohr <[email protected]>
This was referenced Sep 13, 2021
[Snyk] Fix for 1 vulnerabilities solebox/node#24
Open
[Snyk] Fix for 1 vulnerabilities erdun/node#39
Open
[Snyk] Fix for 1 vulnerabilities enterstudio/node#23
Open
[Snyk] Fix for 1 vulnerabilities s4sc/node#23
Open
@solebox solebox mentioned this pull request May 13, 2022
[Snyk] Fix for 1 vulnerabilities solebox/node#29
Open
@enterstudio enterstudio mentioned this pull request May 14, 2022
[Snyk] Fix for 1 vulnerabilities enterstudio/node#28
Open
@s4sc s4sc mentioned this pull request May 14, 2022
[Snyk] Fix for 1 vulnerabilities s4sc/node#28
Open
@duecorda duecorda mentioned this pull request Jun 19, 2022
for loop, inside async setter doesn't wait all Promise. nodejs/help#3898
Closed
@caijw caijw mentioned this pull request Jul 20, 2022
cross compiling for android arm fail. #43906
Closed
@markcellus markcellus mentioned this pull request Oct 27, 2022
URL.href adds a trailing slash at end, but browsers don't #45216
Closed
@nitram-work nitram-work mentioned this pull request Nov 3, 2022
Zlib inflate() holds and reuses buffer until program exit, is never freed limiting memory for other uses. #45303
Closed
@gnarea gnarea mentioned this pull request Nov 3, 2022
RSA key in JWK format can't be imported with createPublicKey() #45304
Closed
@vvvbbbcz vvvbbbcz mentioned this pull request Nov 5, 2022
Can't run npm on node 18.12.1 on Linux #45329
Closed
@Nugine Nugine mentioned this pull request Nov 15, 2022
Executing unoptimized wasm file causes OOM #45480
Closed
@pdpaulson pdpaulson mentioned this pull request Nov 16, 2022
Cannot pass script file on embedtest command line #45484
Closed
@marcossv9 marcossv9 mentioned this pull request Nov 17, 2022
[email protected] package contains security issues #45499
Closed
@snyk-bot snyk-bot mentioned this pull request Jan 8, 2023
[Snyk] Upgrade @humanwhocodes/config-array from 0.9.5 to 0.11.8 AshdonG/node#3
Open
@nickfnblum nickfnblum mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities nickfnblum/node#12
Open
@xphillyx xphillyx mentioned this pull request Nov 30, 2023
[Snyk] Fix for 1 vulnerabilities xphillyx/node#27
Open
@terrorizer1980 terrorizer1980 mentioned this pull request Dec 1, 2023
[Snyk] Fix for 3 vulnerabilities terrorizer1980/node-1#15
Open
@kaocher82 kaocher82 mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities Xtuden-com/node#39
Open
@terrorizer1980 terrorizer1980 mentioned this pull request Dec 1, 2023
[Snyk] Fix for 1 vulnerabilities Exhorder6/node#24
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@robertkowalski @bnoordhuis @rvagg @rlidwka @chrisdickinson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.