無法刪除 HFS 磁碟區上的某些符號連結 (Mac OS X 10.7.2)

無法刪除 HFS 磁碟區上的某些符號連結 (Mac OS X 10.7.2)

我似乎無法刪除一堆文件;所有這些文件的共同點如下:

  • 它們都是符號鏈接,或其他父目錄
  • 它們都屬於未對映的使用者和群組

那是:

sh-3.2# find . -type l -exec ls -ld {} \;
lrwxrwxrwx  1 1001  1001  14 10 Apr  2011 ./kernel/kernel -> linux-2.6.38.2
lrwxrwxrwx  1 1001  1001  15 25 May  2011 ./kernel/logo/logo.ppm -> skull-black.ppm
lrwxrwxrwx  1 1001  1001  19  2 Sep 15:12 ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0 -> libdefault.so.0.0.0
lrwxrwxrwx  1 1001  1001  17  2 Sep 15:12 ./redhat/BUILD/gol-git/display/nico2/.libs/libnico2.so -> libnico2.so.0.0.0
lrwxrwxrwx  1 1001  1001  15 15 Jul  2011 ./redhat/BUILD/libg15-1.2.7/.libs/libg15.so -> libg15.so.1.0.0
lrwxrwxrwx  1 1001  1001  15 15 Jul  2011 ./redhat/BUILD/libg15-1.2.7/.libs/libg15.so.1 -> libg15.so.1.0.0
sh-3.2# find . -type d -exec ls -ld {} \;
drwxrwxrwx  4 root  wheel  136 23 Jan 10:55 .
drwxrwxrwx  3 root  wheel  136 22 Jan 22:33 ./kernel
drwxrwxrwx  2 root  wheel  102 22 Jan 22:31 ./kernel/logo
drwxrwxrwx  3 root  wheel  102 23 Jan 10:55 ./redhat
drwxrwxrwx  4 root  wheel  136 23 Jan 10:55 ./redhat/BUILD
drwxrwxrwx  3 root  wheel  102 23 Jan 10:55 ./redhat/BUILD/gol-git
drwxrwxrwx  4 root  wheel  136 23 Jan 10:55 ./redhat/BUILD/gol-git/display
drwxrwxrwx  3 root  wheel  102 22 Jan 22:21 ./redhat/BUILD/gol-git/display/default
drwxrwxrwx  2 root  wheel  102 22 Jan 22:33 ./redhat/BUILD/gol-git/display/default/.libs
drwxrwxrwx  3 root  wheel  102 22 Jan 22:21 ./redhat/BUILD/gol-git/display/nico2
drwxrwxrwx  2 root  wheel  102 23 Jan 11:00 ./redhat/BUILD/gol-git/display/nico2/.libs
drwxrwxrwx  3 root  wheel  102 22 Jan 22:21 ./redhat/BUILD/libg15-1.2.7
drwx------  2 root  wheel  136 22 Jan 22:21 ./redhat/BUILD/libg15-1.2.7/.libs
sh-3.2# find . -not -type d -a -not -type l -exec ls -ld {} \;
sh-3.2#

至於刪除:

sh-3.2# ls -l ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0
lrwxrwxrwx  1 1001  1001  19  2 Sep 15:12 ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0 -> libdefault.so.0.0.0
sh-3.2# rm -f ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0
sh-3.2# ls -l ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0
lrwxrwxrwx  1 1001  1001  19  2 Sep 15:12 ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0 -> libdefault.so.0.0.0
sh-3.2# rm  ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0 
rm: ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0: No such file or directory
sh-3.2# ls -li !$
ls -li ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0
282892 lrwxrwxrwx  1 1001  1001  19  2 Sep 15:12 ./redhat/BUILD/gol-git/display/default/.libs/libdefault.so.0 -> libdefault.so.0.0.0
sh-3.2# 

相關 HFS 磁碟區的掛載選項如下:

  • hfs、本地、nodev、nosuid

答案1

這些是符號連結。您要刪除連結還是原始檔案? (無論哪種方式, rm 都應該有效。)您可以嘗試unlink,但這是更危險的選擇。您也可以嘗試sudo rm,儘管我不確定這是否會對您的情況產生任何影響。最後的選擇是嘗試使用 更改所有者sudo chown。 (但同樣,這可能不適用於認為它們不存在的文件...)

相關內容