* SetCurDir() doesn't allow '\\' in Dir?
@ 2016-10-07 23:13 Tim Lewis
0 siblings, 0 replies; only message in thread
From: Tim Lewis @ 2016-10-07 23:13 UTC (permalink / raw)
To: edk2-devel-01
I did a simple break apart of a path into map-name and directory.
fs0:\MdeModulePkg
So FileSystem was "fs0:" and Dir was "\MdeModulePkg" and the resulting working directory was: "fs0:\\\\MdeModulePkg" (with escape characters)..
It seems the culprit is in EfiShellSetCurDir:
if (DirectoryName != NULL) {
//
// change current dir on that file system
//
if (MapListItem->CurrentDirectoryPath != NULL) {
FreePool(MapListItem->CurrentDirectoryPath);
DEBUG_CODE(MapListItem->CurrentDirectoryPath = NULL;);
}
// ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
// MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, FileSystem, 0);
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, L"\\", 0);
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
MapListItem->CurrentDirectoryPath = StrnCatGrow(&MapListItem->CurrentDirectoryPath, &Size, DirectoryName, 0);
if (MapListItem->CurrentDirectoryPath != NULL && MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] == L'\\') {
ASSERT((MapListItem->CurrentDirectoryPath == NULL && Size == 0) || (MapListItem->CurrentDirectoryPath != NULL));
MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] = CHAR_NULL;
}
}
}
I checked with the Shell Specification and it doesn't mention this sort of pre-pending behavior. It also doesn't allow relative paths, so I would expect that all directory names passed in must be in the form \. The only exception to this rule seems to be FS0:\
I'm not sure what to do here, because I don't think the current behavior makes sense.
Tim
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-07 23:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 23:13 SetCurDir() doesn't allow '\\' in Dir? Tim Lewis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox