Macos – Cannot delete file in OS X

macostrash

I have a file in trash, and I cannot delete it. Before you ask me to STFW, no, the file is not locked :-/

The file is a symbolic link to nothing (target is deleted). Here is the output of ls -lO on that file:

lrwxrwxrwx  1 1000  _lpoperator  uappnd,nodump,opaque,compressed 22 Apr  3  2009 fly.pdf -> stuff.pdf

The output of rm is

$ sudo rm fly.pdf
rm: fly.pdf: No such file or directory

However the file does exist, which can be confirmed by ls or by opening trash in Finder. If I empty trash using the menu, it plays that sound and nothing happens. If I try securely empty trash, it complains about not having permission. So I'm stuck… Any suggestion?

BTW, the file in question is in the trash of a volume called "Shared", which is not the boot volume.

UPDATE: @bug pointed out that this may be caused by my link being opaque, and suggested to delete it in a chroot jail. I tried that, and chroot gave me a segmentation fault. Here is what I did for that: I enabled root following this, and followed @bug's answer and this to create the chroot jail. Chroot gave me

# chroot /Volumes/Shared
Segmentation fault: 11

Best Answer

Chflags has an option -h to not follow links (which I constantly ignored...).

# chflags -h noopaque,nouappnd,dump fly.pdf

And then empty trash.

Related Question