Time Machine and the dreaded negative sign I am about to modify the file ownerships in my Time Machine disk, which uses ACLs.

Since it is my (only) backup disk, I thought I'd solicit comments on the script before I run it. The objective is to fix file ownerships so that /Vol/TM/Back/2012-xx-yy/Users/bob is owned by user bob, to make it possible for Bob to browse his TM history.

#!/bin/csh
# Replace Foobar, Bob, and Brand.
set PREFIX="/Volumes/Foobar-Time-Machine/Backups.backupdb/Bob’s MacBook"
set SUFFIX="/Brand/Users/"
set USER="bob"

foreach dir ($PREFIX/*)
    chmod -R -a "group:everyone deny chown" "$PREFIX$dir$SUFFIX$USER"
    chown -R $USER "$PREFIX$dir$SUFFIX$USER"
    chmod -R =a# 1 "group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown" "$PREFIX$dir$SUFFIX$USER"
end


Do you spot a disaster waiting to happen? The first chmod is meant to remove minimal ACL and the second is meant to restore it. Can the script be made safer? Needless to say, the script would be run as sudo.
Yes, it's scary, and yes I'd be worried.  Why doesn't bob already own his own backups?  If it's because of a UID or UUID mis-match, what's preventing recreating this problem (perhaps in reverse) in the future?  If you can risk damaging the live machine I'd rather change Bob's UID and UUID on the live machine than on the backups, on the theory that there are probably other UUID mis-matches lurking on other disks.

In any case, scary as it is, if I were to try to fix I'd use the Finder if it were just a few folders that could be fixed with "Apply to enclosed items...".  If that was impractical, next thing I'd try would be to find files owned by whoever currently owns Bob's stuff and change only those files.  Going off of file path seems kind of risky to me.