Package: mc
Version: 4.6.0-4.6.1-pre4-2
Midnight Commander does handle tar archives bigger than the magic 2GB
size incorrectly.
I appended a patch fixing the problem. Since it includes changes in the
VFS of the Midnight Commander, changes made to other virtual filesystems
are included too. Those however are not tested and mostly will not make
them bypassing the limit.
With best regards
Michael Müller
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/cpio.c mc-4.6.1-pre4/vfs/cpio.c
--- mc-4.6.1-pre4.debian/vfs/cpio.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/cpio.c 2005-08-23 21:32:39.306219927 +0200
@@ -83,7 +83,7 @@
struct vfs_s_inode *inode;
};
-static int cpio_position;
+static off_t cpio_position;
static int cpio_find_head(struct vfs_class *me, struct vfs_s_super *super);
static int cpio_read_bin_head(struct vfs_class *me, struct vfs_s_super *super);
@@ -107,7 +107,7 @@
return l;
}
-static int cpio_skip_padding(struct vfs_s_super *super)
+static off_t cpio_skip_padding(struct vfs_s_super *super)
{
switch(super->u.arch.type) {
case CPIO_BIN:
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/direntry.c mc-4.6.1-pre4/vfs/direntry.c
--- mc-4.6.1-pre4.debian/vfs/direntry.c 2004-11-29 19:44:49.000000000 +0100
+++ mc-4.6.1-pre4/vfs/direntry.c 2005-08-23 21:32:39.307219773 +0200
@@ -836,13 +836,13 @@
return 0;
}
-static int
+static off_t
vfs_s_lseek (void *fh, off_t offset, int whence)
{
off_t size = FH->ino->st.st_size;
if (FH->handle != -1){ /* If we have local file opened, we want to work with it */
- int retval = lseek (FH->handle, offset, whence);
+ off_t retval = lseek (FH->handle, offset, whence);
if (retval == -1)
FH->ino->super->me->verrno = errno;
return retval;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/extfs.c mc-4.6.1-pre4/vfs/extfs.c
--- mc-4.6.1-pre4.debian/vfs/extfs.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/extfs.c 2005-08-23 21:32:39.309219464 +0200
@@ -1125,7 +1125,7 @@
return 0;
}
-static int extfs_lseek (void *data, off_t offset, int whence)
+static off_t extfs_lseek (void *data, off_t offset, int whence)
{
struct pseudofile *file = (struct pseudofile *) data;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/local.c mc-4.6.1-pre4/vfs/local.c
--- mc-4.6.1-pre4.debian/vfs/local.c 2004-09-25 01:00:18.000000000 +0200
+++ mc-4.6.1-pre4/vfs/local.c 2005-08-23 21:32:39.310219310 +0200
@@ -197,7 +197,7 @@
return chdir (path);
}
-int
+off_t
local_lseek (void *data, off_t offset, int whence)
{
int fd = * (int *) data;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/local.h mc-4.6.1-pre4/vfs/local.h
--- mc-4.6.1-pre4.debian/vfs/local.h 2004-08-17 11:17:43.000000000 +0200
+++ mc-4.6.1-pre4/vfs/local.h 2005-08-23 21:32:39.318218076 +0200
@@ -11,7 +11,7 @@
extern int local_read (void *data, char *buffer, int count);
extern int local_fstat (void *data, struct stat *buf);
extern int local_errno (struct vfs_class *me);
-extern int local_lseek (void *data, off_t offset, int whence);
+extern off_t local_lseek (void *data, off_t offset, int whence);
#ifdef HAVE_MMAP
extern caddr_t local_mmap (struct vfs_class *me, caddr_t addr, size_t len,
int prot, int flags, void *data, off_t offset);
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/mcfs.c mc-4.6.1-pre4/vfs/mcfs.c
--- mc-4.6.1-pre4.debian/vfs/mcfs.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/mcfs.c 2005-08-23 21:32:39.315218539 +0200
@@ -1037,7 +1037,7 @@
return 0;
}
-static int
+static off_t
mcfs_lseek (void *data, off_t offset, int whence)
{
mcfs_handle *info = (mcfs_handle *) data;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/smbfs.c mc-4.6.1-pre4/vfs/smbfs.c
--- mc-4.6.1-pre4.debian/vfs/smbfs.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/smbfs.c 2005-08-23 21:32:39.317218231 +0200
@@ -1585,7 +1585,7 @@
#define smbfs_lstat smbfs_stat /* no symlinks on smb filesystem? */
-static int
+static off_t
smbfs_lseek (void *data, off_t offset, int whence)
{
smbfs_handle *info = (smbfs_handle *) data;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/tar.c mc-4.6.1-pre4/vfs/tar.c
--- mc-4.6.1-pre4.debian/vfs/tar.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/tar.c 2005-08-23 21:32:39.311219156 +0200
@@ -194,7 +194,7 @@
}
/* As we open one archive at a time, it is safe to have this static */
-static int current_tar_position = 0;
+static off_t current_tar_position = 0;
/* Returns fd of the open tar file */
static int
@@ -457,7 +457,7 @@
struct stat st;
struct vfs_s_entry *entry;
struct vfs_s_inode *inode, *parent;
- long data_position;
+ off_t data_position;
char *q;
int len;
char *current_file_name, *current_link_name;
@@ -642,8 +642,9 @@
int fd = FH_SUPER->u.arch.fd;
struct vfs_class *me = FH_SUPER->me;
- if (mc_lseek (fd, begin + FH->pos, SEEK_SET) !=
- begin + FH->pos) ERRNOR (EIO, -1);
+
+ off_t o = mc_lseek(fd, begin + FH->pos, SEEK_SET);
+ if ( o != begin + FH->pos) ERRNOR (EIO, -1);
count = MIN(count, FH->ino->st.st_size - FH->pos);
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/undelfs.c mc-4.6.1-pre4/vfs/undelfs.c
--- mc-4.6.1-pre4.debian/vfs/undelfs.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/undelfs.c 2005-08-23 21:32:39.313218847 +0200
@@ -645,7 +645,7 @@
}
/* this has to stay here for now: vfs layer does not know how to emulate it */
-static int
+static off_t
undelfs_lseek(void *vfs_info, off_t offset, int whence)
{
return -1;
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/vfs-impl.h mc-4.6.1-pre4/vfs/vfs-impl.h
--- mc-4.6.1-pre4.debian/vfs/vfs-impl.h 2004-09-02 15:57:59.000000000 +0200
+++ mc-4.6.1-pre4/vfs/vfs-impl.h 2005-08-23 21:32:39.318218076 +0200
@@ -53,7 +53,7 @@
int (*rename) (struct vfs_class *me, const char *p1, const char *p2);
int (*chdir) (struct vfs_class *me, const char *path);
int (*ferrno) (struct vfs_class *me);
- int (*lseek) (void *vfs_info, off_t offset, int whence);
+ off_t (*lseek) (void *vfs_info, off_t offset, int whence);
int (*mknod) (struct vfs_class *me, const char *path, int mode, int dev);
vfsid (*getid) (struct vfs_class *me, const char *path);
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/vfs.c mc-4.6.1-pre4/vfs/vfs.c
--- mc-4.6.1-pre4.debian/vfs/vfs.c 2005-05-27 16:19:19.000000000 +0200
+++ mc-4.6.1-pre4/vfs/vfs.c 2005-08-23 21:32:39.312219002 +0200
@@ -623,14 +623,14 @@
off_t mc_lseek (int fd, off_t offset, int whence)
{
struct vfs_class *vfs;
- int result;
+ off_t result;
if (fd == -1)
return -1;
vfs = vfs_op (fd);
result = vfs->lseek ? (*vfs->lseek)(vfs_info (fd), offset, whence) : -1;
- if (result == -1)
+ if (result == (off_t)-1)
errno = vfs->lseek ? ferrno (vfs) : E_NOTSUPP;
return result;
}
diff -N -r -u -x config.log mc-4.6.1-pre4.debian/vfs/xdirentry.h mc-4.6.1-pre4/vfs/xdirentry.h
--- mc-4.6.1-pre4.debian/vfs/xdirentry.h 2004-10-06 20:04:15.000000000 +0200
+++ mc-4.6.1-pre4/vfs/xdirentry.h 2005-08-23 21:32:39.326216843 +0200
@@ -90,7 +90,7 @@
char *linkname; /* Symlink's contents */
char *localname; /* Filename of local file, if we have one */
struct timeval timestamp; /* Subclass specific */
- long data_offset; /* Subclass specific */
+ off_t data_offset; /* Subclass specific */
};
/* Data associated with an open file */