Closed Bug 682166 Opened 9 years ago Closed 9 years ago

Allow absolute pathnames in js console read()

Categories

(Core :: JavaScript Engine, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: azakai, Assigned: azakai)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Currently the js console, when told to

  read('/usr/share/...')

will try to read

  CURRENT_DIR//user/share

(and fail) since it appends the parameter to the current directory.

Attached is a patch that leaves absolute pathnames (starting with '/') alone. For comparison, v8 does that.
Attachment #555902 - Flags: review?(cdleary)
(forgot -U 8, sorry)
Attachment #555902 - Attachment is obsolete: true
Attachment #555902 - Flags: review?(cdleary)
Attachment #555903 - Flags: review?(cdleary)
Comment on attachment 555903 [details] [diff] [review]
patch with context

Review of attachment 555903 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/shell/js.cpp
@@ +3805,5 @@
>  
> +    if (*leaf == '/') {
> +        /* We were given an absolute pathname. */
> +        return JS_strdup(cx, leaf);
> +    }

Do we want to wrap this in an |#if !defined(XP_WIN)|?
Attachment #555903 - Flags: review?(cdleary) → review+
MakeAbsolutePathname is actually only defined and used ifdef XP_UNIX. I guess no one uses the shell on Windows ;)
http://hg.mozilla.org/mozilla-central/rev/5a7e488482a5
Assignee: general → azakai
Status: NEW → RESOLVED
Closed: 9 years ago
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.