CPAN changing permissions on OSX

some Perl code
some Perl code

If you are looking for a Perl module to interface with Amazon’s S3 hosting service, do not use the Net::Amazon::S3 module. It has an unrealistically huge list of modules on which it’s dependent (one of which is more like a framework — a pain in itself) and you’ll likely never get it installed. The Amazon::S3 module by Timothy Appnel installs without a hitch, and it was based on an earlier version of the Net::Amazon::S3 module.

So apparently something in CPAN on OSX 10.6 (Perl version 5.10.0) causes it to change permissions of the /usr/bin/cpan script, not only removing the executable bit for all, but also setting the write bit (not good).

This results in the common “permission denied” message when someone trys to run CPAN to install some Perl modules:


[root@lorien ~]# cpan
-bash: /usr/bin/cpan: Permission denied

For the uninitiated, this permission change will render your CPAN installation completely vulnerable to anyone who logs in (or breaks in) to the system, even standard “normal” user accounts.

You can run this find statement to show all files in a directory (including subdirectories) that are world-writeable:
find . -perm -o+w

In the example below, I’ve paired this with the “exec” argument using ‘ls’ to show the permissions and inode number of each file.


[root@lorien bin]# find . -perm -o+w -exec ls -ldi {} \;
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./c2ph
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./corelist
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./cpan
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./cpan2dist
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./cpanp
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./cpanp-run-perl
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./dprofpp
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./enc2xs
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./find2perl
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./h2ph
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./h2xs
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./libnetcfg
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./perlbug
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./perlcc
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./perldoc
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./perlivp
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./perlthanks
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./piconv
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pl2pm
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pod2html
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pod2latex
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pod2man
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pod2text
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pod2usage
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./podchecker
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./podselect
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./psed
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./pstruct
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./ptar
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./ptardiff
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./s2p
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./shasum
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./splain
2491453 -rw-rw-rw- 34 root wheel 807 2009-06-24 02:42 ./xsubpp

As you can see from the output, there are a lot of files that were affected, but you can also see from the inode number that they are all hard links to the same file (good in this case). So, we fix the permissions on one file and we fix them all.


[root@lorien bin]# chmod 0755 cpan
[root@lorien bin]# ls -ld cpan
-rwxr-xr-x 34 root wheel 807 2009-06-24 02:42 cpan
[root@lorien bin]# find . -perm -o+w -exec ls -ldi {} \;
[root@lorien bin]#

Life is good again. (Note: this will fix the problems, but not the root cause. I’m too lazy to start looking into CPAN itself to find the root cause, so… I’ll leave it to the smart guys who actually write the code for CPAN to figure that one out.)

And in case you are wondering, yes, my computer’s name is Lorien. What can I say? I’m a LotR nerd. Not too unusual for us techie types.

Language Skills

Skills
Chicks dig dudes with mad skills

Chicks dig dudes with mad skills. Today I’ll cover one of the most important types of skills to have this day & age: language skills. Language skills are some of the most valuable skills in existence, and their value ranks just a little bit below ninja skills and right around technical skills.

The ability to speak another language or several is one of the most beneficial and rewarding talents available to us today. Especially today, in this increasingly connected world. It’s much easier to travel than ever before, and also much easier to learn a new language. Of course, the best way to learn a new language is to travel to a place which speaks that language, hands down. If someone really wants to learn a language, I believe he/she can do so, and learn that language fluently, in a matter of months. Not years, months.

Note: If you equate “fluent” ability with “native” ability, you need to go back and check your etymology. “Fluent” comes from the word “fluid”, as in “to flow”. To be able to speak without having to stop for breaks to think of words and phrases, where the conversation just flows, this is what I mean by speaking “fluently”.

Anyone who really wants to learn a language can do it, and it’s not that hard these days. Here’s my simple 2-step method for learning a new language.

  1. Do some pre-country prep work.
  2. Go to your country of choice and start speaking.

That’s it.

I’ll break it down:

Pre-Country Prep Work

a) studying the country you want to visit
-> This is easy. Skim the Wikipedia article for that country. Also check out the WikiVoyage article for the same. This will give you a better feel for the country & people.

b) Studying the language. Learning the absolute basic phrases that you need to get around.
-> Here’s where the work comes in. Get some help. There are tons of free resources out there. LiveMocha.com, Coffee Break French and Coffee Break Spanish are all free. Pimsleur is probably the best for short-term and to learn the accent, but it’s expensive. Rosetta Stone will teach you both audio and also how to read/write/spell (very important). If you don’t have the cash for those, you might be able to get them from our friends in Sweden*. Also, Benny has some great tips at Fluent in 3 Months. Jennifer has a great site with a lot of info on several languages, which really helped me a lot when I was learning Spanish. How to Learn Any Language is another good one, both inspirational and has resources. Point is, there’s a lot out there, and it’s not hard to find if you really want it.

In-Country Actual Work

This is where the magic happens. Go to the country. Start speaking. You will be embarrassed to start speaking at first, that’s normal. Just get over it. Just start speaking {in that language}. You will learn so much in your first 2-3 weeks of speaking that language, and by the end of a couple of weeks, people will start to tell you that your {French, Spanish, whatever} has improved so much since you first came. This will give you a huge boost of inspiration you to keep speaking and learning more & more.

You’re halfway to fluency already! No joke, it really is that simple. Note that I didn’t say easy, just simple. Most people make it way more complicated, and make a lot of excuses as to why they just can’t learn a language. I don’t even like the word “can’t“. (Also, I find that people who make frequent use of that word tend to lead boring and unexceptional lives. Stay away from those people.)

Practice your language every opportunity you get. Hostel reception staff, bartenders, store clerks, waiters, people at the bus stop, baristas at the cafĂ©, etc. I’m serious, try to think of ways to ask questions to people and such. You won’t always understand their responses, but that’s ok. You can sort of figure it out just with body language and gestures.

Within 3 – 4 weeks in-country, if you have been diligent about this, you will be doing all these things in your target language. You will be able to get around with ease. Maybe you will need to ask for directions somewhere, but that’s ok. You are confident that you now have the skills to ask for directions and many more things because you’ve been doing it for the last few weeks. You will be able to go to any country that speaks your target language and get around. This is a huge confidence booster.

You Will Be Fluent

I am 100% serious, the only thing stopping you from becoming fluent in a langauge once you’re in-country is your own fear of looking stupid. Don’t expect the world to speak English, and in fact, avoid English when you can and you will be fluent in your new language within a few months. I promise. Or your money back (unless you actually paid me money, in which case you won’t be getting any of that back).

You know, I might be able to package this info into an e-book and sell it for $37! Not really. But Benny has one you can buy, and it’s pretty good from what I hear.

* I am just suggesting options for language learning. I don’t advocate piracy in any way, shape or form. Except this one.

How to break out of an exit popup in Firefox

Ever gone to a site and tried to close the window/tab and instead of closing, you get a popup? “Wait! Don’t go yet! Come back and sign up to my email (legit spam) list!”.

It looks something like this:

A Typical Exit Popup
A Typical Exit Popup (Very Annoying)

And keep trying to get your ass outta there, and each time it gets more & more frustrating, because the site won’t let you close the damn window.

On Firefox, just go to preferences (Mac = Command + comma), Content tab, and uncheck “Enable Javascript”. A-like so:

Then close the window. Then you can re-enable javascript by re-checking the box.

I don’t know about other browsers because I really don’t use any others.