From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from msmail.insydesw.com.tw (ms.insydesw.com [211.75.113.220]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D7B961A1DEB for ; Fri, 7 Oct 2016 16:29:03 -0700 (PDT) Received: from msmail.insydesw.com.tw ([fe80::74f7:f173:f4aa:9a05]) by msmail.insydesw.com.tw ([fe80::74f7:f173:f4aa:9a05%11]) with mapi id 14.01.0438.000; Sat, 8 Oct 2016 07:13:05 +0800 From: Tim Lewis To: edk2-devel-01 Thread-Topic: SetCurDir() doesn't allow '\\' in Dir? Thread-Index: AdIg702/sjhswT3ESeeOHt1COYT/JQ== Date: Fri, 7 Oct 2016 23:13:04 +0000 Message-ID: <7236196A5DF6C040855A6D96F556A53F3F4C18@msmail.insydesw.com.tw> Accept-Language: en-US, zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [73.48.186.173] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: SetCurDir() doesn't allow '\\' in Dir? X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Oct 2016 23:29:04 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 work= ing directory was: "fs0:\\\\MdeModulePkg" (with escape characters).. It seems the culprit is in EfiShellSetCurDir: if (DirectoryName !=3D NULL) { // // change current dir on that file system // if (MapListItem->CurrentDirectoryPath !=3D NULL) { FreePool(MapListItem->CurrentDirectoryPath); DEBUG_CODE(MapListItem->CurrentDirectoryPath =3D NULL;); } // ASSERT((MapListItem->CurrentDirectoryPath =3D=3D NULL && Size =3D= =3D 0) || (MapListItem->CurrentDirectoryPath !=3D NULL)); // MapListItem->CurrentDirectoryPath =3D StrnCatGrow(&MapListItem->Cur= rentDirectoryPath, &Size, FileSystem, 0); ASSERT((MapListItem->CurrentDirectoryPath =3D=3D NULL && Size =3D=3D = 0) || (MapListItem->CurrentDirectoryPath !=3D NULL)); MapListItem->CurrentDirectoryPath =3D StrnCatGrow(&MapListItem->Curre= ntDirectoryPath, &Size, L"\\", 0); ASSERT((MapListItem->CurrentDirectoryPath =3D=3D NULL && Size =3D=3D = 0) || (MapListItem->CurrentDirectoryPath !=3D NULL)); MapListItem->CurrentDirectoryPath =3D StrnCatGrow(&MapListItem->Curre= ntDirectoryPath, &Size, DirectoryName, 0); if (MapListItem->CurrentDirectoryPath !=3D NULL && MapListItem->Curre= ntDirectoryPath[StrLen(MapListItem->CurrentDirectoryPath)-1] =3D=3D L'\\') = { ASSERT((MapListItem->CurrentDirectoryPath =3D=3D NULL && Size =3D= =3D 0) || (MapListItem->CurrentDirectoryPath !=3D NULL)); MapListItem->CurrentDirectoryPath[StrLen(MapListItem->CurrentDirect= oryPath)-1] =3D 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 expe= ct that all directory names passed in must be in the form \. The only excep= tion to this rule seems to be FS0:\ I'm not sure what to do here, because I don't think the current behavior ma= kes sense. Tim