[if gte mso 9]>

Re: [edk2] Shell Piping - set time via text file

Subject: Re: [edk2] Shell Piping - set time via text file

From: "Carsey, Jaben" <jaben.carsey@intel.com>

To: Andrew Fish <afish@apple.com>, "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2011-06-15 21:26:32

I would expect a clear error message on this line:

type time.txt >v foo|time %foo%

 

The problem is that in order for this to succeed StdOut must be redirected to two places (temp location for pipe and then environment variable) and the shell does not support that.

 

-Jaben

 

From: Andrew Fish [mailto:afish@apple.com]
Sent: Wednesday, June 15, 2011 12:24 PM
To: edk2-devel@lists.sourceforge.net
Cc: Carsey, Jaben
Subject: Re: [edk2] Shell Piping - set time via text file

 

Joel.

 

A pre-fetch abort would imply your code is running off into the weeds. 

 

I just tried:

type time.txt >v foo

time %foo%

 

where:

type time.txt

10:11:12

 

in the InOsEmuPkg X64 emulator and it works. 

 

I'm not sure you syntax is legal, but I can reproduce the crash in the InOsEmuPkg emulator. 

type time.txt >v foo|time %foo%

 

It looks like the FileHandle passed into FileHandleWrite is not a valid EFI_FILE_HANDLE. So the call to FileHandle->Write() is causing your pre-fetch abort. 

 

(gdb) p /x *FileHandle

$7 = {

  Revision = 0xafafafafafafafaf, 

  Open = 0xafafafafafafafaf, 

  Close = 0xafafafafafafafaf, 

  Delete = 0xafafafafafafafaf, 

  Read = 0xafafafafafafafaf, 

  Write = 0xafafafafafafafaf, 

  GetPosition = 0xafafafafafafafaf, 

  SetPosition = 0xafafafafafafafaf, 

  GetInfo = 0xafafafafafafafaf, 

  SetInfo = 0xafafafafafafafaf, 

  Flush = 0xafafafafafafafaf

}

 

 

#0  0x000000010aa6fae7 in FileHandleWrite (FileHandle=0x10ac5b318, BufferSize=0x106f56380, Buffer=0x10ac5101c) at /Users/fish/work/edk2/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c:225

#1  0x000000010aa74ae2 in InternalPrintTo (String=0x10ac5101c) at /Users/fish/work/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c:2548

#2  0x000000010aa75076 in InternalShellPrintWorker (Col=0xffffffff, Row=0xffffffff, Format=0x10ac5d898, Marker=0x106f56510) at /Users/fish/work/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c:2654

#3  0x000000010aa75452 in ShellPrintHiiEx (Col=0xffffffff, Row=0xffffffff, Language=0x0, HiiFormatStringId=0x2, HiiFormatHandle=0x10afae118) at /Users/fish/work/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c:2811

#4  0x000000010aaf59a3 in DoShellPrompt () at /Users/fish/work/edk2/ShellPkg/Application/Shell/Shell.c:943

#5  0x000000010aaf32ea in UefiMain (ImageHandle=0x10afb4198, SystemTable=0x106ef3f18) at /Users/fish/work/edk2/ShellPkg/Application/Shell/Shell.c:406

#6  0x000000010ab0a489 in ProcessModuleEntryPointList (ImageHandle=0x10afb4198, SystemTable=0x106ef3f18) at /Users/fish/work/edk2/Build/EmuUnixX64/DEBUG_XCLANG/X64/ShellPkg/Application/Shell/Shell/DEBUG/AutoGen.c:553

#7  0x000000010aa80450 in _ModuleEntryPoint (ImageHandle=0x10afb4198, SystemTable=0x106ef3f18) at /Users/fish/work/edk2/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c:65

#8  0x0000000106f6b4c7 in CoreStartImage (ImageHandle=0x10afb4198, ExitDataSize=0x106f56c20, ExitData=0x106f56c18) at /Users/fish/work/edk2/MdeModulePkg/Core/Dxe/Image/Image.c:1482

#9  0x0000000105f6ac81 in BdsLibBootViaBootOption (Option=0x10afb4398, DevicePath=0x10afb4418, ExitDataSize=0x106f56c20, ExitData=0x106f56c18) at /Users/fish/work/edk2/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c:798

#10 0x0000000105f8a689 in BdsBootDeviceSelect () at /Users/fish/work/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c:221

#11 0x0000000105f8a264 in BdsEntry (This=0x105f97e60) at /Users/fish/work/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c:363

#12 0x0000000106f81ee3 in DxeMain (HobStart=0x106eef018) at /Users/fish/work/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c:458

#13 0x0000000106f82361 in ProcessModuleEntryPointList (HobStart=0x103020000) at /Users/fish/work/edk2/Build/EmuUnixX64/DEBUG_XCLANG/X64/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/AutoGen.c:318

#14 0x0000000106f5aea0 in _ModuleEntryPoint (HobStart=0x103020000) at /Users/fish/work/edk2/MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.c:54

#15 0x0000000106fcc8d4 in SwitchStack (EntryPoint=0x106fcf468 <GetNextHob+24>, Context1=0x10301ca78, Context2=0x106ff3340, NewStack=0x106fd5bd8) at /Users/fish/work/edk2/UnixPkg/Library/UnixBaseLib/SwitchStack.c:55

 

(gdb) l 221

216     )

217   {

218     //

219     // ASSERT if FileHandle is NULL

220     //

221     ASSERT (FileHandle != NULL);

222     //

223     // Perform the write based on EFI_FILE_PROTOCOL

224     //

225     return (FileHandle->Write(FileHandle, BufferSize, Buffer));

 

 

Andrew Fish

 

 

 

 

On Jun 15, 2011, at 11:36 AM, joelw@indyelectronics.com wrote:



Also hitting a pre-fetch abort with this:

 

type time.txt >v foo|time %foo%

 

 

-----Original Message-----
From: joelw@indyelectronics.com [mailto:joelw@indyelectronics.com]
Sent: Wednesday, June 15, 2011 02:23 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Shell Piping - set time via text file

Hi Jaben,

 

Thanks for the clarification.  When I execute sequence, I see:

 

  Error. The argument '01:34:29

  ' is incorrect.

 

Running "set foo" I get "foo - 01:34:29", without a trailing /r or /n.

 

I created file with edit, and it does not have a training /r or /n.  Then running edit on the same file again, I can no longer save and get "Disk Error. Try Again".  A reboot clears up the disk error.  This is not related to block IO driver as system will boot from same block IO driver without issue.  The later would appear to be issue with "edit".

 

-joel 

 

-----Original Message-----
From: Carsey, Jaben [mailto:jaben.carsey@intel.com]
Sent: Wednesday, June 15, 2011 12:00 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Shell Piping - set time via text file

I think that there is some confusion between the command line for a shell command or shell application and the StdIn. The time command is passed the time to change to on its command line, it does not read this from StdIn. If you think of time as a standard C program, the argv[1] needs to be the time value to use. To change the command line passed into the time program, you would need to do something more like this: I am going to answer the rest from a UDK Shell 2.0 perspective. I am not certain which shell you are using. type time.txt >v foo time %foo% this would tell the shell to have the type command output sent to an environment variable, and then tell the shell to change the command line of the time command to use the environment variable foo. -Jaben -----Original Message----- From: Joel Winarske [mailto:joelw@indyelectronics.com] Sent: Tuesday, June 14, 2011 11:58 PM To: edk2-devel@lists.sourceforge.net Subject: [edk2] Shell Piping - set time via text file I'm trying to set time using a text file in Shell. I have a text file with time value, and I issue: type time.txt|time Time is not set to value in text file. Text file contains time in same format that one would pass to time from Shell prompt. Is this a bug, or by design? -joel ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel