Jump to content

File modified date problem in makecab.exe 5.1.2600.5512


Recommended Posts

Posted (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.txt

HFSLIP could use another version of makecab or cabarc here to eliminate the problem.

Edited by Explorer09

Posted (edited)

Are you 100% sure? I don't see the problem here (created by makecab.exe 5.0.2147.1):

x452d3.png

I think the problem with HFSLIP and makecab/cabarc is that you can use makecab like this:

makecab text.txt

and get text.tx_ while with cabarc you need:

cabarc N text.tx_ text.txt

There'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 %%I

2) For cabarc.exe maybe something like this?

SETLOCAL ENABLEDELAYEDEXPANSION
FOR /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 by tomasz86
Posted (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 by Explorer09
Posted

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.

Posted (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 by Mim0
Posted

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.
Posted

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.

Posted (edited)

@Mim0

You 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 :whistle:

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 by tomasz86
Posted

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.

Posted

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
  • 2 months later...
Posted (edited)

MAKECAB.EXE 5.1.2600.1106 XP SP1

Doesn'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 by PROBLEMCHYLD
  • 2 months later...
Posted

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.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...