Resource forks are part of the Mac Operating System. They are responsible for storing information about a file such as the icon it should have, window shapes, and other meta data. Usually, resource forks are transparent to the user. However, when using a facility like tar, resource forks become quite opaque.
An example would help demonstrate the issue:
wolverine:bulk-import-lab wjb$ tar -cvf testimport2.tar *.csv a ./._callpark.csv a callpark.csv a ./._css.csv a css.csv a ./._devicemobilityinfo.csv a devicemobilityinfo.csv a ./._devicepool.csv a devicepool.csv a ./._mediaresourcegroup.csv a mediaresourcegroup.csv a ./._mediaresourcegrouplist.csv a mediaresourcegrouplist.csv a ./._meetmenumber.csv a meetmenumber.csv a ./._partition.csv a partition.csv a ./._phonebuttontemplate.csv a phonebuttontemplate.csv a ./._region.csv a region.csv a ./._routegroup.csv a routegroup.csv a ./._routelist.csv a routelist.csv a ./._routepattern.csv a routepattern.csv a ./._softkeytemplate.csv a softkeytemplate.csv a ./._translationpattern.csv a translationpattern.csv
In the above example, you can see that each file (e.g. callpark.csv) has a “tag along” (e.g. ./._callpark.csv). This “tag along” is the resource fork. If I were to upload testimport2.tar to CUCM and perform a validation on the file, it will fail. It will also fail to insert the bulk file. This is because the CUCM doesn’t know what all of those extra files are.
I poured over the Man page for tar and couldn’t find anything that would help remedy the situation. I tried to use the “–exclude” command line option with no success. After some digging I found out that you can mitigate this issue with a workaround.
The workaround involves creating an environment variable in your shell session. For Mac OS X versions prior to Leopard, the environment variable is COPY_EXTENDED_ATTRIBUTES_DISABLE. In Leopard, Snow Leopard, and Lion the environment variable is COPYFILE_DISABLED.
wolverine:bulk-import-lab wjb$ export COPYFILE_DISABLE=true wolverine:bulk-import-lab wjb$ tar -cvf testimport3.tar *.csv a callpark.csv a css.csv a devicemobilityinfo.csv a devicepool.csv a mediaresourcegroup.csv a mediaresourcegrouplist.csv a meetmenumber.csv a partition.csv a phonebuttontemplate.csv a region.csv a routegroup.csv a routelist.csv a routepattern.csv a softkeytemplate.csv a translationpattern.csv
Using the “export” command, we create the environment variable and then run the tar command again. This time (as seen in the example) there is no extra baggage. This can be verified with tar -tf testimport3.tar.
Now, when I upload testimport3.tar to CUCM and validate the tar archive, everything passes. Now, of course, the next problem is ensuring the file entries successfully import. That is a much longer story!!
2 responses to “Using Tar on Mac OS X to Create a CUCM Bulk Import File”
Good catch , I was fighting with this mistake and now it is working fine .
Thank you for pointing me this 🙂
Good blog too 🙂
Glad you found the information helpful and thanks for the feedback!