Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / June 2006



Tip: Looking for answers? Try searching our database.

Odd 'head' problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dennis Putnam - 15 Jun 2006 12:22 GMT
I'm not exactly sure this is what happened but I can't think of  
anything else. After installing several packages from CPAN, my daily  
log maintenance began failing. After some investigation I found that  
'/etc/periodic/daily/500.daily' was getting an error from the '/usr/
bin/head' command. When I ran 'head' manually the command was not the  
normal one. It appears that one of the perl packages replaced the  
normal 'head' command that works on files, with one that works on  
URLs. Has anyone encountered this, or can anyone determine if my  
surmise about one of the perl packages is correct? Thanks.

Dennis Putnam
Sr. IT Systems Administrator
AIM Systems, Inc.
11675 Rainwater Dr., Suite 200
Alpharetta, GA  30004
Phone: 678-240-4112
Main Phone: 678-297-0700
FAX: 678-297-2666 or 770-576-1000
The information contained in this e-mail and any attachments is  
strictly confidential. If you are not the intended recipient, any  
use, dissemination, distribution, or duplication of any part of this  
e-mail or any attachment is prohibited. If you are not the intended  
recipient, please notify the sender by return e-mail and delete all  
copies, including the attachments.
Andy Holyer - 15 Jun 2006 12:31 GMT
> I'm not exactly sure this is what happened but I can't think of  
> anything else. After installing several packages from CPAN, my  
[quoted text clipped - 6 lines]
> anyone determine if my surmise about one of the perl packages is  
> correct? Thanks.

This is a common gotcha on Os X. For some reason which I forget, but  
which I think was due to backwards compatibility with earlier  
versions of MacOs, the standard file system is not case sensitive:  
HEAD and head are considered equivalent.

In the Perl distribution there is a script called "HEAD" which indeed  
does fetch the header of an HTML file from the web. This clashes with  
the standard Unix "head" command.

There is a standard workaround, but just renaming the HEAD script  
solves things without (ISTR) breaking too much else.
Sherm Pendley - 15 Jun 2006 14:56 GMT
>> I'm not exactly sure this is what happened but I can't think of  
>> anything else. After installing several packages from CPAN, my  
[quoted text clipped - 8 lines]
>
> This is a common gotcha on Os X.

No, it *was* a common gotcha, several years ago.

> In the Perl distribution there is a script called "HEAD" which  
> indeed does fetch the header of an HTML file from the web. This  
> clashes with the standard Unix "head" command.

It's in the LWP module, not the core Perl distribution.

> There is a standard workaround

Yes, it's called reading the instructions and paying attention. The  
current default behavior for LWP when installing on a case-
insensitive is to *not* install the HEAD alias for lwp-request.  
That's been the default for quite a long time now - a couple of years  
at least. You have to specifically override the default for this to  
happen.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Martin Redington - 15 Jun 2006 12:48 GMT
You are (probably) correct.

Its one of the web related cpan packages. LWP maybe, or something  
similar.

It actually installs a command named HEAD rather than head, IIRC, but  
on a case insensitive file system, these are pretty much the same  
thing ...

> I'm not exactly sure this is what happened but I can't think of  
> anything else. After installing several packages from CPAN, my  
[quoted text clipped - 21 lines]
> intended recipient, please notify the sender by return e-mail and  
> delete all copies, including the attachments.
Sherm Pendley - 15 Jun 2006 14:41 GMT
> I'm not exactly sure this is what happened but I can't think of  
> anything else. After installing several packages from CPAN, my  
[quoted text clipped - 4 lines]
> packages replaced the normal 'head' command that works on files,  
> with one that works on URLs.

That's precisely what happened. The LWP package installs a script  
called HEAD that does an HTTP HEAD request. On case-insensitive file  
systems like HFS+, head and HEAD are the same.

> Has anyone encountered this, or can anyone determine if my surmise  
> about one of the perl packages is correct? Thanks.

Yes, many people have had this problem. It's not come up for several  
years, though, because recent versions of the LWP install script asks  
if you want to overwrite head and install HEAD when it detects a case-
insensitive file system, and the default answer to that question is  
"no". Here's what the questions look like:

    The lwp-request program will use the name it is invoked with to
    determine what HTTP method to use.  I can set up alias for the most
    common HTTP methods.  These alias are also installed in
    /usr/bin.

    Do you want to install the GET alias? [n]
    Do you want to install the HEAD alias? [n]
    Do you want to install the POST alias? [n]

The moral of the story - *read* the questions, don't just keep  
bouncing on the 'y' and 'return' keys.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Dennis Putnam - 15 Jun 2006 14:55 GMT
I don't recall those questions at all, however it is not at all  
obvious that 'HEAD' is going to replace 'head'. I'm not sure I  
understand the earlier comment about case insensitive filesystems.  
Certainly, OS X is not case insensitive at the CLI level, although  
'Finder' is. However, PERL is running at the CLI level so I don't see  
why that should be a problem.

Oh, well. Lesson learned, albeit too late.

P.S. If 'HEAD' is an alias, where is the real file?

>> I'm not exactly sure this is what happened but I can't think of  
>> anything else. After installing several packages from CPAN, my  
[quoted text clipped - 34 lines]
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org

Dennis Putnam
Sr. IT Systems Administrator
AIM Systems, Inc.
11675 Rainwater Dr., Suite 200
Alpharetta, GA  30004
Phone: 678-240-4112
Main Phone: 678-297-0700
FAX: 678-297-2666 or 770-576-1000
The information contained in this e-mail and any attachments is  
strictly confidential. If you are not the intended recipient, any  
use, dissemination, distribution, or duplication of any part of this  
e-mail or any attachment is prohibited. If you are not the intended  
recipient, please notify the sender by return e-mail and delete all  
copies, including the attachments.
Sherm Pendley - 15 Jun 2006 15:20 GMT
> I don't recall those questions at all, however it is not at all  
> obvious that 'HEAD' is going to replace 'head'. I'm not sure I  
> understand the earlier comment about case insensitive filesystems.  
> Certainly, OS X is not case insensitive at the CLI level, although  
> 'Finder' is.

That's complete nonsense, as the simplest test will show:

    ~ sherm$ echo "Hello world" > head
    ~ sherm$ cat HEAD
    Hello world

HFS+ is a case-insensitive file system. Finder has nothing whatsoever  
to do with it - it's just a user-level file manager.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Joel Rees - 17 Jun 2006 01:23 GMT
>> I don't recall those questions at all, however it is not at all  
>> obvious that 'HEAD' is going to replace 'head'. I'm not sure I  
[quoted text clipped - 10 lines]
> HFS+ is a case-insensitive file system. Finder has nothing  
> whatsoever to do with it - it's just a user-level file manager.

    base:~ me$ echo "hello Mac OS X mailing list" > head
    base:~ me $ cat HEAD
    cat: HEAD: No such file or directory
    base:~ me $ cat head
    hello Mac OS X mailing list
    base:~ me $

;-)

Yes, my boot volume is HFS+, and I have not moved the user  
directories off of it on this machine.

Explanation:

Case sensitivity is a property of the file system, which is separate  
from the shells (both CLI and GUI).

Current versions of Mac OS X (from at least 10.2) allow you to  
specify case sensitivity on both UFS and HFS+ volumes when you  
partition a drive. I always format all my volumes case sensitive,  
except for the volume I keep classic on.

I'm not sure if it's possible to change the case sensitivity when re-
formatting existing partitions, and it would take more time than I  
want to take right now to check.

As a side note, I prefer to put /usr/local, /www, and similar stuff  
on separate volumes formatted UFS as much as possible. Those are also  
case sensitive, of course.

An even further off-topic complaint, it would be nice to be able to  
make an even finer cut, and put /var/log, /tmp, /var/tmp, etc. on  
separate partitions as damage-limiting measures, but, one, I run out  
of partitions when I do things like dual-boot openbsd, and, two, I  
won't trust Mac OS X's handling of hard or soft links to that level  
until /etc/fstab is respected before autodiskmount or whatever it's  
called kicks in. I've got swap on a separate partition on one of my  
old machines with limited hard disk space, and it definitely speeds  
that old machine up, but I don't recommend playing those tricks on a  
machine that I want to load arbitrary applications on.

(Any Apple people reading the list, please note that there are good  
reasons for allowing /etc/fstab to do its job.)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.