Skip to content

Conversation

mat-hek
Copy link
Contributor

@mat-hek mat-hek commented Aug 20, 2025

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

These changes are made under both the "Apache 2.0" and the "GNU Lesser
General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Added nif implementation for getcwd.

Signed-off-by: Mateusz Front <[email protected]>
@mat-hek mat-hek force-pushed the mf/prim-file-get-cwd branch from 4d432e3 to 36c9310 Compare August 20, 2025 12:41
Fixes EXW-197

The problem was caused by allocating a tuple without initializing it.
This meant the 2 words had GCed item (containing moved marker `0x2B`) or
garbage. When calling `memory_ensure_free_with_roots`, a shallow copy of
that tuple (it was the root) attempted to move that garbage and was
failing.

Signed-off-by: Mateusz Front <[email protected]>
@mat-hek mat-hek force-pushed the mf/prim-file-get-cwd branch from 19e7b57 to e2ae3ca Compare August 20, 2025 12:56
@pguyot
Copy link
Collaborator

pguyot commented Aug 20, 2025

AFAIK, prim_file is not part of OTP documented library.
Shouldn't we implement file:get_cwd() instead?

@mat-hek
Copy link
Contributor Author

mat-hek commented Aug 21, 2025

@pguyot indeed it's not, but we need it because it's called by the OTP internals, and not only by the file server

@pguyot
Copy link
Collaborator

pguyot commented Aug 21, 2025

@pguyot indeed it's not, but we need it because it's called by the OTP internals, and not only by the file server

Which module calls it? I searched OTP source code (for prim_file:get_cwd and ?PRIM_FILE:get_cwd) and didn't find any relevant call.

@mat-hek
Copy link
Contributor Author

mat-hek commented Aug 22, 2025

@pguyot well, now I can't find it either... changed to file:get_cwd, I'll reiterate if prim_file pops out again

@mat-hek mat-hek changed the title Add prim_file:get_cwd/0 Add file:get_cwd/0 Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants