1
Vote

UNC Path for input file throws exception "The execution has failed due to the bug in the SevenZipSharp."

description

I am developing a routine to compress log files from several server on a network, have a share on my local machine to simulate using UNC paths for input folders while developing but cannot get it to work.
If I substitute the Drive Letter and Path for the UNC portion of the file name I have no problems.
 
I am compiling from source using SVN revision: 35540
 
hresult from CheckedExecute(int hresult, string message, SevenZipBase handler)
is -2147023446
 
Archive is attached
 
 
I check for the existence of the archive file, if it exists :
sevenZip.CompressionMode = CompressionMode.Append; 
else
sevenZip.CompressionMode = CompressionMode.Create;
 
sevenZip.CompressFiles(zipFile, sourceFile);
 
 
*************** ERROR USING UNC PATH FOR INPUT FILE ***************
2009-11-24 04:30:30,296 [4964] INFO Processing Job: TMGEnrollDemo-Wrapper
2009-11-24 04:30:30,296 [4964] INFO Job Type: compress
2009-11-24 04:30:30,296 [4964] INFO Overwrite mode: False
2009-11-24 04:30:30,296 [4964] INFO sourcePath: \192.168.30.5\JBoss\server\default\log\wrapper
2009-11-24 04:30:30,296 [4964] INFO destinationPath: \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\
2009-11-24 04:30:30,296 [4964] INFO sourceFileSpec: wrapper.log.
2009-11-24 04:30:30,296 [4964] INFO dtPrefix: yyyyMMddhhmm_
2009-11-24 04:30:30,296 [4964] INFO dtSource: dtCreate
2009-11-24 04:30:30,296 [4964] INFO ignoreList: wrapper.log
2009-11-24 04:30:30,296 [4964] INFO Compression Level: Ultra
2009-11-24 04:30:30,296 [4964] INFO Archive Format: SevenZip
2009-11-24 04:30:30,296 [4964] INFO Archive FileName:
2009-11-24 04:30:30,296 [4964] INFO Archive File Extension: .7z
2009-11-24 04:30:30,296 [4964] INFO sourceFileSpec: wrapper.log.
2009-11-24 04:30:30,312 [4964] INFO Searching: \192.168.30.5\JBoss\server\default\log\wrapper
2009-11-24 04:30:30,312 [4964] INFO Found: 3 wrapper.log. files to process
2009-11-24 04:30:30,312 [4964] INFO Create - Compressing file: \192.168.30.5\JBoss\server\default\log\wrapper\wrapper.log.1 to \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\200911220330_TMGEnrollDemo-Wrapper.7z
2009-11-24 04:33:28,453 [4964] WARN
SevenZip.SevenZipException: The execution has failed due to the bug in the SevenZipSharp.
Please report about it to http://sevenzipsharp.codeplex.com/WorkItem/List.aspx, post the release number and attach the archive.
at SevenZip.SevenZipBase.ThrowException(SevenZipBase handler, Exception[] e) in C:\SCODE\SevenZipSharp\SevenZip\Common.cs:line 134
at SevenZip.SevenZipBase.CheckedExecute(Int32 hresult, String message, SevenZipBase handler) in C:\SCODE\SevenZipSharp\SevenZip\Common.cs:line 174
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(Stream archiveStream, Int32 commonRootLength, String password, String[] fileFullNames) in C:\SCODE\SevenZipSharp\SevenZip\SevenZipCompressor.cs:line 1084
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, Int32 commonRootLength, String password, String[] fileFullNames) in C:\SCODE\SevenZipSharp\SevenZip\SevenZipCompressor.cs:line 1007
at SevenZip.SevenZipCompressor.CompressFilesEncrypted(String archiveName, String password, String[] fileFullNames) in C:\SCODE\SevenZipSharp\SevenZip\SevenZipCompressor.cs:line 973
at SevenZip.SevenZipCompressor.CompressFiles(String archiveName, String[] fileFullNames) in C:\SCODE\SevenZipSharp\SevenZip\SevenZipCompressor.cs:line 924
at FileMover.MainClass.Main(String[] args) in C:\SCODE\TMG\appdev\CommonApps\FileMover\FileMover\Main.cs:line 287
 
 
 
*************** NO ERROR USING DRIVE LETTER FOR INPUT FILE ***************
2009-11-24 05:04:25,781 [6100] INFO Processing Job: TMGEnrollDemo-Wrapper
2009-11-24 05:04:25,781 [6100] INFO Job Type: compress
2009-11-24 05:04:25,781 [6100] INFO Overwrite mode: False
2009-11-24 05:04:25,781 [6100] INFO sourcePath: C:\Temp\JBoss\server\default\log\wrapper
2009-11-24 05:04:25,781 [6100] INFO destinationPath: \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\
2009-11-24 05:04:25,781 [6100] INFO sourceFileSpec: wrapper.log.
2009-11-24 05:04:25,781 [6100] INFO dtPrefix: yyyyMMddhhmm_
2009-11-24 05:04:25,781 [6100] INFO dtSource: dtCreate
2009-11-24 05:04:25,781 [6100] INFO ignoreList: wrapper.log
2009-11-24 05:04:25,781 [6100] INFO Compression Level: Ultra
2009-11-24 05:04:25,781 [6100] INFO Archive Format: SevenZip
2009-11-24 05:04:25,781 [6100] INFO Archive FileName:
2009-11-24 05:04:25,781 [6100] INFO Archive File Extension: .7z
2009-11-24 05:04:25,781 [6100] INFO sourceFileSpec: wrapper.log.
2009-11-24 05:04:25,781 [6100] INFO Searching: C:\Temp\JBoss\server\default\log\wrapper
2009-11-24 05:04:25,796 [6100] INFO Found: 3 wrapper.log. files to process
2009-11-24 05:04:25,796 [6100] INFO Create - Compressing file: C:\Temp\JBoss\server\default\log\wrapper\wrapper.log.1 to \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\200911220330_TMGEnrollDemo-Wrapper.7z
2009-11-24 05:04:41,484 [6100] INFO Append - Compressing file: C:\Temp\JBoss\server\default\log\wrapper\wrapper.log.2 to \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\200911220330_TMGEnrollDemo-Wrapper.7z
2009-11-24 05:04:58,109 [6100] INFO Append - Compressing file: C:\Temp\JBoss\server\default\log\wrapper\wrapper.log.3 to \192.168.30.5\TMGEnrollLogs\tmgenrolldemo\Jboss\Wrapper\200911220330_TMGEnrollDemo-Wrapper.7z

file attachments

comments

markhor wrote Feb 7, 2010 at 4:35 PM

Failed to reproduce your issue. I successfully compress files with paths like \pc\Dir\file.txt. I also get it to work with ipv6 paths. I can not check ipv4 paths like \192.168.0.3\Dir\file.txt as it seems my local area works only on ipv6 (Win 7). Put breakpoints at the end of GetUpdateItemInfo, GetProperty and GetStream, so you will debug where the actual exception occurs.

warrenthebrown wrote Mar 3, 2011 at 8:15 PM

Calling compressor with a list of files including the following one:
\glacier\Development\QA Packages\Utilities\DebugHound\Packages\DebugHound (1.1) 043 - General Release.xml

The following block of code in ProduceFileInfoArray is problematic because of the Split(Path.DirectorySeparatorChar) not properly dealing with the leading UNC path portion:
                    foreach (string f in files)
                    {
                        string[] splittedAfn = f.Substring(commonRootLength).Split(Path.DirectorySeparatorChar);
                        string cfn = splittedAfn[0];
                        for (int i = 1; i < splittedAfn.Length; i++)
                        {
                            cfn += Path.DirectorySeparatorChar + splittedAfn[i];
                            if (!fns.Contains(cfn))
                            {
                                fis.Add(new FileInfo(cfn));
                                fns.Add(cfn);
                            }
                        }
Thank you.

warrenthebrown wrote Apr 20, 2011 at 8:19 PM

To reproduce the issue, be sure that the list of files includes both logical drive and unc variants. e.g.

c:\test\file1.txt
\testsystem\something\file2.txt

wrote Feb 22, 2013 at 1:16 AM