-2

I accidentally ran this command while trying to remove an errant directory named \\ from my project directory. Quite a mistake I know. It pretty quickly began hitting permissioned files at which point I realized my mistake so I ctrl-c'ed out of there. I have all my important projects backed up but the command killed my development environment. Opening vim anywhere is crashing and throwing a segfault like so:

Vim: Caught deadly signal SEGV

Error detected while processing function <SNR>130_PollServerReady[7]..<SNR>130_Pyeval:Vim: Finished.

line    4:
Exception MemoryError: MemoryError() in <module 'threading' from '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.pyc'> ignored
[1]    6921 segmentation fault  vim ~/dotfiles/.vimrc

My primary question for myself and anyone who commits a similar gaff is:

What, precisely does the double backslash // point to? What would be deleted first? Is there a logical first place to begin replacing util, configs, $PATH stuff etc?

Hopefully, this is clear and specific enough for SO.

Justus Eapen
  • 1,139
  • 10
  • 22
  • This might be related to GNU rm. I'm not interested in testing this command, but perhaps (in [GNU coreutils](https://www.gnu.org/software/coreutils/), which is _not_ standard in Mac OS) `rm -rf //` may be equivalent to `rm -rf --no-preserve-root /` – Adam Katz Nov 20 '18 at 16:47
  • This doesn't look like a programming-related question, I think it belongs more on another network. Maybe serverfault.stackexchange ? – ChatterOne Nov 21 '18 at 08:41

2 Answers2

2

cd // will take you to the root directory /.

rm performs a depth-first search, walking the results of the xfts_open call. find also traverses filesystems in this manner.

find / will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.

Alternatively, you can use debugfs to help you get at the files.

This assumes that these commands will actually work. Realistically, your system is probably hosed. Deleting things in / will break your computer. Restoring from backup is probably the easiest way to return to a functional system. You can also try various utilities to recover recently erased files from your hard drive; if you plan on doing this, you should stop using your computer, as your hard drive currently treats many areas as free space (since you told it to) which recently held files in / and it could start writing to those areas.

jeremysprofile
  • 10,028
  • 4
  • 33
  • 53
  • 1
    If it was run as an independent user, then it should have only deleted files which that user has access to, which may have included an install of vim. You could try reinstalling vim. If it was run as root then your system is definitely hosed. Backup what you can and reinstall. – Conner Nov 20 '18 at 18:31
0

In Linux, and I believe other *nix flavours, an extra slash in a path is simply ignored. Thus, a//b is the same as a/b and // is the same as /. I hope you didn't run this as a superuser...

joanis
  • 10,635
  • 14
  • 30
  • 40