Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Mar 2021 03:06:44 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 254120] Linuxulator: getcwd returns ENOMEM instead of ERANGE
Message-ID:  <bug-254120-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254120

            Bug ID: 254120
           Summary: Linuxulator: getcwd returns ENOMEM instead of ERANGE
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: iwtcex@gmail.com

% cat getcwd.c 
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>

int main() {

  char buf[3];
  assert(getcwd(buf, sizeof(buf)) == NULL);
  if (errno != ERANGE) {    
    perror("getcwd");
  }

  return 0;
}
% pwd | wc -c
      29
% /compat/linux/bin/cc getcwd.c -o getcwd
% ./getcwd 
getcwd: Cannot allocate memory

On the Linux side getcwd is clearly documented to return ERANGE and
at least Mono actually expects it:
https://github.com/mono/mono/blob/da11592cbea4269971f4b1f9624769a85cc10660/mono/eglib/gfile-posix.c#L175.

This is mostly relevant for FNA/MonoGame applications.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254120-227>