Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: path names?



You want to hear a sweet story about the ^$%Q^W&*$T trailing slash in a path? Prepare yourself because you're either going to laugh your heart out at me or cry desperately sympathizing with me! Needless to say, I did the last one when it happened...

My Mother is a Historian and Sociologist and is currently writing a 2 years research project for her Post Doc thesis and presentation. My Father is a philosopher and at the time of this story He had spent two weeks writing some articles He was due to present at a nation wide conference about the current political situation in my country. My father, anyone who knows him will tell you, is not particularly known for having a "good" temper... He asked me to please help him locate some things in their computer he couldn't find so thinking I was **THE** UNIX god I just fired up a terminal and started playing with "find". "This is a piece of cake..." I said to myself seconds before all hell broke loose... When I realized there was an extra symbolic link to "/Desktop Folder" right at the root level, that is:

/Desktop --> /Desktop Folder (never could figure out why it was there in the first place)

I decided to erase it since I didn't see much use for it:

rm -rf /Desktop/

... ... ... ... ... ... ... ... I wanted to DIE when I realized what I had done!!!! When I realized the rm'ing was taking quite *long* I knew there was something severely wrong! When you deal with symbolic links the first tab-complete just puts the name there fore you and the second one appends the trailing slash... When the trailing slash is there the command acts on the target and not on the link itself. And please UNIX gurus, don't come telling me that's wrong and that I'm not understanding how links work, I know that was the precise behavior because that single and simple command erased ***EVERY SINGLE FILE*** my parents kept inside the Mac OS 9 Desktop Folder, which happened to be nothing more than ***ALL THEIR DOCUMENTS*** (don't ask me why they kept them there, that's a different story). I literally started looking around the room to see if I could spot a gun somewhere...! The sweetest part of the story is that the link remained there, laughing its %W$^R&*#%#@$O^& off at me!!!

Thankfully my mother, who was in Argentina by the time (quite far and *unreachable* for me at the moment), was smarter than I thought and had backed up all the files three days before, and my father had sent the articles to colleagues over email the previous night so He was able to get most back. Still, you can imagine I had quite a bad night not knowing those two last pieces of information.

So in short, be very careful about the trailing slash when it comes to deleting or related activities. I don't know if the behavior I described here is limited to the HFS+ filesystem or if it's the standard UNIX way of dealing with symlinks and their trailing slashes (I seriously doubt the second option), but in any case it is very dangerous because sometimes you just double tab-complete (mechanical reflect) and don't realize what you're setting yourself up to. That's exactly what happened to me.

Just my thoughts, or rather my sad Oprah Winfrey stories! So tell me now, are you crying or laughing... ?


Juan.


On Tuesday, April 29, 2003, at 03:55 PM, Clint McIntosh wrote:

What is the difference between:
/path/name/here and /path/name/here/ ?

I have seen both used in online and printed documentation for OSX and I
can't determine if there is a difference and if there is, what exactly IS
the difference.

Can any of you unix gurus out there explain in terms a long time MacOS user
with minimal unix exposure such as myself can understand?

Clint McIntosh -- email@hidden
_______________________________________________
macos-x-server mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macos-x-server
Do not post admin requests to the list. They will be ignored.

References: 
 >path names? (From: Clint McIntosh <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.