2004-06-24 10:48:42

by Jason Mancini

[permalink] [raw]
Subject: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

Let me try this again with Evolution...

> DVDs with 2-4GB files get their filesizes truncated. Are there even
> "cruft" CDs in circulation today? Maybe it should be a config item.
> A popular competing os seems to handle 2-4GB isofs filesizes.
> -Jason Mancini

=============================================================================
diff -Nru inode.c.orig inode.c
--- inode.c.orig 2004-06-24 03:38:09.171898370 -0700
+++ inode.c 2004-06-24 03:37:47.997909378 -0700
@@ -1282,12 +1282,20 @@
* WARNING: ISO-9660 filesystems > 1 GB and even > 2 GB are fully
* legal. Do not prevent to use DVD's [email protected]
*/
+ /*
if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) &&
sbi->s_cruft == 'n') {
printk(KERN_WARNING "Warning: defective CD-ROM. "
"Enabling \"cruft\" mount option.\n");
sbi->s_cruft = 'y';
}
+ */
+
+ /* Forget "cruft", I have DVDs to read with 2-4GB files.
+ */
+ if (inode->i_size < 0) {
+ inode->i_size &= 0x0FFFFFFFF;
+ }

/*
* Some dipshit decided to store some other bit of information
=============================================================================



2004-06-24 12:51:00

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

On Thu, Jun 24, 2004 at 03:44:30AM -0700, Jason Mancini wrote:

> + if (inode->i_size < 0) {
> + inode->i_size &= 0x0FFFFFFFF;
> + }

>From memory (this was a long time ago) this was done because there
were ISO images out there with crap in the upper bits.

If that is that case and they still cause problems, we might want to
be smarter about this and generate mask depending on how large the
entire fs is or use a mount option.


--cw

2004-06-24 15:02:49

by Andries E. Brouwer

[permalink] [raw]
Subject: Re: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

On Thu, Jun 24, 2004 at 03:44:30AM -0700, Jason Mancini wrote:

> DVDs with 2-4GB files get their filesizes truncated. Are there even
> "cruft" CDs in circulation today? Maybe it should be a config item.
> A popular competing os seems to handle 2-4GB isofs filesizes.
> -Jason Mancini
>
> =============================================================================
> diff -Nru inode.c.orig inode.c
> --- inode.c.orig 2004-06-24 03:38:09.171898370 -0700
> +++ inode.c 2004-06-24 03:37:47.997909378 -0700
> @@ -1282,12 +1282,20 @@
> * WARNING: ISO-9660 filesystems > 1 GB and even > 2 GB are fully
> * legal. Do not prevent to use DVD's [email protected]
> */
> + /*
> if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) &&
> sbi->s_cruft == 'n') {
> printk(KERN_WARNING "Warning: defective CD-ROM. "
> "Enabling \"cruft\" mount option.\n");
> sbi->s_cruft = 'y';
> }
> + */
> +
> + /* Forget "cruft", I have DVDs to read with 2-4GB files.
> + */
> + if (inode->i_size < 0) {
> + inode->i_size &= 0x0FFFFFFFF;
> + }
>
> /*
> * Some dipshit decided to store some other bit of information
> =============================================================================

Config item? No. There are far too many.

Automatically enabling? No - that code must be deleted, like you did.
Anyone with such a CDROM can give the "cruft" mount option herself.

Testing for negative i_size? But it only becomes negative when
some earlier code is broken, so probably we should fix that
earlier code instead.

More in particular, I read ISO 9660 section 7.3.3 as talking about
unsigned integers. Only in 7.1.2 do signed integers occur.
So, I suppose changing isonum_733 to return unsigned should suffice.

Could you test the below?

Andries

---
diff -uprN -X /linux/dontdiff a/fs/isofs/inode.c b/fs/isofs/inode.c
--- a/fs/isofs/inode.c 2004-05-28 20:53:22
+++ b/fs/isofs/inode.c 2004-06-24 16:20:41
@@ -1276,30 +1276,13 @@ static void isofs_read_inode(struct inod
}

/*
- * The ISO-9660 filesystem only stores 32 bits for file size.
- * mkisofs handles files up to 2GB-2 = 2147483646 = 0x7FFFFFFE bytes
- * in size. This is according to the large file summit paper from 1996.
- * WARNING: ISO-9660 filesystems > 1 GB and even > 2 GB are fully
- * legal. Do not prevent to use DVD's [email protected]
- */
- if ((inode->i_size < 0 || inode->i_size > 0x7FFFFFFE) &&
- sbi->s_cruft == 'n') {
- printk(KERN_WARNING "Warning: defective CD-ROM. "
- "Enabling \"cruft\" mount option.\n");
- sbi->s_cruft = 'y';
- }
-
- /*
* Some dipshit decided to store some other bit of information
- * in the high byte of the file length. Catch this and holler.
- * WARNING: this will make it impossible for a file to be > 16MB
- * on the CDROM.
+ * in the high byte of the file length. Truncate size in case
+ * this CDROM was mounted with the cruft option.
*/

- if (sbi->s_cruft == 'y' &&
- inode->i_size & 0xff000000) {
+ if (sbi->s_cruft == 'y')
inode->i_size &= 0x00ffffff;
- }

if (de->interleave[0]) {
printk("Interleaved files not (yet) supported.\n");
diff -uprN -X /linux/dontdiff a/include/linux/iso_fs.h b/include/linux/iso_fs.h
--- a/include/linux/iso_fs.h 2003-12-18 03:58:58
+++ b/include/linux/iso_fs.h 2004-06-24 16:13:00
@@ -190,28 +190,28 @@ static inline int isonum_712(char *p)
{
return *(s8 *)p;
}
-static inline int isonum_721(char *p)
+static inline unsigned int isonum_721(char *p)
{
return le16_to_cpu(get_unaligned((u16 *)p));
}
-static inline int isonum_722(char *p)
+static inline unsigned int isonum_722(char *p)
{
return be16_to_cpu(get_unaligned((u16 *)p));
}
-static inline int isonum_723(char *p)
+static inline unsigned int isonum_723(char *p)
{
/* Ignore bigendian datum due to broken mastering programs */
return le16_to_cpu(get_unaligned((u16 *)p));
}
-static inline int isonum_731(char *p)
+static inline unsigned int isonum_731(char *p)
{
return le32_to_cpu(get_unaligned((u32 *)p));
}
-static inline int isonum_732(char *p)
+static inline unsigned int isonum_732(char *p)
{
return be32_to_cpu(get_unaligned((u32 *)p));
}
-static inline int isonum_733(char *p)
+static inline unsigned int isonum_733(char *p)
{
/* Ignore bigendian datum due to broken mastering programs */
return le32_to_cpu(get_unaligned((u32 *)p));

2004-06-24 19:07:47

by Marc-Christian Petersen

[permalink] [raw]
Subject: Re: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

On Thursday 24 June 2004 17:01, Andries Brouwer wrote:

> Config item? No. There are far too many.
> Automatically enabling? No - that code must be deleted, like you did.
> Anyone with such a CDROM can give the "cruft" mount option herself.
> Testing for negative i_size? But it only becomes negative when
> some earlier code is broken, so probably we should fix that
> earlier code instead.
> More in particular, I read ISO 9660 section 7.3.3 as talking about
> unsigned integers. Only in 7.1.2 do signed integers occur.
> So, I suppose changing isonum_733 to return unsigned should suffice.
> Could you test the below?

prolly ;) totally unrelated to this, but what about this:

Jun 24 20:46:01 codeman kernel: ISO 9660 Extensions: Microsoft Joliet Level 1
Jun 24 20:46:01 codeman kernel: Interleaved files not (yet) supported.
Jun 24 20:46:01 codeman kernel: File unit size != 0 for ISO file (60133376).
Jun 24 20:46:01 codeman kernel: ISOFS: changing to secondary root
Jun 24 20:46:01 codeman kernel: Interleaved files not (yet) supported.
Jun 24 20:46:01 codeman kernel: File unit size != 0 for ISO file (60135424).

It's a 4,5GB ISO, edited with Magic ISO Maker under Windows, saved it, burned
it. Windows can handle the DVD very well. Linux just says the above and do not
give me any listing of the DVD.

Do we ever get interleaved files support with linux?

ciao, Marc

2004-06-24 21:02:12

by Andries Brouwer

[permalink] [raw]
Subject: Re: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

On Thu, Jun 24, 2004 at 08:58:56PM +0200, Marc-Christian Petersen wrote:

> Do we ever get interleaved files support with linux?

Well, you know how it is: either you implement this yourself, or
you provide enough details to enable someone else to implement this.

For example, suppose you dd the first megabyte off your DVD,
and make it available somewhere, or compress and uuencode and email it,
that might help.

> prolly ;) totally unrelated to this, but what about this:
>
> Jun 24 20:46:01 codeman kernel: ISO 9660 Extensions: Microsoft Joliet Level 1
> Jun 24 20:46:01 codeman kernel: Interleaved files not (yet) supported.
> Jun 24 20:46:01 codeman kernel: File unit size != 0 for ISO file (60133376).
> Jun 24 20:46:01 codeman kernel: ISOFS: changing to secondary root
> Jun 24 20:46:01 codeman kernel: Interleaved files not (yet) supported.
> Jun 24 20:46:01 codeman kernel: File unit size != 0 for ISO file (60135424).
>
> It's a 4,5GB ISO, edited with Magic ISO Maker under Windows, saved it, burned
> it. Windows can handle the DVD very well. Linux just says the above and do not
> give me any listing of the DVD.

You might try to get more details by undefining BEQUIET (in isofs/inode.c).

You might try to give the mount option -o nojoliet.

2004-06-25 01:42:09

by Jason Mancini

[permalink] [raw]
Subject: Re: [PATCH] fs/isofs/inode.c, 2-4GB files rejected on DVDs

On Thu, 2004-06-24 at 17:01 +0200, Andries Brouwer wrote:
> More in particular, I read ISO 9660 section 7.3.3 as talking about
> unsigned integers. Only in 7.1.2 do signed integers occur.
> So, I suppose changing isonum_733 to return unsigned should suffice.
>
> Could you test the below?
>
> Andries

Ok I did, the patch seems to work great! Thanks!
-Jason Mancini