Re: Creating directories with pkunzip, rar, et. al.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/7/07, Joe Ripley <vitaminjoe@xxxxxxxxx> wrote:
On 5/7/07, Joe Ripley <vitaminjoe@xxxxxxxxx> wrote:
Actually, I had some time to do some testing, and I found that it's
not that pkunzip is attempting to set the archive attribute.  When run
with the debug messages turned on, pkunzip tries to create the
directory with an attribute of 0x10 (i.e. a regular file) rather than
0x20 (a directory).

No, first of all creating a directory does not involve any attributes,
and secondly
0x10=directory, and 0x20=archive.

What you see in a -D+dD log with LFN's enabled is something like this:
INT21 (0) at 02a8:3478: AX=7139, BX=caf4, CX=0000, DX=caf4, DS=0c28, ES=0c28
LFN: doing LFN!, AX=7139 DL=f4
LFN: mkdir DOC
(...)
INT21 (0) at 02a8:344b: AX=7143, BX=ca01, CX=0020, DX=caf4, DS=0c28, ES=0c28
LFN: doing LFN!, AX=7143 DL=f4
LFN: attribute DOC 1

the CX=20 here is the new attribute (ie. archive)

As a hack to fix it, all I did was add one line to the beginning of
the set_dos_attr() function in mfs.c:

if (S_ISDIR(mode)) attr &= DIRECTORY;

This is correct, since the read-only attribute must also be ignored.
However, there is also some FAT code that does not need the clearance.

So I committed a similar check but in a different place,  get_unix_attr():

--- src/dosext/mfs/mfs.c        (revision 1784)
+++ src/dosext/mfs/mfs.c        (revision 1785)
@@ -608,6 +608,12 @@
#if 0
#define S_IWRITEA (S_IWUSR | S_IWGRP | S_IWOTH)
#endif
+  /* Do not make directories read-only as this has completely different
+     semantics in DOS (mostly ignore) than in Unix.
+     Also do not reflect the archive bit as clearing the x bit as that
+     can cause inaccessible directories */
+  if (S_ISDIR(mode) || (attr & DIRECTORY))
+    attr &= DIRECTORY;
  mode &= ~(S_IFDIR | S_IWRITE | S_IEXEC);
  if (attr & DIRECTORY)
    mode |= S_IFDIR;
-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Console]     [Linux Audio]     [Linux for Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Camping]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Samba]     [Linux Media]     [Fedora Users]

  Powered by Linux