EFI applications will cause this to happen in the shell.
This problem happens if the CWD (current working directory) is empty.
Work around is to:
The fix is to recompile the EFI toolkit with a larger buffer in \lib\libc\efi\env.c set MAX_ENVIRONMENT_DATA to a much larger size (i.e. ~32K)
Background:
The problem is caused by variable size. In Intel platform, the memory information used in S3 is >7K, so we override the variable size to 8K. In libc, env.c, max env data is hardcode to
#define MAX_ENVIRONMENT_DATA 4098
So if there is some variable's size bigger than 4098, the _InitializeEnv will failed to add reminded env variable to ShellDevMap. This will make CWD (current working directory) empty, and fs0: like root directory fail to map into libc environment, which make lots of cmds tools fail. If I large this definition to, say, 10000, problem is gone.
Because MAX variable size has no reason to be this value (In WHEA implement or in this platform, variable needs to be 8K at least, and no spec limits the variable size), Need the toolkit to large this value to at least 8K or even 32K
changed MAX_ENVIRONMENT_DATA from 4098 to 32768.
#define MAX_ENVIRONMENT_DATA 32768
but still open() fails. Is there anything we can try to avoid this failure?
thanks in advance