Archived Forum Post

Index of archived forum posts

Question:

tar.Untar extracts more than one file even though .MustMatch is set

Sep 23 '15 at 09:56

Event though I’ve set the .MustMatch, all files contained in the tar file coming before the file I want is also extracted. Please help

                tar.SuppressOutput = true;
                tar.UntarFromDir = tempPath;
                tar.NoAbsolutePaths = true;
                tar.MustMatch = sourceFileName;
                tar.UntarMatchPattern = sourceFileName;
                //tar.UntarMaxCount = 1;
                tar.UntarDiscardPaths = true;
                int fileCount = tar.Untar(XbkFileName);
                if (fileCount < 0)
                {
                    extractResult = tar.LastErrorText;
                }

Answer

Please turn on VerboseLogging (tar.VerboseLogging = true) and then post the contents of the tar.LastErrorText after calling Untar. (I realize that Untar was success -- the LastErrorText always contains information regardless of success/failure.)


Answer

I'm in contact with Matt/support and will take it there


Answer

Thanks. Setting the SuppressOutput = true caused the must-match pattern to be ignored (because nothing would be extracted anyway). However, the fileCount was incremented without regard to the match patterns. (There was no danger in extracting files that did not match. It was only the returned fileCount that was incorrect. It was counting all files for the case when SuppressOutput is true.)

I will provide a fix in private email.