isofs unhide option: troubles with Wine
Subsystems (2)
Greetings,
When installing Microsoft Office with Wine, we find that some MS CDs have certain files marked as hidden on the CD.
With the default isofs mount options, these files are completely inaccessible. (Relevant code is in fs/isofs/namei.c, and dir.c; search for unhide).
You're forced to remount the CD with the -unhide option to make these files visible.
Now, forgive me if I've overlooked TFM, but I did not find any discussion of the unhide option in the archives I could search.
Further, imho, the unhide code is incorrectly implemented in Linux.
The use of the 'hide' bit in Windows has no good parallel in Linux. The current implementation treats a hidden file as if it didn't exist at all, there is no possible way a user space program can see that file. In Windows, the file just is hidden from 'normal' programs, you can still get to the file if you work hard enough.
Further, I hypothesize (perhaps wrongly) that the only use of this hidden bit is on Windows CDs, and largely on MS Office CDs, and so I think it is reasonable for me to
call for a change. (Understand, I'm trying to help
very basic users to use MS Office; for them to have to
su to root, umount, and then mount -o unhide, is a pretty tough thing to ask. See the following article to see why I'm so upset about this:
http://biz.yahoo.com/fo/020523/linux_gets_friendlier_1.html)
Unfortunately, I don't have a strong feeling for what the 'right' solution is. I see several options:
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
2. Make it possible to set this mount option from user space (I don't like this, but it would get me around the problem).
3. Make it so that isofs/dir.c still strips out hidden files, but enable isofs/namei.c to return a hidden file that is opened directly by name.
I am willing to submit a patch to implement the appropriate solution.
Comments and opinions are greatly appreciated; please copy me directly though, as I am not subscribed.
Thanks,
Jeremy
Hi Jeremy,
Quoted 5 lines · Jeremy White
Unfortunately, I don't have a strong feeling for what the 'right' solution is. I see several options:
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
how about:
/dev/hdb /cdrom iso9660 defaults,ro,unhide,user 0 2
in your /etc/fstab. This would allow users to mount and unmount CDs. It also changes the default to unhide.
Regards, Olaf.
Quoted 9 lines
Quoted 2 lines
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
how about:
/dev/hdb/cdrom iso9660 defaults,ro,unhide,user 0 2in your
/etc/fstab. This would allow users to mount and unmount CDs. It also changes the default to unhide.
Yes, that is what we have to do now. So, when our product is installed, a user is presented with a confusing, and highly technical question, the gist of which is: please give us your root password so we can do something you don't understand. It's okay, trust us, really...<grin>
Further, I would argue that if you accept that unhide is a reasonable default for me to force into the fstab, then it is a reasonable default for the kernel to have.
Cheers,
Jeremy
In message "Re: isofs unhide option: troubles with Wine", <Jeremy White>
Quoted 16 lines · wrote:
Quoted 9 lines
Quoted 2 lines
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
how about:
/dev/hdb/cdrom iso9660 defaults,ro,unhide,user 0 2in your
/etc/fstab. This would allow users to mount and unmount CDs. It also changes the default to unhide.Yes, that is what we have to do now. So, when our product is installed, a user is presented with a confusing, and highly technical question, the gist of which is: please give us your root password so we can do something you don't understand. It's okay, trust us, really...<grin>
Quoted 3 lines
Further, I would argue that if you accept that unhide is a reasonable default for me to force into the fstab, then it is a reasonable default for the kernel to have.
Is this not an issue that could be put to RedHat/Mandrake/SuSE/Turbo/etc to include the above fstab in their standard install. If the user is going to have to upgrade their kernel to get this default, they will understand fstab. If they do not understand fstab, they are going to upgrade their kernel by upgrading their distro anyway. So why not push for this option in the default fstab of popular distros?
Joe.
Quoted 6 lines
Is this not an issue that could be put to RedHat/Mandrake/SuSE/Turbo/etc to include the above fstab in their standard install. If the user is going to have to upgrade their kernel to get this default, they will understand fstab. If they do not understand fstab, they are going to upgrade their kernel by upgrading their distro anyway. So why not push for this option in the default fstab of popular distros?
Again, if it's reasonable to persuade all the distros to change the default settings used to mount a CDROM, then imho, it's more reasonable to just change the kernel default.
Jer
Replying a bit late 'cause I was on vacation at the time (and because I have stronger feelings about this issue than Jeremy :-)
On Sat, 25 May 2002, Joseph Mathewson wrote:
[...]
Quoted 10 lines
Quoted 3 lines
Further, I would argue that if you accept that unhide is a reasonable default for me to force into the fstab, then it is a reasonable default for the kernel to have.
Is this not an issue that could be put to RedHat/Mandrake/SuSE/Turbo/etc to include the above fstab in their standard install. If the user is going to have to upgrade their kernel to get this default, they will understand fstab. If they do not understand fstab, they are going to upgrade their kernel by upgrading their distro anyway. So why not push for this option in the default fstab of popular distros?
The goal is not to tell users to upgrade their kernels. The goal is to make the problem gradually disappear by fixing the kernel now. (when distributions start shipping with the fixed kernel we'll have much fewer complaints already)
Now I will argue that making 'hidden' files inaccessible is a kernel bug.
On Windows if you use FindFirstFile + FindNextFile (equivalent to opendir/readdir), you get all files, including hidden files. Similarly, you can use CreateFile to open a hidden file. In other words there is no difference between hidden and regular files a the API level.
Now, switch to Linux and try opendir+readdir. Unless you specified the 'unhide' option, hidden files are not returned. Similarly you cannot use open on a hidden file. For all purposes and intent 'hidden' files are inaccessible on Linux.
Now, hidden files are not something new, FAT had that since the beginning. Yet, the FAT driver as never made hidden files inaccessible. I'm sure there would have been riots if it had (and I missed on all the fun). Imagine being unable to tweak bootsect.dos or boot.ini?
I also believe that ECMA 119 section 9.1.6 intends the 'Existence' bit to be the same as the 'hidden' flag of FAT. Certainly MS uses it the same way. ECMA says:
If set to ZERO, shall mean that the existence of the file shall be made known to the user upon an inquiry by the user.
If set to ONE, shall mean that the existence of the file need not be made known to the user.
Now, the way I read it, the user is the guy sitting in front of the computer, not the 'userland' program making the API call. Thus what ECMA says is that this bit can be used by applications like 'dir' or 'Windows Explorer' to filter out some file entries. In any case, it is not even mandatory to do so.
(note I agree with Andries wrt. Associated files)
So, we will certainly send a patch for this, but:
1. should it make 'unhide' the default and add a 'hide' option?
2. or should it completely ignore the 'hidden' bit?
I am very much in favor of option 2. But does anyone know of a case where making hidden files inaccessible is desired?
(adding an ioctl to get that bit would be nice if there is none currently but we may not go that far :-)
--
Francois Gouget [email protected] http://fgouget.free.fr/
Computers are like airconditioners
They stop working properly if you open WINDOWS
Hi,
Quoted 1 line · Francois Gouget
2. or should it completely ignore the 'hidden' bit?
I already _had_ a patch which did exactly this.
Regards,
Thunder
fs/isofs/namei.c +2 -14
@@ -139,20 +139,8 @@ dpnt = tmpname; } -/* -* Skip hidden or associated files unless unhide is set -*/ - match =0 ; -if (dlen >0 && - (!(de->flags[-sbi->s_high_sierra] &5 ) - || sbi->s_unhide =='y' )) - { - match = (isofs_cmp (dentry,dpnt,dlen) ==0 ); - } -if (match) { -if (bh)brelse (bh); -return inode_number; - } +if (bh)brelse (bh); +return inode_number; }if (bh)brelse (bh);return 0 ;
fs/isofs/dir.c +0 -10
@@ -192,16 +192,6 @@continue ; } -/* Handle everything else. Do name translation if there -is no Rock Ridge NM field. */ -if (sbi->s_unhide =='n' ) { -/* Do not report hidden or associated files */ -if (de->flags[-sbi->s_high_sierra] &5 ) { - filp->f_pos += de_len; -continue ; - } - } - map =1 ;if (sbi->s_rock) { len =get_rock_ridge_filename (de, tmpname, inode);
Signature · 4 lines
German attitude becoming | Thunder from the hill at ngforever
rightaway popular: |
"Get outa my way, | free inhabitant not directly
for I got a mobile phone!" | belonging anywhereQuoted 7 lines · Thunder from the hill
Quoted 1 line · Francois Gouget
2. or should it completely ignore the 'hidden' bit?
I already _had_ a patch which did exactly this.
Regards,
Thunder
But your patch is too primitive, it affects both hidden and associated files, while you only wanted to affect hidden files.
Quoted 5 lines · Jeremy White
Yes, that is what we have to do now. So, when our product is installed, a user is presented with a confusing, and highly technical question, the gist of which is: please give us your root password so we can do something you don't understand. It's okay, trust us, really...<grin>
Sounds like a job for rpm triggers and install scripts.
Quoted 3 lines
Further, I would argue that if you accept that unhide is a reasonable default for me to force into the fstab, then it is a reasonable default for the kernel to have.
I'd tend to agree, simply because the defaults ought to make things possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
Quoted 2 lines
possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
I agree with Alan - this is the key question.
I would further argue that silence in response to this question suggests that there was no carefully considered reason; presumably a good hacker just followed the spec, without considering how these CDs are actually used.
It further suggests to me that I should prep a patch.
Thoughts? Screams of protest? Helpful tips on to whom I should send the patch?
Thanks,
Jer
Hi,
Quoted 2 lines · Jeremy White
possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
Supposedly, someone wanted it _really_ hidden. I can't currently think of another sane reason, I don't know if you can and it's just these headaches. However, what's the advantage in disappearing files?
I suggest making them readable, but not listed.
Regards,
Thunder
Signature · 4 lines
ship is leaving right on time | Thunder from the hill at ngforever empty harbour, wave goodbye | evacuation of the isle | free inhabitant not directly caveman's paintings drowning | belonging anywhere
Followup to: <[email protected]> By author: Thunder from the hill <[email protected]> In newsgroup: linux.dev.kernel
Quoted 4 lines
Hi,
On 3 Jun 2002, Jeremy White wrote:
Quoted 9 lines
Quoted 2 lines
possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
Supposedly, someone wanted it _really_ hidden. I can't currently think of another sane reason, I don't know if you can and it's just these headaches. However, what's the advantage in disappearing files?
I suggest making them readable, but not listed.
No, I think that's a bad idea. Make them listed, but make it possible to query the attribute flags.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
Hi,
Quoted 2 lines · H. Peter Anvin
No, I think that's a bad idea. Make them listed, but make it possible to query the attribute flags.
So you suggest letting ls do the hide? Or if not, what do we call them "hidden" for?
Regards,
Thunder
Signature · 4 lines
ship is leaving right on time | Thunder from the hill at ngforever empty harbour, wave goodbye | evacuation of the isle | free inhabitant not directly caveman's paintings drowning | belonging anywhere
Quoted 11 lines · Thunder from the hill
Hi,
Quoted 2 lines · H. Peter Anvin
No, I think that's a bad idea. Make them listed, but make it possible to query the attribute flags.
So you suggest letting ls do the hide? Or if not, what do we call them "hidden" for?
I don't think it makes any sense for anything in Unix to hide them at all.
The "hidden" flag, however, matters to programs like Wine.
-hpa
Quoted 11 lines · Jeremy White
Quoted 2 lines
possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
I agree with Alan - this is the key question.
I would further argue that silence in response to this question suggests that there was no carefully considered reason; presumably a good hacker just followed the spec, without considering how these CDs are actually used.
It further suggests to me that I should prep a patch.
Go for it. I'll give it a test in the -ac tree happily. If nobody screams it can then go upstream.
Sorry for the long delay; had to take the kids to Disney World <grin>.
I'm attaching two patches, both against 2.5.20. Please be gentle, I'm a kernel newbie.
Patch #1: bugfix.patch
Fixes a bug in the parsing of options for the isofs driver. Behavior was on an unrecognized option to simply return success.
A mount -o blatnik,<useful-option>,<useful-option>
would silently lose all the useful options.
This should be applied, imho, regardless.
Patch #2: reversehide.patch
I've eliminated the 'unhide' option and made that behavior
the default (show files with the hidden bit on).
I've added a 'hide' option which hides files marked with the hidden bit. I've also preserved the behavior which hid 'associated' files by
default,
and added a 'showassoc' mount option, which will cause the driver to show files marked with the associated bit. (The prior behavior was that unhide would show both
hidden and associated files)
Issues:
1. I have no CDs with associated files on them, and thus this change is completely untested. Looks good to me <g>.
2. Arguably, this same change should be made to the udf driver, but I do not have a DVD writer, nor a DVD with either hidden or associated files, so I would be unable to test any such patch made. I'm willing to submit a patch that compiles, if that would be of value.
Thanks,
Jeremy
Quoted 14 lines · Alan Cox
Quoted 11 lines · Jeremy White
Quoted 4 lines
possible rather than impossible. Question is - why was hide the default and what was that decision based upon ?
I agree with Alan - this is the key question.
I would further argue that silence in response to this question suggests that there was no carefully considered reason; presumably a good hacker just followed the spec, without considering how these CDs are actually used.
Quoted 8 lines
Quoted 3 lines
It further suggests to me that I should prep a patch.
Go for it. I'll give it a test in the -ac tree happily. If nobody screams it can then go upstream.
fs/isofs/inode.c +1 -1
@@ -460,7 +460,7 @@break ; } } -else return 1 ; +else return 0 ; }return 1 ; }
Documentation/filesystems/isofs.txt +2 -1
@@ -26,6 +26,7 @@ mode=xxx Sets the permissions on files to xxx nojoliet Ignore Joliet extensions if they are present. norock Ignore Rock Ridge extensions if they are present. - unhide Show hidden files. + hide Completely strip hidden files from the file system. + showassoc Show files marked with the 'associated' bit session=x Select number of session on multisession CD sbsector=xxx Session begins from sector xxx
fs/isofs/dir.c +6 -6
@@ -194,12 +194,12 @@/* Handle everything else. Do name translation if there is no Rock Ridge NM field. */ -if (sbi->s_unhide =='n' ) { -/* Do not report hidden or associated files */ -if (de->flags[-sbi->s_high_sierra] &5 ) { - filp->f_pos += de_len; -continue ; - } + +/* Do not report hidden files if so instructed, or associated files unless instructed to do so */ +if ( ( sbi->s_hide =='y' && (de->flags[-sbi->s_high_sierra] &1 ) ) || + ( sbi->s_showassoc =='n' && (de->flags[-sbi->s_high_sierra] &4 ) ) ) { + filp->f_pos += de_len; +continue ; } map =1 ;
fs/isofs/inode.c +14 -6
@@ -172,7 +172,8 @@char rock;char joliet;char cruft; -char unhide; +char hide; +char showassoc;char nocompress;unsigned char check;unsigned int blocksize;
@@ -341,7 +342,8 @@ popt->rock ='y' ; popt->joliet ='y' ; popt->cruft ='n' ; - popt->unhide ='n' ; + popt->hide ='n' ; + popt->showassoc ='n' ; popt->check ='u' ;/* unset */ popt->nocompress =0 ; popt->blocksize =1024 ;
@@ -367,8 +369,12 @@ popt->joliet ='n' ;continue ; } -if (strncmp (this_char,"unhide" ,6 ) ==0 ) { - popt->unhide ='y' ; +if (strncmp (this_char,"hide" ,4 ) ==0 ) { + popt->hide ='y' ; +continue ; + } +if (strncmp (this_char,"showassoc" ,9 ) ==0 ) { + popt->showassoc='y' ;continue ; }if (strncmp (this_char,"cruft" ,5 ) ==0 ) {
@@ -562,7 +568,8 @@printk ("joliet = %c\n" , opt.joliet);printk ("check = %c\n" , opt.check);printk ("cruft = %c\n" , opt.cruft); -printk ("unhide = %c\n" , opt.unhide); +printk ("hide = %c\n" , opt.hide); +printk ("showassoc= %c\n" , opt.showassoc);printk ("blocksize = %d\n" , opt.blocksize);printk ("gid = %d\n" , opt.gid);printk ("uid = %d\n" , opt.uid);
@@ -806,7 +813,8 @@ sbi->s_rock = (opt.rock =='y' ?2 :0 ); sbi->s_rock_offset =-1 ;/* initial offset, will guess until SP is found*/ sbi->s_cruft = opt.cruft; - sbi->s_unhide = opt.unhide; + sbi->s_hide = opt.hide; + sbi->s_showassoc = opt.showassoc; sbi->s_uid = opt.uid; sbi->s_gid = opt.gid; sbi->s_utf8 = opt.utf8;
fs/isofs/namei.c +3 -3
@@ -140,12 +140,12 @@ }/* -* Skip hidden or associated files unless unhide is set +* Skip hidden or associated files unless hide or showassoc, respectively, is set */ match =0 ;if (dlen >0 && - (!(de->flags[-sbi->s_high_sierra] &5 ) - || sbi->s_unhide =='y' )) + ( sbi->s_hide =='n' || (!(de->flags[-sbi->s_high_sierra] &1 )) ) && + ( sbi->s_showassoc =='y' || (!(de->flags[-sbi->s_high_sierra] &4 )) ) ) { match = (isofs_cmp (dentry,dpnt,dlen) ==0 ); }
include/linux/iso_fs_sb.h +2 -1
@@ -20,7 +20,8 @@unsigned char s_cruft;/* Broken disks with high byte of length containing junk */ -unsigned char s_unhide; +unsigned char s_hide; +unsigned char s_showassoc;unsigned char s_nosuid;unsigned char s_nodev;unsigned char s_nocompress;
Quoted 10 lines · Jeremy White
Greetings,
When installing Microsoft Office with Wine, we find that some MS CDs have certain files marked as hidden on the CD.
Unfortunately, I don't have a strong feeling for what the 'right' solution is. I see several options:
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
I don't see the point of this...
Quoted 3 lines
2. Make it possible to set this mount option from user space (I don't like this, but it would get me around the problem).
?? do you mean use of -oremount ? possible, I suppose. Doesn't seem much better than (1) to me though.
Quoted 3 lines
3. Make it so that
isofs/dir.cstill strips out hidden files, but enableisofs/namei.cto return a hidden file that is opened directly by name.
Yes. Do this, or something like it.
AFAIK, Windows "hidden" files are supposed to behave much like Unix 'dot' files (.login, etc), so IMO the kernel should not use the hidden bit at all. Instead, it should be 'ls' et al that do this. Now, I guess this isn't particularly practical without changing fileutils and many other things, so I would suggest that the kernel is changed to pass on, if possible, but basically ignore the 'hidden' bit.
Regards,
Ruth
Signature · 2 lines
Ruth Ivimey-Cook Software engineer and technical writer.
Quoted 6 lines
AFAIK, Windows "hidden" files are supposed to behave much like Unix 'dot' files (.login, etc), so IMO the kernel should not use the hidden bit at all. Instead, it should be 'ls' et al that do this. Now, I guess this isn't particularly practical without changing fileutils and many other things, so I would suggest that the kernel is changed to pass on, if possible, but basically ignore the 'hidden' bit.
To me, this seems like the best approach. My solution offends my sensibilities in that we essentially 'throw away' the hidden bit information. However, I am sufficiently ignorant of the filesystem such that I don't really know if this is feasible, or if there is even a reasonable place to park the hidden bit information.
Cheers,
Jer
Followup to: <[email protected]> By author: Ruth Ivimey-Cook <[email protected]> In newsgroup: linux.dev.kernel
Quoted 8 lines
AFAIK, Windows "hidden" files are supposed to behave much like Unix 'dot' files (.login, etc), so IMO the kernel should not use the hidden bit at all. Instead, it should be 'ls' et al that do this. Now, I guess this isn't particularly practical without changing fileutils and many other things, so I would suggest that the kernel is changed to pass on, if possible, but basically ignore the 'hidden' bit.
There really should be some kind of ioctl() or other syscall to get/set the filesystem-specific attributes in cases like FAT (hidden, system, archive) and ISO9660. Trying to graft their meaning onto the Unix system just doesn't make sense.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
In article <1022301029.2443.28.camel@jwhiteh>,
Quoted 4 lines · Jeremy White
3. Make it so that
isofs/dir.cstill strips out hidden files, but enableisofs/namei.cto return a hidden file that is opened directly by name.
I think this is the right solution.
Linus
Followup to: <[email protected]> By author: [email protected] (Linus Torvalds) In newsgroup: linux.dev.kernel
Quoted 10 lines
In article <1022301029.2443.28.camel@jwhiteh>,
Quoted 4 lines · Jeremy White
3. Make it so that
isofs/dir.cstill strips out hidden files, but enableisofs/namei.cto return a hidden file that is opened directly by name.I think this is the right solution.
I think we should just dump the hidden bit; if someone wants it they can ioctl() for it.
-hpa
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
Quoted 20 lines · Jeremy White
Greetings,
When installing Microsoft Office with Wine, we find that some MS CDs have certain files marked as hidden on the CD. [...]
Unfortunately, I don't have a strong feeling for what the 'right' solution is. I see several options:
1. Invert the logic of the option, make it 'hide' instead of unhide, and so unhide is the default.
2. Make it possible to set this mount option from user space (I don't like this, but it would get me around the problem).
3. Make it so that
isofs/dir.cstill strips out hidden files, but enableisofs/namei.cto return a hidden file that is opened directly by name.
Quoted 9 lines
I am willing to submit a patch to implement the appropriate solution.
Comments and opinions are greatly appreciated; please copy me directly though, as I am not subscribed.
Thanks,
Jeremy
With 3. Wine's FindFirstFile and FindNextFile wont't be able to report hidden files and Win32 programs could rely on that instead of using hard-coded filenames.
If I'm not mistaken these functions return all files and put file flags in a struct. User apps are responsible of the hiding.
One could argue that Win32 programs could rely on the file flags being reported correctly, but I find this far less probable.
If one goal is to allow Wine to implement the Win32 syscalls as correctly as possible 3. is not an option IMHO.
Moreover I don't like the idea of files readable but not findable by common tools, seems broken to me.
2. will lead to entries in FAQ:
Q: What does the "unhide" option mean in my /etc/fstab ?
A: Lengthy explanation on ISO9660, Windows FS versus Unix FS and so on...
1. will do what Linux already does for other FAT/NTFS contents, simply show the info to the users even if Windows' tools hide it by default.
Personnaly I would choose 1. (I prefer short FAQs).
LB.
Quoted 4 lines · H. Peter Anvin
[...]
I think we should just dump the hidden bit; if someone wants it they canioctl()for it.
I didn't know we could and couldn't find how from a quick look-through in fs/. Is the ioctl really implemented ? If so where should I look ? That would be good news for Wine as they would have a way to populate the flags member of the struct.
LB.
Quoted 8 lines · Lionel Bouton
Quoted 4 lines · H. Peter Anvin
[...]
I think we should just dump the hidden bit; if someone wants it they canioctl()for it.
Quoted 5 lines
I didn't know we could and couldn't find how from a quick look-through in
fs/. Is the ioctl really implemented ? If so where should I look ? That would be good news for Wine as they would have a way to populate the flags member of the struct.
I don't think it's there now. We should add it, though.
-hpa