linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PROBLEM: hfsplus filesystem allows opendir() on plain files
@ 2008-12-02 15:26 Damian Stewart
  2008-12-02 22:21 ` Brad Boyer
  0 siblings, 1 reply; 11+ messages in thread
From: Damian Stewart @ 2008-12-02 15:26 UTC (permalink / raw)
  To: linux-fsdevel

1. hfsplus filesystem allows opendir() on plain files.

2. When opendir() is called on a plain file stored in an hfsplus 
filesystem, opendir() fails to return 0 and set errno to ENOTDIR.

3. filesystem, hfsplus

4. Linux version 2.6.27-7-generic (buildd@palmer) (gcc version 4.3.2 
(Ubuntu 4.3.2-1ubuntu11) ) #1 SMP Tue Nov 4 19:33:20 UTC 2008

5. unknown

6. n/a

7. Try the following program on files and directories first under a 
mountpoint for an ext3 partition then under a mountpoint for an hfsplus 
partition.

///////////////////////////////////
#include <dirent.h>
#include <stdio.h>
#include <errno.h>

// usage: opendir_test <file>|<directory>

int main( int argc, char** argv )
{
     DIR* result = opendir( argv[1] );
     printf("ENOTDIR is 0x%x\n", ENOTDIR );
     printf("opendir '%s' returned 0x%x, errno 0x%x\n", argv[1], result, 
errno );
     return 0;
}
//////////////////////////////////


I get the following output:

damian@damian-laptop:~/code/opendir$ mkdir test_directory
damian@damian-laptop:~/code/opendir$ echo hello > test_file.txt
damian@damian-laptop:~/code/opendir$ ./opendir_test test_directory
ENOTDIR is 0x14
opendir 'test_directory' returned 0x88f6008, errno 0x0
damian@damian-laptop:~/code/opendir$ ./opendir_test test_file.txt
ENOTDIR is 0x14
opendir 'test_file.txt' returned 0x0, errno 0x14
# /osx is an HFSPLUS mountpoint
damian@damian-laptop:~/code/opendir$ cd /media/osx
# mkdir test_directory && echo hello > test_file.txt performed in OSX
damian@damian-laptop:/media/osx$ ./opendir_test test_directory
ENOTDIR is 0x14
opendir 'test_directory' returned 0x919d008, errno 0x0
# erroneous result follows
damian@damian-laptop:/media/osx$ ./opendir_test test_file.txt
ENOTDIR is 0x14
opendir 'test_file.txt' returned 0x9a23008, errno 0x0
damian@damian-laptop:/media/osx$

8. If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.

Linux damian-laptop 2.6.27-7-generic #1 SMP Tue Nov 4 19:33:20 UTC 2008 
i686 GNU/Linux

Gnu C                  4.3.2-1ubuntu11)
Gnu make               3.81
binutils               Binutils
util-linux             2.14
mount                  support
module-init-tools      3.3-pre11
e2fsprogs              1.41.3
reiserfsprogs          3.6.19
pcmciautils            014
Linux C Library        2.8.90
Dynamic linker (ldd)   2.8.90
Procps                 3.2.7
Net-tools              1.60
Kbd                    1.14.1
Sh-utils               6.10
udev                   124
wireless-tools         29
Modules Loaded         ipv6 aes_i586 aes_generic nls_utf8 hfsplus i915 drm 
af_packet binfmt_misc btusb sco bridge stp bnep rfcomm l2cap bluetooth 
ppdev acpi_cpufreq cpufreq_stats cpufreq_powersave cpufreq_conservative 
cpufreq_userspace cpufreq_ondemand freq_table container wmi pci_slot sbs 
sbshc iptable_filter ip_tables x_tables sbp2 parport_pc lp parport joydev 
snd_hda_intel arc4 snd_pcm_oss snd_mixer_oss iTCO_wdt ecb crypto_blkcipher 
iTCO_vendor_support snd_pcm ath9k evdev appleir pcspkr appletouch 
snd_seq_dummy mac80211 snd_seq_oss cfg80211 snd_seq_midi snd_rawmidi 
snd_seq_midi_event snd_seq video snd_timer snd_seq_device output battery 
snd ac intel_agp button soundcore agpgart shpchp pci_hotplug snd_page_alloc 
ext3 jbd mbcache sd_mod crc_t10dif sr_mod cdrom sg ata_generic ata_piix 
usbhid hid pata_acpi ohci1394 libata ieee1394 scsi_mod ehci_hcd uhci_hcd 
dock usbcore sky2 thermal processor fan fbcon tileblit font bitblit 
softcursor fuse

thanks
d

-- 
damian stewart | skype: damiansnz | damian@frey.co.nz
frey | live art with machines | http://www.frey.co.nz

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-06 22:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 15:26 PROBLEM: hfsplus filesystem allows opendir() on plain files Damian Stewart
2008-12-02 22:21 ` Brad Boyer
2008-12-05  8:53   ` Damian Stewart
2008-12-06  6:00     ` Brad Boyer
2008-12-05  9:39   ` Christoph Hellwig
2008-12-06  6:32     ` Brad Boyer
2008-12-06  6:47       ` Al Viro
2008-12-06  7:21         ` Brad Boyer
2008-12-06 22:31           ` Al Viro
2008-12-06 22:35             ` Al Viro
2008-12-06 12:06         ` Anton Altaparmakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).