`dirname` is a simple string operation and doesn't touch the filesystem.  Specifically it does not expand symlinks.  I do not know how to solve this in Bash alone, but I've got a better idea anyway. 

I'll use Emacs' `file-truename` to expand to the file path.  Carton needs Emacs anyway, so I see no harm in spawning another Emacs instance for this purpose.  Do you have any objections?