Quarantined Files in Leopard
By | February 26th, 2009
This short post will share some information I learned about quarantined files on Leopard and how I recursively removed my isolated files from quarantine.
Today I was working on a MacPort for RabbitMQ and noticed something odd when I tar‘d up the package:
$ tar cvfz rabbitmq-server-macport-1.5.3.tar.gz net
./._net
net/
net/._rabbitmq-server
net/rabbitmq-server/
net/rabbitmq-server/._files
...
Initially I was really confused by the files ._net, ._rabbitmq-server, etc., because they did not exist in the directory. Finally I noticed something interesting about the ls output:
$ ls -ld net
drwxr-xr-x@ 3 cpettitt staff 102 Feb 24 22:35 net
The file had a special attribute (denoted by the @). A quick read of the ls manpage revealed that I could learn more about the @ property with ls -@:
$ ls -@ld net
drwxr-xr-x@ 3 cpettitt staff 102 Feb 24 22:35 net
com.apple.quarantine 42
Immediately I remembered that downloaded files are automatically quarantined by Leopard. It just so happens that I had download the package to test it and make changes. The files in the subdirectories of net were also quarantined, so I came up with a quick command to remove a tree of files from quarantine:
$ find . -print0 | xargs -0 xattr -l | grep com.apple.quarantine |
cut -d: -f1 | xargs -I% xattr -d com.apple.quarantine %
This command searches for all files starting from the root directory (.) and sends them to xargs. I used -print0 and -0 so that xargs handled files with whitespace correctly.
The xattr -l command lists all extended attributes for the file and the subsequent grep filters out all files but those that are quarantined. The cut pattern just pulls the filename from what appears to be a colon (:) separated list.
Finally I tell xattr to delete the quarantine attribute. I used the -I option to set up a replacement for % because it also forces xargs to only split on newlines and not all whitespace (including spaces in filenames).
Having freed my files, tar worked as I expected:
$ !tar
tar cvfz rabbitmq-server-macport-1.5.3.tar.gz net
net/
net/rabbitmq-server/
net/rabbitmq-server/files/
net/rabbitmq-server/files/rabbitmqctl_wrapper
net/rabbitmq-server/Portfile
Hopefully this will save someone else some time!
Copying the GNU screen buffer to the Leopard clipboard
By | October 18th, 2008
Quite a while back I wrote an article about how I use GNU screen’s scrollback buffer. In the article I detailed how to copy the scrollback buffer into the Mac clipboard, which made it easy to copy data to other Mac applications. Unfortunately, I recently moved to Leopard and discovered this no longer works. In this short article I will explain an updated procedure that works for Leopard.
GNU Screen: Working with the Scrollback Buffer
By | March 11th, 2007
GNU Screen is a UNIX tool that allows multiple console applications to be run, each in its own “window”, from the same terminal. In a single Screen session, you can run interactive shells, mail programs, SSH sessions, and other console based applications, and you can easily switch between these using hotkeys. You can even split up the Screen display so that multiple Screen windows can be viewed at the same time.
If you’ve never used Screen, but frequently use console applications, it is definitely a tool worth exploring. An introduction to Screen can be found on the Kuro5hin website.
In this article I share my experience with one of my favorite screen features: its scrollback buffer. As you interact with a Screen window, Screen stores a configurable number of lines of history in its scrollback buffer. The scrollback buffer makes it easy to browse or even search through the history of your windows. In addition, it makes it easy to copy and paste any section of text from the history.
Customizing WordPress Home with Thumbnailed Articles
By | August 2nd, 2006
Though WordPress websites often have a very similar look and feel (lists of blog posts), it is actually very customizable. In this article, we explore a way to make a unique home page that displays a list of articles with thumbnails (see the final screenshot below).
