Comments (8)
@jorticus-msft I will look into this. Thank you!
from edk2-pytool-library.
@jorticus-msft I am not able to replicate the issue via your example. As shown in your example, you are using the Helper function self.Helper.PackageFmpImageAuth(), which eventually calls
FindToolInWinSdk("signtool.exe")which is where
QueryVCVariables()is called. As you suggested, running
FindToolInWinSdk()` many times will eventually cause the error you linked.
As a test, I ran FindToolInWinSdk("singtool.exe")
1000 times in a loop and the number lines returned from vcvarsall.bat.
I verified the returned rows and total length of vcvarsall.bat remained unchanged and that os.environ entries and total length remained unchanged. Due to this, I believe environment pollution is coming from somewhere else (unless I am misunderstanding your issue).
Thanks!
Joey
from edk2-pytool-library.
@Javagedes You're right, it's not QueryVcVariables
that is causing the issue. The environ grows between calls to this function, and by the end of the build the environ is so large that QueryVcVariables
fails to run.
The main culprit is %PATH%
which starts at 3113 characters and grows to 6799 characters. EDK2 tooling adds ~40 paths to the system PATH. The limit for Windows is apparently 8191 chars (when executing .bat files [source], which doesn't quite explain this, but if we assume Python uses wide chars and the windows limitation is actually 8191 bytes, then it's expected that I would run into this issue here.
I am able to resolve the issue by reducing my PATH length. My fault for having such a large PATH I guess... 🙂 I'll leave it up to you if you think this is something that should be fixed in the tooling or not. Maybe a warning would be useful?
from edk2-pytool-library.
Hello, yes on the edk2-pytool-extensions side (stuart commands), we manipulate the os.environ
through our environment descriptor files and external dependencies; 40 paths seem a bit much and it may be necessary to evaluate scope usage to reduce the amount of in-scope, but unused, descriptors / external dependencies as each will edit the os.environ
in some way.
I should be able to catch the exception when the exception message is The input line is too long.
and throw a better worded error about the PATH length. I'll work on that and tag you in the PR if I can get it working!
from edk2-pytool-library.
@jorticus-msft The reason the limit you mentioned does not line up perfectly is because this 8192 limitation is for all arguments passed, which includes all environment variables, not just the PATH. Therefore once the total length of all of the environment variables reach 8192, we throw the exception you mentioned above.
There is actually a second layer to this issue that I'm working through now. That is the fact that when an individual environment variable grows over 8191, that variable is ignored. Because of this, if the PATH grows over 8191, PATH is ignored. When this happens, we no longer throw the above error because PATH is not passed to the .bat command, but we fail to find what we are looking for (depending on if it's found in the PATH variable). I'm working to handle warning for both.
from edk2-pytool-library.
PR to example on the logging message: #320
from edk2-pytool-library.
Thank you! The warning works for me:
ERROR - .bat cmd can not handle args greater than 8191 chars; your total ENV var len exceeds 8191. Reduce the total length of your ENV variables to resolve this (Typically your PATH is too long).
CRITICAL - Build Process Exception
ERROR - Traceback (most recent call last):
...snip stacktrace...
Exception: .bat cmd can not handle args greater than 8191 chars; your total ENV var len exceeds 8191. Reduce the total length of your ENV variables to resolve this (Typically your PATH is too long).
from edk2-pytool-library.
Great thank you for verifying. I will get this in and it will be available in the .15.0 release!
from edk2-pytool-library.
Related Issues (20)
- [Bug]: fails to install when offline HOT 2
- [Bug]: Invalid reporting for Invalid package path error
- [Bug]: Loading EFiVariableAuthentication2 from Filestream results in exception
- [Feature]: Convert String Attributes (long and short) to Integer and back HOT 1
- [Feature]: Update utility_functions to print a C Array with hexdump to the side and clean up PrintByteList HOT 1
- [Feature]: Update authenticated_variables_structure_support and wincert HOT 2
- [Doc]: Update docs on path_utilities to indicate how slow it is to create this object
- [Bug]: Current capsule generation DestDir follows deprecated convention and needs to be updated to match latest guidance.
- [Bug]: HOT 2
- [Feature]: Add githooks to automate CI testing before the pipeline attempts it HOT 1
- [Feature]: Update to pyproject.toml
- [Feature]: Add Advanced Logging
- [Bug]: Capsule Update broken from OS
- [Feature]: Utilize mkdocs-awesome-pages-plugin v2.9.2
- [Bug]: `base_parser.TargetFilePath` not reverted when exiting an !include parse
- [Bug]: Failed to fully remove ... [WinError 3] The system cannot find the path specified: ...
- [Bug]: Capsules are failing infverif validation HOT 3
- [Bug]: WinRcPath can't find correct path when VS2019 build
- [Feature]: stuart_report and NULL libraries for component-libs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edk2-pytool-library.