|
-
March 1st, 2001, 04:40 AM
#1
Is this a bug?
hi..this is what I did..is this a bug? Kindly spare time to read thro..
I deleted the file softlnk and it mysteriously reappeared..
I could not duplicate the results with identical instruction steps.
[root@bpp170 /root]# ls -li
total 6736
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
[root@bpp170 /root]# touch test
[root@bpp170 /root]# vi test
[root@bpp170 /root]# ln testhrdlnk test
ln: testhrdlnk: No such file or directory
[root@bpp170 /root]# ln test testhrdlnk
[root@bpp170 /root]# ls -a
. .Xauthority .bash_logout .cshrc .gnome_private .new1.swp .tcshrc new test
.. .Xresources .bash_profile .gnome .mc .newsrc-news.jaring.my .xsession-errors ns_imap testhrdlnk
.ICEauthority .bash_history .bashrc .gnome-desktop .netscape .sawfish core nsmail
[root@bpp170 /root]# ls -li
total 6744
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255952 -rw-r--r-- 2 root root 80 Mar 1 09:21 test
255952 -rw-r--r-- 2 root root 80 Mar 1 09:21 testhrdlnk
[root@bpp170 /root]# vi test
test testhrdlnk
[root@bpp170 /root]# vi testhrdlnk
[root@bpp170 /root]# cat test
sdfgdfgdfsdgdf
[root@bpp170 /root]# cat testhrdlnk
sdfgdfgdfsdgdf
[root@bpp170 /root]# rm test
rm: remove `test'? y
[root@bpp170 /root]# ls -i
255915 core 255929 new 224241 ns_imap 129041 nsmail 255952 testhrdlnk
[root@bpp170 /root]# vi testhrdlnk
[root@bpp170 /root]# rm testhrdlnk
rm: remove `testhrdlnk'? n
[root@bpp170 /root]# ls -i
255915 core 255929 new 224241 ns_imap 129041 nsmail 255952 testhrdlnk
[root@bpp170 /root]# vi softlnk
[root@bpp170 /root]# ls -il
total 6744
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255954 -rw-r--r-- 1 root root 17 Mar 1 09:27 softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# ln -s softlnk test
[root@bpp170 /root]# ls -i
255915 core 255929 new 224241 ns_imap 129041 nsmail 255954 softlnk 255953 test 255952 testhrdlnk
[root@bpp170 /root]# ls -il
total 6744
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255954 -rw-r--r-- 1 root root 17 Mar 1 09:27 softlnk
255953 lrwxrwxrwx 1 root root 7 Mar 1 09:28 test -> softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# vi test
[root@bpp170 /root]# vi test
[root@bpp170 /root]# vi softlnk
[root@bpp170 /root]# rm softlnk
rm: remove `softlnk'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255953 lrwxrwxrwx 1 root root 7 Mar 1 09:28 test -> softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# vi test
[root@bpp170 /root]# ln -s testhrdlnk test
ln: test: File exists
[root@bpp170 /root]# rm test
rm: remove `test'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255955 -rw-r--r-- 1 root root 0 Mar 1 09:29 softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255955 -rw-r--r-- 1 root root 0 Mar 1 09:29 softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# vi softlnk
[root@bpp170 /root]# rm softlnk
rm: remove `softlnk'? y
[root@bpp170 /root]# vi softlnk
[root@bpp170 /root]# ln -s softlnk test
[root@bpp170 /root]# vi test
[root@bpp170 /root]# rm softlnk
rm: remove `softlnk'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255953 lrwxrwxrwx 1 root root 7 Mar 1 09:31 test -> softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# rm test
rm: remove `test'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]#
-
March 1st, 2001, 08:13 AM
#2
I think I followed all of that correctly, and I don't think I spotted anything wrong. When you create a symbolic link, then remove the target, that doesn't remove the link. So even though you rm softlnk, test -> softlnk or test remains, but softlnk is gone. The symbolic link goes in only one direction, that is, from the link to the target. There is no responsibility for the target to tell rm to search your entire system for each occurance of a link to itself, because the target is unaware of such links. The same holds true in MSWindows. Does that make sense? -mk
------------------
If it ain't broke, fix it till it is.
If it ain't broke,
Fix it till it is.
-
March 4th, 2001, 09:36 PM
#3
Hi, Thanks for going thro the whole thing,
my doubt is, I removed the file 'softlnk' using rm ,and did ls -il and then 'vi test', and then ln -s testhrdlnk test (to see is I am allowed to link an already - linked file again) then I deleted the file 'test' and did ls -il and in the list of files the file 'softlnk' which I had deleted earlier was there..how can it be?I deleted it,specifically using rm softlnk and listed out the contents of the directory ,and no softlnk .then after a sequence of steps,suddenly softlnk reappears..here's the relevant section again..The problem is I couldn't replicate the occurance with the same sequence of instructions,so I guess I have to leave it....
[root@bpp170 /root]# rm softlnk
rm: remove `softlnk'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255953 lrwxrwxrwx 1 root root 7 Mar 1 09:28 test -> softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
[root@bpp170 /root]# vi test
[root@bpp170 /root]# ln -s testhrdlnk test
ln: test: File exists
[root@bpp170 /root]# rm test
rm: remove `test'? y
[root@bpp170 /root]# ls -il
total 6740
255915 -rw------- 1 root root 6873088 Feb 28 16:33 core
255929 -rw-r--r-- 1 root root 65 Feb 28 15:16 new
224241 drwxr-xr-x 3 root root 4096 Feb 28 11:28 ns_imap
129041 drwx------ 2 root root 4096 Feb 28 11:27 nsmail
255955 -rw-r--r-- 1 root root 0 Mar 1 09:29 softlnk
255952 -rw-r--r-- 1 root root 15 Mar 1 09:23 testhrdlnk
-
March 5th, 2001, 03:28 AM
#4
test was symbolically linked to softlnk. You removed softlnk. You edited test and softlnk reappeared. Just as one woud expect it to.
Remember that all the criteria for the link between test and softlnk is stored in test. When you edited test, you were really calling an edit to softlnk, thus, recreating softlnk. test is not a real file in the normal sense of the word. I'm sure that when you first went into test, it was blank, as it would be since it's a new file. Now it you had also removed test, them edited test, the file test would have been created, not softlnk, since the link no longer exists.
test is just another name for softlnk, or an alias. But in this case, we can't use the term alias, since alias is a function that provides for other capabilities. Did I ******** that alittle better, or just muddy the issue? -mk
------------------
If it ain't broke, fix it till it is.
If it ain't broke,
Fix it till it is.
-
March 6th, 2001, 09:33 PM
#5
ok..now it is clear..since vi creates a file if it is nonexistent, when I did vi test ,since test is something like a pointer to softlnk,softlnk got created. Wonder why that didn't strike me...:-)
Thanks!!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|