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

Return ENotCapable error when accessing unknown files on root (for #3263 and #3264) #3266

Merged
merged 8 commits into from
Nov 3, 2022

Conversation

ptitSeb
Copy link
Contributor

@ptitSeb ptitSeb commented Oct 28, 2022

Fixes for wasm.fyi tests:

  • When accessing bad path from the root, return ENOTCAPABLE error instead of ENOENT (root can only contains pre-openned folder, no other capability)
  • Accessing ROOT for other things then entering folder should result in ENOTCAPABLE

@ptitSeb ptitSeb marked this pull request as draft October 28, 2022 16:25
Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

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

We need to add also a test

@ptitSeb ptitSeb marked this pull request as ready for review November 2, 2022 09:35
@ptitSeb
Copy link
Contributor Author

ptitSeb commented Nov 2, 2022

We need to add also a test

This is a challenge here: the original tests are based on C code and around specific syscall error code return or Exit Code value. There is no infrastructure to do that on wasmer tests
Like:

With a mapdir test_fs run

#include <assert.h>
#include <errno.h>
#include <stdio.h>

int main() {
  FILE* file = fopen("test_fs.not/..", "r");
  assert(file == NULL);
  assert(errno == ENOTCAPABLE);

  return 0;
}

or simply run

#include <stdlib.h>

int main(void) {
    abort();

    return 0;
}

And check that the exit code is 134 (128+SIGABRT) on linux-like env. (or 3 on windows)

lib/cli/src/error.rs Outdated Show resolved Hide resolved
@ptitSeb
Copy link
Contributor Author

ptitSeb commented Nov 3, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 3, 2022

Build succeeded:

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.

2 participants