Explorer09 Posted April 15, 2012 Posted April 15, 2012 (edited) HFSLIP uses makecab.exe for making cabinets. However, I found a problem with makecab that I advice HFSLIP authors not to use it.The problem (probably a bug) is this:makecab will store the file creation date as the modification date of the files inside the cabinet.People can try this:1. Assume that you have the program to change the file date, such as NirSoft's File Date Changer.2. Create a text file named "test.txt".3. Use the File Date Changer to change the file created date to 1/1/2002, and the modified date 4/4/2004.4. makecab /d compressiontype=LZX /d compressionmemory=21 test.txt test.tx_5. Open the cabinet with an archive viewer (such as 7-Zip), and check the modified date of test.txt.I tested this with makecab.exe 5.1.2600.5512(WindowsXP), and the date is 1/1/2002 instead of 4/4/2004.[update: Only this version has this problem, other version of makecab.exe works fine.]This problem become serious to me when I make cabinets across different folders. I often copy the files between folders and copying the files changes the file creation date of the new file. Then, makecab both files, and the two cabinets will be different even though their contents are the same file.In contrast, cabarc.exe (another cabinet utility), did this right. In the step 4, trying this instead of makecab will give you the correct file modified date.cabarc /m LZX:21 N test.tx_ test.txtHFSLIP could use another version of makecab or cabarc here to eliminate the problem. Edited April 19, 2012 by Explorer09
tomasz86 Posted April 15, 2012 Posted April 15, 2012 (edited) Are you 100% sure? I don't see the problem here (created by makecab.exe 5.0.2147.1):I think the problem with HFSLIP and makecab/cabarc is that you can use makecab like this:makecab text.txtand get text.tx_ while with cabarc you need:cabarc N text.tx_ text.txtThere's no problem when doing it for a single file but if you've got a folder of files with different extensions then it may be a little difficult.1) With makecab.exe you can just:FOR /F %%I IN ('DIR/B') DO MAKECAB %%I2) For cabarc.exe maybe something like this?SETLOCAL ENABLEDELAYEDEXPANSIONFOR /F %%I IN ('DIR/B') DO ( IF NOT "%%~xI"=="" ( SET EXT=%%~xI CABARC N %%~nI!EXT:~0,-1!_ %%I ) ELSE ( CABARC N %%~nI._ %%I ))The problem is that it will work only for files with 3-letter extensions. Makecab.exe is much easier to use in this way...EDIT: Using makecab.exe is easier but cabarc.exe can do the same job too! Edited April 15, 2012 by tomasz86
Explorer09 Posted April 15, 2012 Author Posted April 15, 2012 (edited) Okay, you convinced me to test a little further.I downloaded another version of makecab.exe. This time it's 5.00.2134.1, and it works properly.Now I can say it's a regression of makecab (5.1.2600.5512).EDIT: I tested also makecab.exe version 6.1.7600.16385, which comes from Windows 7. It works properly too. Only the Windows XP version of makecab.exe has this bug. Edited April 15, 2012 by Explorer09
tomasz86 Posted April 15, 2012 Posted April 15, 2012 So it seems that there's a bug in XP's makecab.exe... Could anyone else confirm?I've fixed the above CABARC.exe based script so it can work for all files regardless of their extension.
Mim0 Posted April 17, 2012 Posted April 17, 2012 (edited) This problem become serious to me when I make cabinets across different folders. I often copy the files between folders and copying the files changes the file creation date of the new file. Then, makecab both files, and the two That's just the way how to compare dirs. For example, I use TC for "compare by content" to be really sure if (sub)folders have the same content.I've fixed the above CABARC.exe based script so it can work for all files regardless of their extension.Do you have in mind to implement this to HFSLIP? If yes:I think it should be enough to place a "correct" makecab.exe beside HFSLIP. Makecab is called often from HFSLIP so there are many places to modify.Placing a correct makecab.exe next to HFSLIP to avoid this minor (sorry ;-P ) problem would be the better solution. Edited April 17, 2012 by Mim0
PROBLEMCHYLD Posted April 17, 2012 Posted April 17, 2012 So it seems that there's a bug in XP's makecab.exe... Could anyone else confirm?I've fixed the above CABARC.exe based script so it can work for all files regardless of their extension.All makecab has this bug except for an older version. Heres an older version.
Yzöwl Posted April 17, 2012 Posted April 17, 2012 It may be a bug however it is not something which I can see of any concern to HFSLIP users.BTW, some older versions of expand cannot uncompress an LZX cabbed file so you may need to use MSZIP compression in order to remain compatible.
tomasz86 Posted April 18, 2012 Posted April 18, 2012 (edited) @Mim0You may want to put makecab.exe in HFTOOLS and then change all "makecab.exe" to "HFTOOLS\makecab.exe" in the script. Of course doing so will require having makecab.exe in HFTOOLS Or to do it simpler you can just add this line in the beginning:IF NOT EXIST HFTOOLS\makecab.exe (SET MAKECAB=makecab) ELSE (SET MAKECAB=HFTOOLS\makecab)and change all makecab.exe / makecab to %MAKECAB% so HFSLIP will use HFTOOLS\makecab.exe only if it exists and will use the one present in the OS if there's no makecab.exe in HFTOOLS.Here's a cabarc.exe one-liner with LZX:21 compression to compress everything in a folder if anyone's interested:SETLOCAL ENABLEDELAYEDEXPANSION& FOR /F %%I IN ('DIR/B') DO (IF NOT "%%~xI"=="" (SET EXT=%%~xI& CABARC -m LZX:21 N %%~nI!EXT:~0,-1!_ %%I) ELSE (CABARC -m LZX:21 N %%~nI._ %%I))Replacing makecab.exe with cabarc.exe in HFSLIP would require some work... Edited April 18, 2012 by tomasz86
Explorer09 Posted April 19, 2012 Author Posted April 19, 2012 All makecab has this bug except for an older version. Heres an older version.How about using a newer version? I forgot to say that Windows 7's makecab (6.1.7600.16385) can run on Windows XP. I'm not sure about Win 2000, though.
PROBLEMCHYLD Posted April 19, 2012 Posted April 19, 2012 How about using a newer version? I forgot to say that Windows 7's makecab (6.1.7600.16385) can run on Windows XP. I'm not sure about Win 2000, though.Good idea. I will try it over the weekend. Im sick right now trying to recover. Thanks
PROBLEMCHYLD Posted July 9, 2012 Posted July 9, 2012 (edited) MAKECAB.EXE 5.1.2600.1106 XP SP1Doesn't have this bug either. I will add this update to Win98 SP3. The make cab from WinXP SP3 has better compression than all the older versions of MAKECAB.EXE.But it has the date/time stamp bug.It also has better compression over CABARC.EXE. Edited July 9, 2012 by PROBLEMCHYLD
PROBLEMCHYLD Posted October 5, 2012 Posted October 5, 2012 Is it possible to patch the MAKECAB.EXE 5.1.2600.5512 to avoid this bug? The Win XP SP3 version has better compression.
tommyp Posted October 6, 2012 Posted October 6, 2012 Nobody complained about makecab since the script was introduced in 2005. However, if the makecab.exe you have uses the same switches as the one that comes with the OS, then place it alongside the script cmd file and call it a day. I haven't tested it, and the script wasn't developed with it, so you could run into errors.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now