«

»

Apr
04

Interesting Bug in OS/X Finder

I discovered this by accident today while backing up a Subversion repository. I had written a small script to automate the generation of sane-sized incrementals and decided to given them a filename that was in the form:


lower:upper

Where lower and upper are whole, positive numbers. [ eg) 1:499, 500:999 ].
Since my script had a few errors while I was writing and testing it, I decided to carefully open the storage directory in the Finder and manually clean things up.

Finder.app a bit confused

I was fairly surprised when I saw the directory (see image).

Apparently the colon character is not permitted in HFS filenames, however, nothing will stop you from making these files in the shell. I suspect that Finder.app is using a backward compatibiliy mode to display these files in the GUI in case they are on volumes from OS 9 and earlier.

Looking at the output of ls shows quite a different story, namely, the one I expected:


$ls -l
total 0
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 1:2
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 2:3
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 3:4
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 4:5
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 5:6
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 6:7
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 7:8
-rw-r--r-- 1 user wheel 0 Apr 4 18:47 8:9
-rw-r--r-- 1 user wheel 0 Apr 4 18:59 9:10
machine:/tmp/1571.foo

It gets moderately more intesting: if you try to create a file (or folder) via the GUI; you will get a warning indicating that you cannot create a filename with punctuation (or try making the name shorter)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>