Hello community, here is the log from the commit of package unrar for openSUSE:Factory:NonFree checked in at 2020-10-24 15:12:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory:NonFree/unrar (Old) and /work/SRC/openSUSE:Factory:NonFree/.unrar.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "unrar" Sat Oct 24 15:12:11 2020 rev:91 rq:843430 version:6.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory:NonFree/unrar/unrar.changes 2020-07-18 20:59:14.911371711 +0200 +++ /work/SRC/openSUSE:Factory:NonFree/.unrar.new.3463/unrar.changes 2020-10-24 15:12:12.415858590 +0200 @@ -1,0 +2,6 @@ +Thu Oct 22 12:41:55 UTC 2020 - Ismail Dönmez <idon...@suse.com> + +- Update to version 6.0.1 + * Based on WinRAR 6.00 beta 1 + +------------------------------------------------------------------- Old: ---- unrarsrc-5.9.4.tar.gz New: ---- unrarsrc-6.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ unrar.spec ++++++ --- /var/tmp/diff_new_pack.tzjXVW/_old 2020-10-24 15:12:13.263859649 +0200 +++ /var/tmp/diff_new_pack.tzjXVW/_new 2020-10-24 15:12:13.267859653 +0200 @@ -18,9 +18,9 @@ # majorversion should match the major version number. %define majorversion 5 -%define libsuffix 5_9_4 +%define libsuffix 6_0_1 Name: unrar -Version: 5.9.4 +Version: 6.0.1 Release: 0 Summary: A program to extract, test, and view RAR archives License: NonFree ++++++ unrarsrc-5.9.4.tar.gz -> unrarsrc-6.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/cmddata.cpp new/unrar/cmddata.cpp --- old/unrar/cmddata.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/cmddata.cpp 2020-10-22 10:48:21.000000000 +0200 @@ -56,7 +56,6 @@ // In Windows we may prefer to implement our own command line parser // to avoid replacing \" by " in standard parser. Such replacing corrupts // destination paths like "dest path\" in extraction commands. - // Also our own parser is Unicode compatible. const wchar *CmdLine=GetCommandLine(); wchar *Par; @@ -288,7 +287,10 @@ AppendArcNameToPath=APPENDARCNAME_DESTPATH; else if (Switch[2]=='1') - AppendArcNameToPath=APPENDARCNAME_OWNDIR; + AppendArcNameToPath=APPENDARCNAME_OWNSUBDIR; + else + if (Switch[2]=='2') + AppendArcNameToPath=APPENDARCNAME_OWNDIR; break; #ifndef SFX_MODULE case 'G': @@ -436,9 +438,9 @@ wcsncpyz(EmailTo,Switch[4]!=0 ? Switch+4:L"@",ASIZE(EmailTo)); break; } - if (wcsicomp(Switch+1,L"M")==0) + if (wcsicomp(Switch+1,L"M")==0) // For compatibility with pre-WinRAR 6.0 -im syntax. Replaced with -idv. { - MoreInfo=true; + VerboseOutput=true; break; } if (wcsicomp(Switch+1,L"NUL")==0) @@ -465,6 +467,12 @@ case 'P': DisablePercentage=true; break; + case 'N': + DisableNames=true; + break; + case 'V': + VerboseOutput=true; + break; } break; } @@ -539,7 +547,6 @@ case 'D': Type=FILTER_DELTA; break; case 'A': Type=FILTER_AUDIO; break; case 'C': Type=FILTER_RGB; break; - case 'I': Type=FILTER_ITANIUM; break; case 'R': Type=FILTER_ARM; break; } if (*Str=='+' || *Str=='-') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/cmddata.hpp new/unrar/cmddata.hpp --- old/unrar/cmddata.hpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/cmddata.hpp 2020-10-22 10:48:21.000000000 +0200 @@ -11,7 +11,6 @@ class CommandData:public RAROptions { private: - void ProcessSwitchesString(const wchar *Str); void ProcessSwitch(const wchar *Switch); void BadSwitch(const wchar *Switch); uint GetExclAttr(const wchar *Str,bool &Dir); @@ -34,6 +33,7 @@ void ParseEnvVar(); void ReadConfig(); void PreprocessArg(const wchar *Arg); + void ProcessSwitchesString(const wchar *Str); void OutTitle(); void OutHelp(RAR_EXIT ExitCode); bool IsSwitch(int Ch); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/consio.cpp new/unrar/consio.cpp --- old/unrar/consio.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/consio.cpp 2020-10-22 10:48:21.000000000 +0200 @@ -305,7 +305,7 @@ for (int I=0;I<NumItems;I++) { - eprintf(I==0 ? (NumItems>4 ? L"\n":L" "):L", "); + eprintf(I==0 ? (NumItems>3 ? L"\n":L" "):L", "); int KeyPos=ItemKeyPos[I]; for (int J=0;J<KeyPos;J++) eprintf(L"%c",Item[I][J]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/dll.cpp new/unrar/dll.cpp --- old/unrar/dll.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/dll.cpp 2020-10-22 10:48:21.000000000 +0200 @@ -474,6 +474,7 @@ switch(ErrCode) { case RARX_FATAL: + case RARX_READ: return ERAR_EREAD; case RARX_CRC: return ERAR_BAD_DATA; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/dll.rc new/unrar/dll.rc --- old/unrar/dll.rc 2020-06-25 12:35:32.000000000 +0200 +++ new/unrar/dll.rc 2020-10-22 00:31:03.000000000 +0200 @@ -2,8 +2,8 @@ #include <commctrl.h> VS_VERSION_INFO VERSIONINFO -FILEVERSION 5, 91, 100, 3470 -PRODUCTVERSION 5, 91, 100, 3470 +FILEVERSION 6, 0, 1, 3589 +PRODUCTVERSION 6, 0, 1, 3589 FILEOS VOS__WINDOWS32 FILETYPE VFT_APP { @@ -14,8 +14,8 @@ VALUE "CompanyName", "Alexander Roshal\0" VALUE "ProductName", "RAR decompression library\0" VALUE "FileDescription", "RAR decompression library\0" - VALUE "FileVersion", "5.91.0\0" - VALUE "ProductVersion", "5.91.0\0" + VALUE "FileVersion", "6.0.1\0" + VALUE "ProductVersion", "6.0.1\0" VALUE "LegalCopyright", "Copyright � Alexander Roshal 1993-2020\0" VALUE "OriginalFilename", "Unrar.dll\0" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/errhnd.cpp new/unrar/errhnd.cpp --- old/unrar/errhnd.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/errhnd.cpp 2020-10-22 10:48:22.000000000 +0200 @@ -15,6 +15,7 @@ UserBreak=false; MainExit=false; DisableShutdown=false; + ReadErrIgnoreAll=false; } @@ -56,24 +57,34 @@ ReadErrorMsg(FileName); #endif #if !defined(SILENT) || defined(RARDLL) - Exit(RARX_FATAL); + Exit(RARX_READ); #endif } -bool ErrorHandler::AskRepeatRead(const wchar *FileName) +void ErrorHandler::AskRepeatRead(const wchar *FileName,bool &Ignore,bool &Retry,bool &Quit) { + SetErrorCode(RARX_READ); #if !defined(SILENT) && !defined(SFX_MODULE) if (!Silent) { + uiMsg(UIERROR_FILEREAD,UINULL,FileName); SysErrMsg(); - bool Repeat=uiAskRepeatRead(FileName); - if (!Repeat) // Disable shutdown if user pressed Cancel in error dialog. - DisableShutdown=true; - return Repeat; + if (ReadErrIgnoreAll) + Ignore=true; + else + { + bool All=false; + uiAskRepeatRead(FileName,Ignore,All,Retry,Quit); + if (All) + ReadErrIgnoreAll=Ignore=true; + if (Quit) // Disable shutdown if user select Quit in read error prompt. + DisableShutdown=true; + } + return; } #endif - return false; + Ignore=true; // Saving the file part for -y or -inul or "Ignore all" choice. } @@ -189,7 +200,7 @@ { uiMsg(UIERROR_FILEREAD,ArcName,FileName); SysErrMsg(); - SetErrorCode(RARX_FATAL); + SetErrorCode(RARX_READ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/errhnd.hpp new/unrar/errhnd.hpp --- old/unrar/errhnd.hpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/errhnd.hpp 2020-10-22 10:48:22.000000000 +0200 @@ -15,9 +15,11 @@ RARX_CREATE = 9, RARX_NOFILES = 10, RARX_BADPWD = 11, + RARX_READ = 12, RARX_USERBREAK = 255 }; + class ErrorHandler { private: @@ -26,6 +28,7 @@ bool EnableBreak; bool Silent; bool DisableShutdown; // Shutdown is not suitable after last error. + bool ReadErrIgnoreAll; public: ErrorHandler(); void Clean(); @@ -33,7 +36,7 @@ void OpenError(const wchar *FileName); void CloseError(const wchar *FileName); void ReadError(const wchar *FileName); - bool AskRepeatRead(const wchar *FileName); + void AskRepeatRead(const wchar *FileName,bool &Ignore,bool &Retry,bool &Quit); void WriteError(const wchar *ArcName,const wchar *FileName); void WriteErrorFAT(const wchar *FileName); bool AskRepeatWrite(const wchar *FileName,bool DiskFull); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/extract.cpp new/unrar/extract.cpp --- old/unrar/extract.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/extract.cpp 2020-10-22 10:48:22.000000000 +0200 @@ -42,6 +42,7 @@ Cmd->Password.Clean(); // Clean user entered password before processing next archive. ReconstructDone=false; // Must be reset here, not in ExtractArchiveInit(). + UseExactVolName=false; // Must be reset here, not in ExtractArchiveInit(). while (true) { EXTRACT_ARC_CODE Code=ExtractArchive(); @@ -140,7 +141,7 @@ return EXTRACT_ARC_NEXT; #ifndef SFX_MODULE - if (Arc.Volume && !Arc.FirstVolume) + if (Arc.Volume && !Arc.FirstVolume && !UseExactVolName) { wchar FirstVolName[NM]; VolNameToFirstName(ArcName,FirstVolName,ASIZE(FirstVolName),Arc.NewNumbering); @@ -158,6 +159,16 @@ if (Arc.Volume) { +#ifndef SFX_MODULE + // Try to speed up extraction for independent solid volumes by starting + // extraction from non-first volume if we can. + if (!UseExactVolName && Arc.Solid && DetectStartVolume(Arc.FileName,Arc.NewNumbering)) + { + UseExactVolName=true; + return EXTRACT_ARC_REPEAT; + } +#endif + // Calculate the total size of all accessible volumes. // This size is necessary to display the correct total progress indicator. @@ -318,11 +329,11 @@ Arc.ConvertAttributes(); #if !defined(SFX_MODULE) && !defined(RARDLL) - if (Arc.FileHead.SplitBefore && FirstFile) + if (Arc.FileHead.SplitBefore && FirstFile && !UseExactVolName) { wchar CurVolName[NM]; wcsncpyz(CurVolName,ArcName,ASIZE(CurVolName)); - VolNameToFirstName(ArcName,ArcName,ASIZE(ArcName),Arc.NewNumbering); + GetFirstVolIfFullSet(ArcName,Arc.NewNumbering,ArcName,ASIZE(ArcName)); if (wcsicomp(ArcName,CurVolName)!=0 && FileExist(ArcName)) { @@ -575,7 +586,7 @@ TotalFileCount++; } FileCount++; - if (Command!='I') + if (Command!='I' && !Cmd->DisableNames) if (SkipSolid) mprintf(St(MExtrSkipFile),ArcFileName); else @@ -594,8 +605,10 @@ mprintf(St(MExtrFile),DestFileName); break; } - if (!Cmd->DisablePercentage) + if (!Cmd->DisablePercentage && !Cmd->DisableNames) mprintf(L" "); + if (Cmd->DisableNames) + uiEolAfterMsg(); // Avoid erasing preceding messages by percentage indicator in -idn mode. DataIO.CurUnpRead=0; DataIO.CurUnpWrite=0; @@ -711,7 +724,7 @@ { if (ValidCRC) { - if (Command!='P' && Command!='I') + if (Command!='P' && Command!='I' && !Cmd->DisableNames) mprintf(L"%s%s ",Cmd->DisablePercentage ? L" ":L"\b\b\b\b\b ", Arc.FileHead.FileHash.Type==HASH_NONE ? L" ?":St(MOk)); } @@ -781,7 +794,13 @@ Arc.FileHead.FileAttr&=~FILE_ATTRIBUTE_ARCHIVE; #endif if (!Cmd->IgnoreGeneralAttr && !SetFileAttr(DestFileName,Arc.FileHead.FileAttr)) + { uiMsg(UIERROR_FILEATTR,Arc.FileName,DestFileName); + // Android cannot set file attributes and while UIERROR_FILEATTR + // above is handled by Android RAR silently, this call would cause + // "Operation not permitted" message for every unpacked file. + ErrHandler.SysErrMsg(); + } PrevProcessed=true; } @@ -874,11 +893,21 @@ #ifndef SFX_MODULE if (Cmd->AppendArcNameToPath!=APPENDARCNAME_NONE) { - if (Cmd->AppendArcNameToPath==APPENDARCNAME_DESTPATH) - wcsncatz(DestName,PointToName(Arc.FirstVolumeName),DestSize); - else - wcsncpyz(DestName,Arc.FirstVolumeName,DestSize); // To archive own dir. - SetExt(DestName,NULL,DestSize); + switch(Cmd->AppendArcNameToPath) + { + case APPENDARCNAME_DESTPATH: // To subdir of destination path. + wcsncatz(DestName,PointToName(Arc.FirstVolumeName),DestSize); + SetExt(DestName,NULL,DestSize); + break; + case APPENDARCNAME_OWNSUBDIR: // To subdir of archive own dir. + wcsncpyz(DestName,Arc.FirstVolumeName,DestSize); + SetExt(DestName,NULL,DestSize); + break; + case APPENDARCNAME_OWNDIR: // To archive own dir. + wcsncpyz(DestName,Arc.FirstVolumeName,DestSize); + RemoveNameFromPath(DestName); + break; + } AddEndSlash(DestName,DestSize); } #endif @@ -1048,8 +1077,11 @@ { if (Cmd->Test) { - mprintf(St(MExtrTestFile),ArcFileName); - mprintf(L" %s",St(MOk)); + if (!Cmd->DisableNames) + { + mprintf(St(MExtrTestFile),ArcFileName); + mprintf(L" %s",St(MOk)); + } return; } @@ -1086,8 +1118,11 @@ } if (MDCode==MKDIR_SUCCESS) { - mprintf(St(MCreatDir),DestFileName); - mprintf(L" %s",St(MOk)); + if (!Cmd->DisableNames) + { + mprintf(St(MCreatDir),DestFileName); + mprintf(L" %s",St(MOk)); + } PrevProcessed=true; } else @@ -1141,6 +1176,9 @@ if (!UserReject) { ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName); + if (FileExist(DestFileName) && IsDir(GetFileAttr(DestFileName))) + uiMsg(UIERROR_DIRNAMEEXISTS); + #ifdef RARDLL Cmd->DllError=ERAR_ECREATE; #endif @@ -1196,3 +1234,104 @@ } return !WrongVer; } + + +#ifndef SFX_MODULE +// To speed up solid volumes extraction, try to find a non-first start volume, +// which still allows to unpack all files. It is possible for independent +// solid volumes with solid statistics reset in the beginning. +bool CmdExtract::DetectStartVolume(const wchar *VolName,bool NewNumbering) +{ + wchar *ArgName=Cmd->FileArgs.GetString(); + Cmd->FileArgs.Rewind(); + if (ArgName!=NULL && (wcscmp(ArgName,L"*")==0 || wcscmp(ArgName,L"*.*")==0)) + return false; // No need to check further for * and *.* masks. + + wchar StartName[NM]; + *StartName=0; + + // Start search from first volume if all volumes preceding current are available. + wchar NextName[NM]; + GetFirstVolIfFullSet(VolName,NewNumbering,NextName,ASIZE(NextName)); + + bool Matched=false; + while (!Matched) + { + Archive Arc(Cmd); + if (!Arc.Open(NextName) || !Arc.IsArchive(false) || !Arc.Volume) + break; + + bool OpenNext=false; + while (Arc.ReadHeader()>0) + { + Wait(); + + HEADER_TYPE HeaderType=Arc.GetHeaderType(); + if (HeaderType==HEAD_ENDARC) + { + OpenNext|=Arc.EndArcHead.NextVolume; // Allow open next volume. + break; + } + if (HeaderType==HEAD_FILE) + { + if (!Arc.FileHead.SplitBefore) + { + if (!Arc.FileHead.Solid) // Can start extraction from here. + wcsncpyz(StartName,NextName,ASIZE(StartName)); + + if (Cmd->IsProcessFile(Arc.FileHead,NULL,MATCH_WILDSUBPATH,0,NULL,0)!=0) + { + Matched=true; // First matched file found, must stop further scan. + break; + } + } + if (Arc.FileHead.SplitAfter) + { + OpenNext=true; // Allow open next volume. + break; + } + } + Arc.SeekToNext(); + } + Arc.Close(); + + if (!OpenNext) + break; + + NextVolumeName(NextName,ASIZE(NextName),!Arc.NewNumbering); + } + bool NewStartFound=wcscmp(VolName,StartName)!=0; + if (NewStartFound) // Found a new volume to start extraction. + wcsncpyz(ArcName,StartName,ASIZE(ArcName)); + + return NewStartFound; +} +#endif + + +#ifndef SFX_MODULE +// Return the first volume name if all volumes preceding the specified +// are available. Otherwise return the specified volume name. +void CmdExtract::GetFirstVolIfFullSet(const wchar *SrcName,bool NewNumbering,wchar *DestName,size_t DestSize) +{ + wchar FirstVolName[NM]; + VolNameToFirstName(SrcName,FirstVolName,ASIZE(FirstVolName),NewNumbering); + wchar NextName[NM]; + wcsncpyz(NextName,FirstVolName,ASIZE(NextName)); + wchar ResultName[NM]; + wcsncpyz(ResultName,SrcName,ASIZE(ResultName)); + while (true) + { + if (wcscmp(SrcName,NextName)==0) + { + wcsncpyz(ResultName,FirstVolName,DestSize); + break; + } + if (!FileExist(NextName)) + break; + NextVolumeName(NextName,ASIZE(NextName),!NewNumbering); + } + wcsncpyz(DestName,ResultName,DestSize); +} + +#endif \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/extract.hpp new/unrar/extract.hpp --- old/unrar/extract.hpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/extract.hpp 2020-10-22 10:48:22.000000000 +0200 @@ -20,8 +20,12 @@ void ExtrCreateDir(Archive &Arc,const wchar *ArcFileName); bool ExtrCreateFile(Archive &Arc,File &CurFile); bool CheckUnpVer(Archive &Arc,const wchar *ArcFileName); +#ifndef SFX_MODULE + bool DetectStartVolume(const wchar *VolName,bool NewNumbering); + void GetFirstVolIfFullSet(const wchar *SrcName,bool NewNumbering,wchar *DestName,size_t DestSize); +#endif - RarTime StartTime; // time when extraction started + RarTime StartTime; // Time when extraction started. CommandData *Cmd; @@ -34,6 +38,7 @@ bool FirstFile; bool AllMatchesExact; bool ReconstructDone; + bool UseExactVolName; // If any non-zero solid file was successfully unpacked before current. // If true and if current encrypted file is broken, obviously diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/file.cpp new/unrar/file.cpp --- old/unrar/file.cpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/file.cpp 2020-10-22 10:48:22.000000000 +0200 @@ -8,7 +8,6 @@ LastWrite=false; HandleType=FILE_HANDLENORMAL; SkipClose=false; - IgnoreReadErrors=false; ErrorType=FILE_SUCCESS; OpenShared=false; AllowDelete=true; @@ -18,6 +17,8 @@ NoSequentialRead=false; CreateMode=FMF_UNDEFINED; #endif + ReadErrorMode=FREM_ASK; + TruncatedAfterReadError=false; } @@ -37,6 +38,7 @@ NewFile=SrcFile.NewFile; LastWrite=SrcFile.LastWrite; HandleType=SrcFile.HandleType; + TruncatedAfterReadError=SrcFile.TruncatedAfterReadError; wcsncpyz(FileName,SrcFile.FileName,ASIZE(FileName)); SrcFile.SkipClose=true; } @@ -146,6 +148,7 @@ { hFile=hNewFile; wcsncpyz(FileName,Name,ASIZE(FileName)); + TruncatedAfterReadError=false; } return Success; } @@ -369,9 +372,12 @@ int File::Read(void *Data,size_t Size) { + if (TruncatedAfterReadError) + return 0; + int64 FilePos=0; // Initialized only to suppress some compilers warning. - if (IgnoreReadErrors) + if (ReadErrorMode==FREM_IGNORE) FilePos=Tell(); int ReadSize; while (true) @@ -381,7 +387,7 @@ { ErrorType=FILE_READERROR; if (AllowExceptions) - if (IgnoreReadErrors) + if (ReadErrorMode==FREM_IGNORE) { ReadSize=0; for (size_t I=0;I<Size;I+=512) @@ -394,8 +400,18 @@ } else { - if (HandleType==FILE_HANDLENORMAL && ErrHandler.AskRepeatRead(FileName)) - continue; + bool Ignore=false,Retry=false,Quit=false; + if (ReadErrorMode==FREM_ASK && HandleType==FILE_HANDLENORMAL) + { + ErrHandler.AskRepeatRead(FileName,Ignore,Retry,Quit); + if (Retry) + continue; + } + if (Ignore || ReadErrorMode==FREM_TRUNCATE) + { + TruncatedAfterReadError=true; + return 0; + } ErrHandler.ReadError(FileName); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/file.hpp new/unrar/file.hpp --- old/unrar/file.hpp 2020-06-25 12:40:37.000000000 +0200 +++ new/unrar/file.hpp 2020-10-22 10:48:22.000000000 +0200 @@ -46,6 +46,12 @@ FMF_UNDEFINED=256 }; +enum FILE_READ_ERROR_MODE { + FREM_ASK, // Propose to use the already read part, retry or abort. + FREM_TRUNCATE, // Use the already read part without additional prompt. + FREM_IGNORE // Try to skip unreadable block and read further. +}; + class File { @@ -54,7 +60,7 @@ bool LastWrite; FILE_HANDLETYPE HandleType; bool SkipClose; - bool IgnoreReadErrors; + FILE_READ_ERROR_MODE ReadErrorMode; bool NewFile; bool AllowDelete; bool AllowExceptions; @@ -63,6 +69,7 @@ uint CreateMode; #endif bool PreserveAtime; + bool TruncatedAfterReadError; protected: bool OpenShared; // Set by 'Archive' class. public: @@ -108,7 +115,7 @@ static bool RemoveCreated(); FileHandle GetHandle() {return hFile;} void SetHandle(FileHandle Handle) {Close();hFile=Handle;} - void SetIgnoreReadErrors(bool Mode) {IgnoreReadErrors=Mode;} + void SetReadErrorMode(FILE_READ_ERROR_MODE Mode) {ReadErrorMode=Mode;} int64 Copy(File &Dest,int64 Length=INT64NDF); void SetAllowDelete(bool Allow) {AllowDelete=Allow;} void SetExceptions(bool Allow) {AllowExceptions=Allow;} @@ -116,6 +123,7 @@ void RemoveSequentialFlag() {NoSequentialRead=true;} #endif void SetPreserveAtime(bool Preserve) {PreserveAtime=Preserve;} + bool IsTruncatedAfterReadError() {return TruncatedAfterReadError;} #ifdef _UNIX int GetFD() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/list.cpp new/unrar/list.cpp --- old/unrar/list.cpp 2020-06-25 12:40:38.000000000 +0200 +++ new/unrar/list.cpp 2020-10-22 10:48:22.000000000 +0200 @@ -28,7 +28,7 @@ if (!Arc.WOpen(ArcName)) continue; bool FileMatched=true; - while (1) + while (true) { int64 TotalPackSize=0,TotalUnpSize=0; uint FileCount=0; @@ -69,7 +69,7 @@ wchar VolNumText[50]; *VolNumText=0; - while(Arc.ReadHeader()>0) + while (Arc.ReadHeader()>0) { Wait(); // Allow quit listing with Ctrl+C. HEADER_TYPE HeaderType=Arc.GetHeaderType(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/loclang.hpp new/unrar/loclang.hpp --- old/unrar/loclang.hpp 2020-06-25 12:40:38.000000000 +0200 +++ new/unrar/loclang.hpp 2020-10-22 10:48:22.000000000 +0200 @@ -4,6 +4,7 @@ #define MYesNoAllRenQ L"_Yes_No_All_nEver_Rename_Quit" #define MContinueQuit L"_Continue_Quit" #define MRetryAbort L"_Retry_Abort" +#define MIgnoreAllRetryQuit L"_Ignore_iGnore all_Retry_Quit" #define MCopyright L"\nRAR %s Copyright (c) 1993-%d Alexander Roshal %d %s %d" #define MRegTo L"\nRegistered to %s\n" #define MShare L"\nTrial version Type 'rar -?' for help\n" @@ -54,7 +55,7 @@ #define MCHelpSwm L"\n - Stop switches scanning" #define MCHelpSwAT L"\n @[+] Disable [enable] file lists" #define MCHelpSwAC L"\n ac Clear Archive attribute after compression or extraction" -#define MCHelpSwAD L"\n ad Append archive name to destination path" +#define MCHelpSwAD L"\n ad[1,2] Alternate destination path" #define MCHelpSwAG L"\n ag[format] Generate archive name using the current date" #define MCHelpSwAI L"\n ai Ignore file attributes" #define MCHelpSwAO L"\n ao Add files with Archive attribute set" @@ -79,7 +80,7 @@ #define MCHelpSwF L"\n f Freshen files" #define MCHelpSwHP L"\n hp[password] Encrypt both file data and headers" #define MCHelpSwHT L"\n ht[b|c] Select hash type [BLAKE2,CRC32] for file checksum" -#define MCHelpSwIDP L"\n id[c,d,p,q] Disable messages" +#define MCHelpSwIDP L"\n id[c,d,n,p,q] Display or disable messages" #define MCHelpSwIEML L"\n ieml[addr] Send archive by email" #define MCHelpSwIERR L"\n ierr Send all messages to stderr" #define MCHelpSwILOG L"\n ilog[name] Log errors to file" @@ -380,3 +381,7 @@ #define MDictOutMem L"\nNot enough memory for %d MB compression dictionary, changed to %d MB." #define MUseSmalllerDict L"\nPlease use a smaller compression dictionary." #define MOpenErrAtime L"\nYou may need to remove -tsp switch to open this file." +#define MErrReadInfo L"\nChoose 'Ignore' to continue with the already read file part only, 'Ignore all' to do it for all read errors, 'Retry' to repeat read and 'Quit' to abort." +#define MErrReadTrunc L"\n%s is archived incompletely because of read error.\n" +#define MErrReadCount L"\n%u files are archived incompletely because of read errors." +#define MDirNameExists L"\nDirectory with such name already exists" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/options.hpp new/unrar/options.hpp --- old/unrar/options.hpp 2020-06-25 12:40:38.000000000 +0200 +++ new/unrar/options.hpp 2020-10-22 10:48:22.000000000 +0200 @@ -61,7 +61,8 @@ enum APPENDARCNAME_MODE { - APPENDARCNAME_NONE=0,APPENDARCNAME_DESTPATH,APPENDARCNAME_OWNDIR + APPENDARCNAME_NONE=0,APPENDARCNAME_DESTPATH,APPENDARCNAME_OWNSUBDIR, + APPENDARCNAME_OWNDIR }; enum POWER_MODE { @@ -132,6 +133,7 @@ bool DisablePercentage; bool DisableCopyright; bool DisableDone; + bool DisableNames; bool PrintVersion; int Solid; int SolidCount; @@ -146,7 +148,7 @@ Array<int64> NextVolSizes; uint CurVolNum; bool AllYes; - bool MoreInfo; // -im, show more information, used only in "WinRAR t" now. + bool VerboseOutput; // -iv, display verbose output, used only in "WinRAR t" now. bool DisableSortSolid; int ArcTime; int ConvertNames; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/pathfn.cpp new/unrar/pathfn.cpp --- old/unrar/pathfn.cpp 2020-06-25 12:40:38.000000000 +0200 +++ new/unrar/pathfn.cpp 2020-10-22 10:48:22.000000000 +0200 @@ -655,7 +655,7 @@ } if (!FileExist(FirstName)) { - // If the first volume, which name we just generated, is not exist, + // If the first volume, which name we just generated, does not exist, // check if volume with same name and any other extension is available. // It can help in case of *.exe or *.sfx first volume. wchar Mask[NM]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/ui.hpp new/unrar/ui.hpp --- old/unrar/ui.hpp 2020-06-25 12:40:39.000000000 +0200 +++ new/unrar/ui.hpp 2020-10-22 10:48:23.000000000 +0200 @@ -38,7 +38,8 @@ UIERROR_PATHTOOLONG, UIERROR_DIRSCAN, UIERROR_UOWNERGET, UIERROR_UOWNERBROKEN, UIERROR_UOWNERGETOWNERID, UIERROR_UOWNERGETGROUPID, UIERROR_UOWNERSET, UIERROR_ULINKREAD, UIERROR_ULINKEXIST, - UIERROR_OPENPRESERVEATIME, + UIERROR_OPENPRESERVEATIME, UIERROR_READERRTRUNCATED, UIERROR_READERRCOUNT, + UIERROR_DIRNAMEEXISTS, UIMSG_FIRST, UIMSG_STRING, UIMSG_BUILD, UIMSG_RRSEARCH, UIMSG_ANALYZEFILEDATA, @@ -92,16 +93,18 @@ enum UIALARM_TYPE {UIALARM_ERROR, UIALARM_INFO, UIALARM_QUESTION}; void uiAlarm(UIALARM_TYPE Type); +void uiEolAfterMsg(); bool uiAskNextVolume(wchar *VolName,size_t MaxSize); -bool uiAskRepeatRead(const wchar *FileName); +#if !defined(SILENT) && !defined(SFX_MODULE) +void uiAskRepeatRead(const wchar *FileName,bool &Ignore,bool &All,bool &Retry,bool &Quit); +#endif bool uiAskRepeatWrite(const wchar *FileName,bool DiskFull); #ifndef SFX_MODULE const wchar *uiGetMonthName(int Month); #endif - class uiMsgStore { private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/uiconsole.cpp new/unrar/uiconsole.cpp --- old/unrar/uiconsole.cpp 2020-06-25 12:40:39.000000000 +0200 +++ new/unrar/uiconsole.cpp 2020-10-22 10:48:23.000000000 +0200 @@ -1,3 +1,5 @@ +static bool AnyMessageDisplayed=0; // For console -idn switch. + // Purely user interface function. Gets and returns user input. UIASKREP_RESULT uiAskReplace(wchar *Name,size_t MaxNameSize,int64 FileSize,RarTime *FileTime,uint Flags) { @@ -83,6 +85,8 @@ void uiMsgStore::Msg() { + AnyMessageDisplayed=true; + switch(Code) { case UIERROR_SYSERRMSG: @@ -121,6 +125,7 @@ Log(NULL,St(MErrSeek),Str[0]); break; case UIERROR_FILEREAD: + mprintf(L"\n"); Log(Str[0],St(MErrRead),Str[1]); break; case UIERROR_FILEWRITE: @@ -304,7 +309,15 @@ case UIERROR_ULINKEXIST: Log(NULL,St(MSymLinkExists),Str[0]); break; - + case UIERROR_READERRTRUNCATED: + Log(NULL,St(MErrReadTrunc),Str[0]); + break; + case UIERROR_READERRCOUNT: + Log(NULL,St(MErrReadCount),Num[0]); + break; + case UIERROR_DIRNAMEEXISTS: + Log(NULL,St(MDirNameExists)); + break; #ifndef SFX_MODULE case UIMSG_STRING: @@ -397,11 +410,15 @@ } -bool uiAskRepeatRead(const wchar *FileName) +void uiAskRepeatRead(const wchar *FileName,bool &Ignore,bool &All,bool &Retry,bool &Quit) { - mprintf(L"\n"); - Log(NULL,St(MErrRead),FileName); - return Ask(St(MRetryAbort))==1; + eprintf(St(MErrReadInfo)); + int Code=Ask(St(MIgnoreAllRetryQuit)); + + Ignore=(Code==1); + All=(Code==2); + Quit=(Code==4); + Retry=!Ignore && !All && !Quit; // Default also for invalid input, not just for 'Retry'. } @@ -423,3 +440,15 @@ return St(MonthID[Month]); } #endif + + +void uiEolAfterMsg() +{ + if (AnyMessageDisplayed) + { + // Avoid deleting several last characters of any previous error message + // with percentage indicator in -idn mode. + AnyMessageDisplayed=false; + mprintf(L"\n"); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/uisilent.cpp new/unrar/uisilent.cpp --- old/unrar/uisilent.cpp 2020-06-25 12:40:39.000000000 +0200 +++ new/unrar/uisilent.cpp 2020-10-22 10:48:23.000000000 +0200 @@ -67,3 +67,8 @@ return L""; } #endif + + +void uiEolAfterMsg() +{ +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/unicode.cpp new/unrar/unicode.cpp --- old/unrar/unicode.cpp 2020-06-25 12:40:39.000000000 +0200 +++ new/unrar/unicode.cpp 2020-10-22 10:48:24.000000000 +0200 @@ -471,6 +471,7 @@ } +// Case insensitive wcsstr(). const wchar_t* wcscasestr(const wchar_t *str, const wchar_t *search) { for (size_t i=0;str[i]!=0;i++) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/unrar/version.hpp new/unrar/version.hpp --- old/unrar/version.hpp 2020-06-25 12:40:39.000000000 +0200 +++ new/unrar/version.hpp 2020-10-22 10:48:24.000000000 +0200 @@ -1,6 +1,6 @@ -#define RARVER_MAJOR 5 -#define RARVER_MINOR 91 -#define RARVER_BETA 0 -#define RARVER_DAY 25 -#define RARVER_MONTH 6 +#define RARVER_MAJOR 6 +#define RARVER_MINOR 0 +#define RARVER_BETA 1 +#define RARVER_DAY 22 +#define RARVER_MONTH 10 #define RARVER_YEAR 2020