Comments (22)
This error is coming directly from the low-level CAB APIs which is a native C lib calling Win32 and not .NET - so it isn't .NET causing these errors. That code is all checked in at https://github.com/activescott/libmspack4n if you want to investigate and provide a fix that works with the longer file names using whatever Win32 APIs work (while still validating file paths). As long as the code is clean and tests pass I'll be more than happy to accept PRs there.
from lessmsi.
Thank you. I did some experiments with libmspack4n in order to move the handling of long paths there, as you suggested, and it almost works: while the call to mspack_invoke_mscab_decompressor_extract
handles long paths correctly, the same method (ExtractTo
) then proceeds with some time-stamp and attribute modification in .NET code which I had to comment out. Converting those (File.SetCreationTime
, File.SetLastWriteTime
and File.SetAttributes
) to win32 calls as well should do the trick, I suppose.
Half-finished patch attached to show what I mean; it's the first time I use either C# or Visual Studio, so please show some mercy. I could try finishing the patch with win32 calls for setting the file attributes and time-stamps if you agree that it is the correct solution.
libmspack4n-longfilename-unfinished.patch.txt
from lessmsi.
@mattiase Thanks! I have no concerns on the approach. As long as tests pass, I'll pull it.
from lessmsi.
Good, I shall have a patch finished by tomorrow. Right now the tests don't work outside your timezone; something needs to be done about that. The timestamps in .CAB files lack any timezone information and are treated as local times when files are extracted. However, the metadata reference files for the tests contain dates with specified timezones, making them absolute points in time. As a result, these tests always fail when I run them here.
The simplest fix is to remove the timezone information from all .csv files under TestFiles/ExpectedOutput: just delete the "-08:00" or "-07:00" suffix of each time stamp (usually two per line). The test will then treat these timestamps as local times, and the test succeeds no matter where on Earth they are run.
I could send you a patch for this if you like, but it's just a simple mechanical change, and the generation code should be updated accordingly as well so that they will be generated without the timezone part next time.
from lessmsi.
thanks. love the idea of removing timezone suffix from generation code and test files!
Looking forward to the PRs!.
from lessmsi.
The pull requests are there, one for libmspack4n and one for lessmsi.
from lessmsi.
Thanks for the PRs! I'll get to these as soon as I can. Probably this weekend. Thanks again!
On Apr 19, 2016, at 01:17, mattiase [email protected] wrote:
The pull requests are there, one for libmspack4n and one for lessmsi.
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
from lessmsi.
@mattiase thanks again for the PRs. Can you point me to a msi that actually exhibits this problem so that I can double-check it before creating a release?
from lessmsi.
You can use any MSI that you have, as long as you unpack it into a directory long enough so that the combined length of the base directory and at least one of the files in the MSI exceeds 260 characters.
For instance, the longest file name inside python-2.7.3.msi
file in your tree is SourceDir/Windows/winsxs/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91/x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375.manifest
at 173 characters. If you try unpacking that MSI into a directory that is at least 260-173 = 87 characters long, then it will fail without the fix, but succeed with the fix.
Try, for instance, the directory c:\my\own\very\very\very\unusually\long\directory\name\with\cream\sugar\and\chocolate\topping
(I just did!) and you will see.
from lessmsi.
Doh, guess I should have thought that through, but thanks for the specific example. I gave this a shot and even with the libmspack4n updates, still encounter a problem. Seems that GetTargetDirectory in Wixtracts (LessMsi.Core) is trying to use System.IO to identify the target directory and it ran into problems. I'm working on fixes for that, but before I continue, I want to make sure that I'm not missing anything. Don't you encounter the same thing? I'm using what is currently in master.
P.S. I found it kind of funny that almost nothing works with those paths. Even cmd.exe, total commander, and more all had weird failures. Good thing I have cygwin and bash installed which work fine with the long windows paths 😜
from lessmsi.
It does work for me in the extract-all-to-directory form, lessmsi x package.msi destdir\
, and that's what we primarily use lessmsi for. Are you selecting a specific directory to extract?
Yes, those "extended" paths aren't recognised much even by Microsoft's own tools, but often they are the only way out. I mostly use cygwin too.
from lessmsi.
It is true that if the combined length of the destination root directory and the longest directory of any file being extracted exceeds 260 characters, then extraction still fails (in GetTargetDirectory
, as you observe). That was not a problem I had, but someone else might; in that case, a few more operations need to be replaced with win32 calls: Directory.CreateDirectory
in GetTargetDirectory
, and a few calls to File.Exists
and Directory.Exists
. In addition, some Path.Combine
operations need to be replaced with plain string concatenations.
I have no immediate plan to do this right now. Is it holding up a release for you?
from lessmsi.
@mattiase sorry for my delay on this. Thanks for confirming that I'm not missing anything. I have a local branch here where I'm working on this. I'm swamped right now with a combination of work and personal activities, but I hope to get back to this and wrap it up over the next week or two.
from lessmsi.
@mattiase could you please try the branch at https://github.com/activescott/lessmsi/tree/tested_support_for_long_paths and see if it works for you and your needs. I tried to add support throughout. If you run into something not working I'd love to have a test added.
from lessmsi.
That branch (tested_support_for_long_paths
) works for my purposes (absolute path of longest destination file exceeds 260 characters but not its parent directory), but it already worked after my submitted fix that you commited.
However, even in this branch, I wasn't able to extract python-2.7.3.msi
to a directory 166 characters long; the call to Directory.CreateDirectory
in LessMsi.Msi.Wixtracts.GetTargetDirectory
fails.
from lessmsi.
Okay the branch at https://github.com/activescott/lessmsi/tree/tested_support_for_long_paths contains a longer output path which revealed more issues throughout the code and this latest commit now has a fix for them.
@mattiase I will be grateful if you can give that code a quick build and test to make sure it's all working for you now.
from lessmsi.
Thank you! It seems to work as far as I have tested it, but I haven't tried it on UNC paths, and I wonder if the conversion to extended path form is done correctly. Unless I'm mistaken, the long form of \\server\thing\stuff
is not anything like \\?\\\server\thing\stuff
but literally \\?\UNC\server\thing\stuff
, as implemented in MSCompressedFile.LongFilename
.
from lessmsi.
I tried extracting to an UNC path, and it does not work at all (even for short paths) because of the reason described in my previous comment.
from lessmsi.
Thanks for the feedback. Its on my list
from lessmsi.
Only thing left is:
- UNC Paths in activescott/LessIO#3
from lessmsi.
I believe this has been resolved back with recent versions of LessIO. I'm not sure if any window application -including windows explorer- supports long paths as well as LessMSI now :)
Let me know if I'm missing something and I'll fix it.
from lessmsi.
Thank you – unfortunately I'm no longer in a position to verify its functioning in this respect, but I'll take your word for it.
from lessmsi.
Related Issues (20)
- Failed to extract files from KutoolsforExcelSetup.msi HOT 3
- LessMSI 1.8.1 - About window with text string too big HOT 1
- This msi file references a CAB file that is not embedded inside of the msi file itself. HOT 1
- Add an overwrite option HOT 9
- Unable to "Copy" non-embedded CAB file in same folder as MSI, if Source Path = Destination Path HOT 2
- Cannot open 'MicrosoftEdgeEnterpriseX64.msi' (v97.0.1072.55) HOT 2
- Extract files w/out paths? HOT 8
- allow unpack msi if some cab are missing HOT 3
- Not working any more for all .msi packages HOT 3
- Return non-zero exit code on error HOT 2
- How to deploy leemsi on linux? HOT 3
- Extraction done into explorer directory: Should be "Download" directory HOT 1
- Addding The script support HOT 3
- Extraction Error HOT 11
- `[file_names]` wildcard and/or regex support
- Incomplete and duplicated DLLs HOT 11
- Error closing lessmsi-gui - permission issue HOT 5
- Testfiles in lessmsi-v2.0.0 HOT 3
- Doing "Extract" on this MSI file produces no results HOT 6
- Doing "Extract" on MIDI-OX MSI file produces no results 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 lessmsi.