Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on unix, realpath are can failed when the path not exist #4983

Open
lygstate opened this issue Feb 10, 2022 · 4 comments · May be fixed by #5198
Open

on unix, realpath are can failed when the path not exist #4983

lygstate opened this issue Feb 10, 2022 · 4 comments · May be fixed by #5198
Labels
enhancement An improvement

Comments

@lygstate
Copy link
Contributor

jerry_char_t *
jerry_port_path_normalize (const jerry_char_t *path_p, /**< input path */
                           jerry_size_t path_size) /**< size of the path */
{
  (void) path_size;

  return (jerry_char_t *) realpath ((char *) path_p, NULL);
} /* jerry_port_path_normalize */

Currently the implementation of jerry_port_path_normalize are called realpath directly, than
may return NULL when path_p is not NULL, but that's not expected.

@LaszloLango LaszloLango added the enhancement An improvement label Nov 22, 2024
@LaszloLango
Copy link
Contributor

Do you have any specific solution for this? Would you like open a PR for this?

@lygstate
Copy link
Contributor Author

Do you have any specific solution for this? Would you like open a PR for this?

I fixed it locally by using https://github.com/lygstate/cpathjoin

that is do not use operating system provided fullppath realptah,
so we only need to export a single api

/**
 * Get the current working directory
 *
 * Note:
 *      Refer to https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
 *
 * @param out_buf_p Pointer to the output buffer where the normalized path should be written.
 * @param out_buf_size Size of the output buffer.
 *
 * @return The current working directory path
 */
char *jerry_port_get_cwd (char *out_buf_p, size_t out_buf_size);

is enough,
indeed, the module handling needs path.join
and nodejs have https://nodejs.org/api/path.html#windows-vs-posix
so to properly implement we needs nodejs alike path join

lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
…h_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
…h_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
…h_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
…h_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
@lygstate
Copy link
Contributor Author

Do you have any specific solution for this? Would you like open a PR for this?

@LaszloLango PR prepared, better merged as Release 3.0, as
It's update the port api

lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 11, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 12, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 12, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 12, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
@LaszloLango
Copy link
Contributor

We need to wrap up things for the release, we won't be able to review and merge #5198 in time, so it'll be scheduled to the next one.

lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 17, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
lygstate added a commit to lygstate/jerryscript that referenced this issue Dec 19, 2024
Replace jerry_port_path_normalize,jerry_port_path_free,jerry_port_path_base with jerry_port_path_style,jerry_port_get_cwd

Partially fixes jerryscript-project#4979
Closes: jerryscript-project#4983

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants